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 cc4095293..fc2fe47fd 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 @@ -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 diff --git a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_render_pipeline.hlsl b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_render_pipeline.hlsl index 663da3528..441b94543 100644 --- a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_render_pipeline.hlsl +++ b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_render_pipeline.hlsl @@ -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