From d33327eba9d1af9024385bb2d34131c64642bc8f Mon Sep 17 00:00:00 2001 From: notargs Date: Thu, 11 May 2023 17:35:54 +0900 Subject: [PATCH] =?UTF-8?q?MTOON=5FLIGHT=5FDESCRIPTION=E3=81=8B=E3=82=89?= =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E5=A4=89=E6=95=B0=E5=AE=9A=E7=BE=A9?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vrmc_materials_mtoon_forward_vertex.hlsl | 3 +-- .../vrmc_materials_mtoon_render_pipeline.hlsl | 16 +++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) 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