mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-25 03:55:52 -05:00
Make fog work.
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user