|
|
|
|
|
|
// Otherwise evaluate SH fully per-pixel |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#define DECLARE_LIGHTMAP_OR_SH(lmName, shName, index) float2 lmName : TEXCOORD##index |
|
|
|
#define DECLARE_LIGHTMAP_OR_SH(lmName, shName, index) half3 shName : TEXCOORD##index |
|
|
|
#define OUTPUT_LIGHTMAP_UV(lightmapUV, lightmapScaleOffset, OUT) |
|
|
|
#define OUTPUT_SH(normalWS, OUT) OUT.xyz = SampleSHVertex(normalWS) |
|
|
|
#endif |
|
|
|
|
|
|
// We either sample GI from baked lightmap or from probes. |
|
|
|
// If lightmap: sampleData.xy = lightmapUV |
|
|
|
// If probe: sampleData.xyz = L2 SH terms |
|
|
|
half3 SampleGI(float4 sampleData, half3 normalWS) |
|
|
|
#ifdef LIGHTMAP_ON |
|
|
|
#define SAMPLE_GI(lmName, shName, normalWSName) SampleGI(lmName, normalWSName) |
|
|
|
half3 SampleGI(float2 sampleData, half3 normalWS) |
|
|
|
{ |
|
|
|
return SampleLightmap(sampleData, normalWS); |
|
|
|
} |
|
|
|
#else |
|
|
|
#define SAMPLE_GI(lmName, shName, normalWSName) SampleGI(shName, normalWSName) |
|
|
|
half3 SampleGI(half3 sampleData, half3 normalWS) |
|
|
|
#ifdef LIGHTMAP_ON |
|
|
|
return SampleLightmap(sampleData.xy, normalWS); |
|
|
|
#endif |
|
|
|
|
|
|
|
return SampleSHPixel(sampleData.xyz, normalWS); |
|
|
|
return SampleSHPixel(sampleData, normalWS); |
|
|
|
#endif |
|
|
|
|
|
|
|
half3 GlossyEnvironmentReflection(half3 reflectVector, half perceptualRoughness, half occlusion) |
|
|
|
{ |
|
|
|