漫反射48float3 lightFinal = diffuseReflection + UNITY_LIGHTMODEL_AMBIENT.xyz;//与环境光结合4950o.col = float4(lightFinal*_Color.rgb,1.0);51o.pos =mul(UNITY_MATRIX_MVP, v.vertex);52returno;53}5455//片段程序56float4 frag(vertexOutput i):COLOR57{58returni.col;59}6061ENDCG62}63}6465}...
虽然非常长,但是可以编译通过我还是都列出来了方便copy。 Shader"my/DiffuseVF"{Properties{_Color("Main Color",Color)=(1,1,1,1)_MainTex("Base (RGB)",2D)="white"{}}SubShader{Tags{"RenderType"="Opaque"}LOD200// --- forward rendering base pass:Pass{Name"FORWARD"Tags{"LightMode"="ForwardBase...
fixed4 frag(v2f i) : SV_Target { float4 c = tex2D(_MainTex,i.uv); //环境光 fixed3 ambient = UNITY_LIGHTMODEL_AMBIENT.xyz * _Diffuse; fixed3 worldLight = normalize(_WorldSpaceLightPos0.xyz); fixed3 worldNormal = normalize(i.worldNormal); fixed3 reflectDir2 = 2 * worldNormal ...
float3 inDirectionDiffuse = float3(0,0,0)+UNITY_LIGHTMODEL_AMBIENT.rgb; // 灯光与材质球表面颜色进行作用 float3 texColor = tex2D(_MainTex, i.uv).rgb; float3 diffuseColor = texColor *(directionDiffuse+inDirectionDiffuse); float4 finalColor = float4(diffuseColor,1); ...
下载源码 : http://yanonsoftware.googlepages.com/ShaderSimpler.zip 这个小程序通过把顶点法线逐象素插值,再计算每个象素的diffuse,specular光照结果来简单的实现phong模型。因为specular是view depended,所以Effect中增加了eyePos参数。 ... Blinn-Phong Reflection Model ...
float3 ambient = UNITY_LIGHTMODEL_AMBIENT.xyz * _Diffuse; //环境光 float3 worldLight = normalize(_WorldSpaceLightPos0.xyz); //归一化光方向 float3 worldNormal = normalize(o.worldNormal); //归一化worldNormal float NdotL = max(0, dot(worldLight, worldNormal)); //法线和光线的点积,即余弦...
这种各向同性的反射叫漫反射(Diffuse reflection)。漫反射光的强度服从于Lambert定律,光强与入射光的方向和反射点处表面法向夹角的余弦成正比。Lambe... Just a Programer 0 2425 光照模型 2018-01-13 16:05 − 光照模型(illumination model),也称为明暗模型,用于计算物体某点处的 光强(颜色值)。从算法...
fixed3 halfLambert=dot(worldNormal,worldLightDir)*0.5+0.5; //利用半兰伯特公式计算漫反射光 fixed3 diffuse=_LightColor0.rgb*_Diffuse.rgb*halfLambert; //加上环境光的影响 fixed3 color=ambient+diffuse; returnfixed4(color,1.0); } ENDCG } } FallBack"Diffuse" } 效果对比...
An image irradiance equation based on Lunar-Lambert reflectance model was obtained,which was transformed into the corresponding static Hamilton-Jacobi equation. 首先,分析了在太阳光照条件下月球表面的成像模型,建立了基于Lunar-Lambert反射模型的图像辐照度方程。3) diffuse reflection model 漫反射模型4...
We propose skin pigmentation model based on a modified Beer-Lambert model of skin diffuse reflectance to measure types of melanin. A clinical study involving 118 participants with different skin phototypes (SPTs) is conducted where the skin reflectance data of participants are measured using ...