diff options
| author | yum <yum.food.vr@gmail.com> | 2026-01-18 09:02:07 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-01-18 09:02:07 -0800 |
| commit | a3c74c361ccba6f0ecee686d7e336cf905246c38 (patch) | |
| tree | c5ff736ddad6be070302a8c83de533103bb5f4ae /impostor.cginc | |
| parent | 50e451441f628aa3a28241af118700ae12147583 (diff) | |
Impostors: combine metallic gloss & depth atlases
Diffstat (limited to 'impostor.cginc')
| -rwxr-xr-x | impostor.cginc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/impostor.cginc b/impostor.cginc index 048eaf6..1afbdea 100755 --- a/impostor.cginc +++ b/impostor.cginc @@ -108,7 +108,7 @@ AtlasUvGrad PrepareAtlasUvGrad(float2 cell, float2 uvInCell, float invGridRes) { float SampleImpostorDepthCell(float2 cell, float2 uvInCell, float invGridRes) { AtlasUvGrad uv = PrepareAtlasUvGrad(cell, uvInCell, invGridRes); - return _Impostors_Depth_Atlas.SampleGrad(bilinear_clamp_s, uv.atlasUv, uv.gradX, uv.gradY).r; + return _Impostors_Metallic_Gloss_Depth_Atlas.SampleGrad(bilinear_clamp_s, uv.atlasUv, uv.gradX, uv.gradY).b; } float SampleImpostorAlphaCell(float2 cell, float2 uvInCell, float invGridRes) { @@ -121,7 +121,8 @@ ImpostorSample SampleImpostorCell(float2 cell, float2 uvInCell, float invGridRes ImpostorSample s; s.albedo = _Impostors_Atlas.SampleGrad(bilinear_clamp_s, uv.atlasUv, uv.gradX, uv.gradY); s.normal = _Impostors_Normal_Atlas.SampleGrad(bilinear_clamp_s, uv.atlasUv, uv.gradX, uv.gradY); - s.metallicGloss = _Impostors_Metallic_Gloss_Atlas.SampleGrad(bilinear_clamp_s, uv.atlasUv, uv.gradX, uv.gradY); + float4 mgd = _Impostors_Metallic_Gloss_Depth_Atlas.SampleGrad(bilinear_clamp_s, uv.atlasUv, uv.gradX, uv.gradY); + s.metallicGloss = float4(mgd.rg, 0, 0); return s; } @@ -331,7 +332,7 @@ ImpostorResult impostor_frag(float3 worldPos) { float3 normalOS = blended.normal.xyz * 2.0 - 1.0; result.normal = normalize(mul((float3x3)unity_ObjectToWorld, normalOS)); result.metallic = blended.metallicGloss.r; - result.smoothness = blended.metallicGloss.a; + result.smoothness = blended.metallicGloss.g; #if defined(_IMPOSTORS_DEPTH) // Reuse depth samples for position reconstruction |
