diff --git a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_attribute.hlsl b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_attribute.hlsl index e20cb6669..e406a2491 100644 --- a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_attribute.hlsl +++ b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_attribute.hlsl @@ -25,8 +25,8 @@ struct Varyings half4 tangentWS : TEXCOORD3; #endif float3 viewDirWS : TEXCOORD4; - UNITY_FOG_COORDS(6) - UNITY_LIGHTING_COORDS(7,8) + UNITY_FOG_COORDS(5) + UNITY_LIGHTING_COORDS(6,7) float4 pos : SV_POSITION; // UnityCG macro specified name. Accurately "positionCS" UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO @@ -38,4 +38,4 @@ struct FragmentInput MTOON_FRONT_FACE_TYPE facing : MTOON_FRONT_FACE_SEMANTIC; }; -#endif +#endif \ No newline at end of file diff --git a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_fragment.hlsl b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_fragment.hlsl index 0e08f4b50..544e3560a 100644 --- a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_fragment.hlsl +++ b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_fragment.hlsl @@ -43,11 +43,12 @@ half4 MToonFragment(const FragmentInput fragmentInput) : SV_Target mtoonInput.viewDirWS = normalize(input.viewDirWS); mtoonInput.litColor = litColor.rgb; mtoonInput.alpha = alpha; - const half4 col = GetMToonLighting(unityLighting, mtoonInput); + half4 col = GetMToonLighting(unityLighting, mtoonInput); - UNITY_APPLY_FOG(i.fogCoord, col); + // Apply Fog + UNITY_APPLY_FOG(fragmentInput.varyings.fogCoord, col); return col; } -#endif +#endif \ No newline at end of file diff --git a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_vertex.hlsl b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_vertex.hlsl index b7dc73cac..9e72bc48b 100644 --- a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_vertex.hlsl +++ b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_vertex.hlsl @@ -41,10 +41,10 @@ Varyings MToonVertex(const Attributes v) // v is UnityCG macro specified name. output.tangentWS = half4(UnityObjectToWorldDir(v.tangentOS), tangentSign); #endif - UNITY_TRANSFER_FOG(output, output.positionWS); + UNITY_TRANSFER_FOG(output, output.pos); UNITY_TRANSFER_LIGHTING(output, v.texcoord1.xy); return output; } -#endif +#endif \ No newline at end of file