SampleSHを分離

This commit is contained in:
notargs
2023-05-11 16:58:33 +09:00
parent 6dd0fb4fd9
commit 5082709497
2 changed files with 12 additions and 7 deletions

View File

@@ -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;

View File

@@ -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)
{