diff --git a/NoeNoe Shaders/NoeNoe Toon Shader/NoeNoeToonEdits.cginc b/NoeNoe Shaders/NoeNoe Toon Shader/NoeNoeToonEdits.cginc index 83420e7..a0381a0 100644 --- a/NoeNoe Shaders/NoeNoe Toon Shader/NoeNoeToonEdits.cginc +++ b/NoeNoe Shaders/NoeNoe Toon Shader/NoeNoeToonEdits.cginc @@ -180,13 +180,31 @@ float4 frag(VertexOutput i, float facing : VFACE) : COLOR { float roughness = 1 - (metallicTex.a * _Glossiness); float3 reflectedDir = reflect(-i.viewDir, normalize(i.normalDir)); - float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS); - float3 reflectionColor = DecodeHDR(reflectionData, unity_SpecCube0_HDR); - reflectionColor *= Diffuse; + float3 reflectionColor; + + //Sample second probe if available. + float interpolator = unity_SpecCube0_BoxMin.w; + UNITY_BRANCH + if(interpolator < 0.99999) + { + //Probe 1 + float4 reflectionData0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS); + float3 reflectionColor0 = DecodeHDR(reflectionData0, unity_SpecCube0_HDR); + + //Probe 2 + float4 reflectionData1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS); + float3 reflectionColor1 = DecodeHDR(reflectionData1, unity_SpecCube1_HDR); + + reflectionColor = lerp(reflectionColor1, reflectionColor0, interpolator); + } + else + { + float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS); + reflectionColor = DecodeHDR(reflectionData, unity_SpecCube0_HDR); + } - //Lit reflections - //Diffuse = lerp(Diffuse, reflectionColor, metallic); + reflectionColor *= Diffuse; #endif float node_424 = 0.5; diff --git a/NoeNoe Shaders/readme_rokk.txt b/NoeNoe Shaders/readme_rokk.txt index 01eeb4c..1a1ecf4 100644 --- a/NoeNoe Shaders/readme_rokk.txt +++ b/NoeNoe Shaders/readme_rokk.txt @@ -33,4 +33,4 @@ A premade skin-colored toon ramp is included ("toon_skin_hq"). You can use toon You should set the texture mode to "Clamp" in Unity on the toon ramp texture, to avoid very ugly artifacts. -Experimental Metallic support has been added. You can use the same metallic maps as in Standard (Red is Metallic, Alpha is Smoothness). Smoothness doesn't do anything by itself, lower smoothness only blurs the reflections on the Metallic. Reflections work the same way as Standard, but blending between multiple probes is not yet supported. This will come in the next version. \ No newline at end of file +Experimental Metallic support has been added. You can use the same metallic maps as in Standard (Red is Metallic, Alpha is Smoothness). Smoothness doesn't do anything by itself, lower smoothness only blurs the reflections on the Metallic. Reflections work the same way as Standard. \ No newline at end of file