Skip to content

Commit 5bfb052

Browse files
committed
Make fog work.
1 parent 62947f4 commit 5bfb052

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_attribute.hlsl

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ struct Varyings
2525
half4 tangentWS : TEXCOORD3;
2626
#endif
2727
float3 viewDirWS : TEXCOORD4;
28-
UNITY_FOG_COORDS(6)
29-
UNITY_LIGHTING_COORDS(7,8)
28+
UNITY_FOG_COORDS(5)
29+
UNITY_LIGHTING_COORDS(6,7)
3030
float4 pos : SV_POSITION; // UnityCG macro specified name. Accurately "positionCS"
3131
UNITY_VERTEX_INPUT_INSTANCE_ID
3232
UNITY_VERTEX_OUTPUT_STEREO
@@ -38,4 +38,4 @@ struct FragmentInput
3838
MTOON_FRONT_FACE_TYPE facing : MTOON_FRONT_FACE_SEMANTIC;
3939
};
4040

41-
#endif
41+
#endif

Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_fragment.hlsl

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@ half4 MToonFragment(const FragmentInput fragmentInput) : SV_Target
4343
mtoonInput.viewDirWS = normalize(input.viewDirWS);
4444
mtoonInput.litColor = litColor.rgb;
4545
mtoonInput.alpha = alpha;
46-
const half4 col = GetMToonLighting(unityLighting, mtoonInput);
46+
half4 col = GetMToonLighting(unityLighting, mtoonInput);
4747

48-
UNITY_APPLY_FOG(i.fogCoord, col);
48+
// Apply Fog
49+
UNITY_APPLY_FOG(fragmentInput.varyings.fogCoord, col);
4950

5051
return col;
5152
}
5253

53-
#endif
54+
#endif

Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_vertex.hlsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ Varyings MToonVertex(const Attributes v) // v is UnityCG macro specified name.
4141
output.tangentWS = half4(UnityObjectToWorldDir(v.tangentOS), tangentSign);
4242
#endif
4343

44-
UNITY_TRANSFER_FOG(output, output.positionWS);
44+
UNITY_TRANSFER_FOG(output, output.pos);
4545
UNITY_TRANSFER_LIGHTING(output, v.texcoord1.xy);
4646

4747
return output;
4848
}
4949

50-
#endif
50+
#endif

0 commit comments

Comments
 (0)