diff options
| author | yum <yum.food.vr@gmail.com> | 2025-06-05 22:15:00 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-06-05 22:15:00 -0700 |
| commit | d888c25cfcf0da223bfa9e8312d825183a65122a (patch) | |
| tree | 3c7310b658ceaec35b6e685da12a985900311fba /fog.cginc | |
| parent | 8b7ae8db808d76ddea503f94e142c7d37c1b43d3 (diff) | |
fix fog in vr
Diffstat (limited to 'fog.cginc')
| -rw-r--r-- | fog.cginc | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -39,11 +39,8 @@ FogResult raymarched_fog(v2f i, FogParams p) const float ro_epsilon = 1E-3; ro += rd * ro_epsilon; - // TODO maybe we can accelerate this? - float perspective_divide = 1.0f / i.pos.w; - float perspective_factor = length(i.eyeVec.xyz * perspective_divide); - - const float2 screen_uv = (i.pos.xy + 0.5) / _ScreenParams.xy; + float4 clipPos = UnityObjectToClipPos(i.objPos); + float2 screen_uv = ComputeScreenPos(clipPos) / clipPos.w; float zDepthFromMap = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, screen_uv); float linearZ = |
