mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-20 17:45:22 -05:00
MTOON_TRANSFER_FOG_AND_LIGHTINGを切り出した
This commit is contained in:
@@ -42,23 +42,7 @@ Varyings MToonVertex(const Attributes v) // v is UnityCG macro specified name.
|
||||
output.tangentWS = half4(MToon_TransformObjectToWorldDir(v.tangentOS), tangentSign);
|
||||
#endif
|
||||
|
||||
#ifdef MTOON_URP
|
||||
OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUV);
|
||||
OUTPUT_SH(output.normalWS.xyz, output.vertexSH);
|
||||
|
||||
half3 vertexLight = VertexLighting(output.positionWS, output.normalWS);
|
||||
half fogFactor = ComputeFogFactor(output.pos.z);
|
||||
output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz);
|
||||
output.shadowCoord = GetShadowCoord(vertexInput);
|
||||
#endif
|
||||
|
||||
#else
|
||||
UNITY_TRANSFER_FOG(output, output.pos);
|
||||
UNITY_TRANSFER_LIGHTING(output, v.texcoord1.xy);
|
||||
#endif
|
||||
MTOON_TRANSFER_FOG_AND_LIGHTING(output, output.pos, v.texcoord1.xy, v.vertex.xyz);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -81,6 +81,28 @@
|
||||
|
||||
#endif
|
||||
|
||||
// Transfer fog and lighting
|
||||
#ifdef MTOON_URP
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
#define MTOON_TRANSFER_FOG_AND_LIGHTING(o, outpos, coord, vertex) \
|
||||
OUTPUT_LIGHTMAP_UV(coord.xy, unity_LightmapST, output.lightmapUV); \
|
||||
OUTPUT_SH(output.normalWS.xyz, output.vertexSH); \
|
||||
output.fogFactorAndVertexLight = half4(ComputeFogFactor(outpos.z), VertexLighting(output.positionWS, output.normalWS)); \
|
||||
output.shadowCoord = GetShadowCoord(GetVertexPositionInputs(vertex.xyz));
|
||||
#else
|
||||
#define MTOON_TRANSFER_FOG_AND_LIGHTING(o, outpos, coord, vertex) \
|
||||
OUTPUT_LIGHTMAP_UV(coord.xy, unity_LightmapST, output.lightmapUV); \
|
||||
OUTPUT_SH(output.normalWS.xyz, output.vertexSH); \
|
||||
output.fogFactorAndVertexLight = half4(ComputeFogFactor(outpos.z), VertexLighting(output.positionWS, output.normalWS));
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define MTOON_TRANSFER_FOG_AND_LIGHTING(o, outpos, coord, vertex) \
|
||||
UNITY_TRANSFER_FOG(o, outpos); \
|
||||
UNITY_TRANSFER_LIGHTING(o, coord.xy);
|
||||
#endif
|
||||
|
||||
// SampleSH
|
||||
inline half3 MToon_SampleSH(half3 normalWS)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user