Simple Fake bRDFs
Reference to animation4ever unity shader code tutorial movie.
Game Developer Leegoon copyright all right reserved since 2010.
Shader "CodexShader/BRDF_DiffuseWrap" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _Ramp2D ("BRDF Ramp" , 2D) = "gray" {} _FolloffRange ("BRDF Range" , Range(0,1)) = 0.8 } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM // #pragma surface surf Lambert #pragma surface surf Ramp #pragma target 3.0 sampler2D _MainTex; sampler2D _Ramp2D; float _FolloffRange; struct Input { float2 uv_MainTex; }; half4 LightingRamp (SurfaceOutput s , half3 lightDir , half3 viewDir , half atten) { //float NdotL = saturate(dot(s.Normal, lightDir)); float NdotL = dot(s.Normal, lightDir); float NdotE = dot(s.Normal , viewDir); // folloff code //do diffuse wrap here float diff = (NdotL * 0.3) + 0.5; float2 brdfUV = half2(NdotE * _FolloffRange , diff); float3 BRDF = tex2D(_Ramp2D , brdfUV.xy).rgb; float4 c; //c.rgb =float3(diff,diff,diff); c.rgb = BRDF; c.a = s.Alpha; return c; } void surf (Input IN, inout SurfaceOutput o) { //half4 c = float4(.5,.5,.5,1); half4 c = tex2D (_MainTex, IN.uv_MainTex); o.Albedo = c.rgb; o.Alpha = c.a; } ENDCG } FallBack "Diffuse" }
Game Developer Leegoon copyright all right reserved since 2010.
잘 보고 갑니다. ㅎㅎ. 좋은 내용이 많네요.. ^^
ReplyDelete좋은 내용이라니 다행이네여 ^^
ReplyDelete좋은 내용이라니 다행이네여 ^^
ReplyDelete