diff options
| -rw-r--r-- | impostor.cginc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/impostor.cginc b/impostor.cginc index 1245a1c..bdb24e7 100644 --- a/impostor.cginc +++ b/impostor.cginc @@ -12,10 +12,8 @@ float _Cutoff; float _SphereRadius; float3 _ImpostorMainCameraPos; -#ifndef IMPOSTOR_SHADOW_PASS float4 _Color; float _DebugMode; -#endif float2 HemiOctEncode(float3 N) { N.y = max(N.y, 1e-4); @@ -197,11 +195,11 @@ float4 frag(v2f i) : SV_Target { #endif float3 center = i.centerPos; - // For lattice lookup, we need the reverse view direction. - // Lattice points are indexed by outward direction (origin → lattice). - // We want lattice points whose inward direction (lattice → origin) matches the view ray. - // So we lookup using -viewDir to find lattice points pointing opposite to the ray. - float3 viewOS = normalize(mul((float3x3)unity_WorldToObject, -viewDir)); + // For lattice lookup, use the camera-to-impostor-center direction (matches billboard orientation). + // Using the per-fragment view ray (camera→quad point) causes the selected lattice points/weights + // to vary across the billboard, which reads as "not smooth" while moving around the impostor. + float3 centerToCamWS = normalize(camPos - center); + float3 viewOS = normalize(mul((float3x3)unity_WorldToObject, centerToCamWS)); // Get continuous grid position and find the 3 frames float gridRes = (float)_GridResolution; |
