From 5082709497205319235f6c07efa9e23cb35e7e82 Mon Sep 17 00:00:00 2001 From: notargs Date: Thu, 11 May 2023 16:58:33 +0900 Subject: [PATCH] =?UTF-8?q?SampleSH=E3=82=92=E5=88=86=E9=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VRM10/vrmc_materials_mtoon_lighting_unity.hlsl | 9 ++------- .../VRM10/vrmc_materials_mtoon_render_pipeline.hlsl | 10 ++++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_unity.hlsl b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_unity.hlsl index acf7e7953..2967bd4e3 100644 --- a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_unity.hlsl +++ b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_unity.hlsl @@ -22,13 +22,8 @@ UnityLighting GetUnityLighting(const Varyings input, const half3 normalWS) if (MToon_IsForwardBasePass()) { UnityLighting output; -#ifdef MTOON_URP - output.indirectLight = SampleSH(normalWS); - output.indirectLightEqualized = (SampleSH(half3(0, 1, 0)) + SampleSH(half3(0, -1, 0))) * 0.5; -#else - output.indirectLight = ShadeSH9(half4(normalWS, 1)); - output.indirectLightEqualized = (ShadeSH9(half4(0, 1, 0, 1)) + ShadeSH9(half4(0, -1, 0, 1))) * 0.5; -#endif + output.indirectLight = MToon_SampleSH(half3(normalWS)); + output.indirectLightEqualized = (MToon_SampleSH(half3(0, 1, 0)) + MToon_SampleSH(half3(0, -1, 0))) * 0.5; output.directLightColor = lightColor; output.directLightDirection = lightDir; output.directLightAttenuation = atten; 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 97f38d328..663da3528 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 @@ -75,6 +75,16 @@ #endif +// SampleSH +inline half3 MToon_SampleSH(half3 normalWS) +{ + #ifdef MTOON_URP + return SampleSH(normalWS); + #else + return ShadeSH9(half4(normalWS, 1)); + #endif +} + // Transform inline float3 MToon_TransformObjectToWorldNormal(float3 normalOS) {