Skip to content

Commit 68b1b0f

Browse files
Merge pull request #381 from Gothic-Unity-Project/bugfix/barrier-far-clip
Fix barrier dome clipping with far-clip vertex pinning
2 parents cfa0251 + a9969fd commit 68b1b0f

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Assets/Gothic-Core/Shaders/Barrier.shader

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ Shader "Unlit/Barrier"
7171
v.uv.y += waveY * waveParams.x + (_MainTex_ST.y * (timeScaled - timeFloor)) + waveStrength;
7272

7373
o.vertex = UnityObjectToClipPos(v.vertex);
74+
75+
// The dome radius exceeds the dynamic (fog-sized) far-clip plane, so its far
76+
// hemisphere would otherwise be clipped, leaving the barrier visible only at the
77+
// screen edges. Pin any vertex beyond the far plane onto it (skybox technique);
78+
// verts already inside keep their true depth, so nearer geometry still occludes.
79+
#if defined(UNITY_REVERSED_Z)
80+
o.vertex.z = max(o.vertex.z, 0.0);
81+
#else
82+
o.vertex.z = min(o.vertex.z, o.vertex.w);
83+
#endif
84+
7485
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
7586

7687
o.color = v.color;

0 commit comments

Comments
 (0)