diff options
| author | yum <yum.food.vr@gmail.com> | 2024-10-09 04:11:22 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-10-09 04:11:22 -0700 |
| commit | c22c911ea360b0f9bdd9ee6ccd735fbcfe3bfad6 (patch) | |
| tree | b81fabfdaf8819294347e2894f1254f4538ad5aa | |
| parent | 5b0b45f9e4892c8e66f36211ebcb1039dd012b1b (diff) | |
Avatar bugfixes
| -rw-r--r-- | globals.cginc | 1 | ||||
| -rw-r--r-- | pbr.cginc | 34 |
2 files changed, 18 insertions, 17 deletions
diff --git a/globals.cginc b/globals.cginc index 5271e64..b4b0c84 100644 --- a/globals.cginc +++ b/globals.cginc @@ -85,7 +85,6 @@ float _Clearcoat_Mask2_Invert; #endif #if defined(SSR_ENABLED) -UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); sampler2D _GrabTexture; sampler2D _NoiseTexSSR; float4 _GrabTexture_TexelSize; @@ -254,6 +254,21 @@ float4 getLitColor( direct_light.color *= (1 - e); } +#if defined(_LTCGI) + ltcgi_acc acc = (ltcgi_acc) 0; + if ((bool) round(_LTCGI_Enabled)) { + LTCGI_Contribution( + acc, + i.worldPos, + normal, + view_dir, + GetRoughness(smoothness), + 0); + indirect_light.diffuse += acc.diffuse; + indirect_light.specular += acc.specular; + } +#endif + direct_light.color = RGBtoHSV(direct_light.color); indirect_light.specular = RGBtoHSV(indirect_light.specular); indirect_light.diffuse = RGBtoHSV(indirect_light.diffuse); @@ -322,11 +337,12 @@ float4 getLitColor( float2 screenUVs = 0; float4 screenPos = 0; #if SSR_ENABLED - screenUVs = i.screenPos.xy / (i.screenPos.w+0.0000000001); + float perspective_divide = rcp(i.pos.w+0.0000000001); + screenUVs = i.screenPos.xy * perspective_divide; #if UNITY_SINGLE_PASS_STEREO || defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED ) screenUVs.x *= 2; #endif - screenPos = i.screenPos; + screenPos = float4(i.screenPos, 0, i.pos.w); #endif #if 1 @@ -445,20 +461,6 @@ float4 getLitColor( #endif #endif -#if defined(_LTCGI) - ltcgi_acc acc = (ltcgi_acc) 0; - if ((bool) round(_LTCGI_Enabled)) { - LTCGI_Contribution( - acc, - i.worldPos, - normal, - view_dir, - GetRoughness(smoothness), - 0); - pbr.rgb += acc.diffuse + acc.specular; - } -#endif - UNITY_APPLY_FOG(i.fogCoord, pbr.rgb); return float4(pbr.rgb, albedo.a); |
