MTOON_LIGHT_DESCRIPTIONから不要な変数定義を削除

This commit is contained in:
notargs
2023-05-11 17:35:54 +09:00
parent 5082709497
commit d33327eba9
2 changed files with 12 additions and 7 deletions

View File

@@ -43,8 +43,6 @@ Varyings MToonVertex(const Attributes v) // v is UnityCG macro specified name.
#endif
#ifdef MTOON_URP
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz);
OUTPUT_LIGHTMAP_UV(input.texcoord1, unity_LightmapST, output.lightmapUV);
OUTPUT_SH(output.normalWS.xyz, output.vertexSH);
@@ -53,6 +51,7 @@ Varyings MToonVertex(const Attributes v) // v is UnityCG macro specified name.
output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz);
output.shadowCoord = GetShadowCoord(vertexInput);
#endif

View File

@@ -59,12 +59,18 @@
#define MTOON_SHADOW_COORD float4(0, 0, 0, 0)
#endif
#if defined(SHADOWS_SHADOWMASK) && defined(LIGHTMAP_ON)
#define MTOON_SAMPLE_SHADOWMASK(uv) SAMPLE_TEXTURE2D_LIGHTMAP(SHADOWMASK_NAME, SHADOWMASK_SAMPLER_NAME, uv SHADOWMASK_SAMPLE_EXTRA_ARGS)
#elif !defined (LIGHTMAP_ON)
#define MTOON_SAMPLE_SHADOWMASK(uv) unity_ProbesOcclusion
#else
#define MTOON_SAMPLE_SHADOWMASK(uv) half4(1, 1, 1, 1)
#endif
#define MTOON_LIGHT_DESCRIPTION(input, atten, lightDir, lightColor) \
half4 shadowMask = SAMPLE_SHADOWMASK(input.lightmapUV); \
Light mainLight = GetMainLight(MTOON_SHADOW_COORD, input.positionWS, shadowMask); \
const half3 lightDir = mainLight.direction; \
const half3 lightColor = mainLight.color.rgb; \
const float atten = mainLight.shadowAttenuation;
const half3 lightDir = _MainLightPosition.xyz; \
const half3 lightColor = _MainLightColor.rgb; \
const float atten = MainLightShadow(MTOON_SHADOW_COORD, input.positionWS, MTOON_SAMPLE_SHADOWMASK(input.lightmapUV), _MainLightOcclusionProbes);
#else