1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-12-13 06:13:06 +00:00

opaque depth texture must account for multiview

This commit is contained in:
Mads Buvik Sandvei 2025-01-26 14:57:34 +01:00
parent c16064e6f3
commit 2762be9f85
6 changed files with 21 additions and 9 deletions

View file

@ -26,8 +26,6 @@ uniform sampler2D normalMap;
varying vec2 normalMapUV; varying vec2 normalMapUV;
#endif #endif
uniform sampler2D opaqueDepthTex;
varying float euclideanDepth; varying float euclideanDepth;
varying float linearDepth; varying float linearDepth;
@ -59,7 +57,7 @@ void main()
#if defined(DISTORTION) && DISTORTION #if defined(DISTORTION) && DISTORTION
vec2 screenCoords = gl_FragCoord.xy / (screenRes * @distorionRTRatio); vec2 screenCoords = gl_FragCoord.xy / (screenRes * @distorionRTRatio);
gl_FragData[0].a *= getDiffuseColor().a; gl_FragData[0].a *= getDiffuseColor().a;
gl_FragData[0] = applyDistortion(gl_FragData[0], distortionStrength, gl_FragCoord.z, texture2D(opaqueDepthTex, screenCoords).x); gl_FragData[0] = applyDistortion(gl_FragData[0], distortionStrength, gl_FragCoord.z, sampleOpaqueDepthTex(screenCoords).x);
return; return;
#endif #endif

View file

@ -35,7 +35,6 @@ uniform float alphaRef;
#if @softParticles #if @softParticles
#include "lib/particle/soft.glsl" #include "lib/particle/soft.glsl"
uniform sampler2D opaqueDepthTex;
uniform float particleSize; uniform float particleSize;
uniform bool particleFade; uniform bool particleFade;
uniform float softFalloffDepth; uniform float softFalloffDepth;
@ -70,7 +69,7 @@ void main()
viewNormal, viewNormal,
near, near,
far, far,
texture2D(opaqueDepthTex, screenCoords).x, sampleOpaqueDepthTex(screenCoords).x,
particleSize, particleSize,
particleFade, particleFade,
softFalloffDepth softFalloffDepth

View file

@ -113,8 +113,6 @@ uniform sampler2D orthoDepthMap;
varying vec3 orthoDepthMapCoord; varying vec3 orthoDepthMapCoord;
#endif #endif
uniform sampler2D opaqueDepthTex;
void main() void main()
{ {
#if @particleOcclusion #if @particleOcclusion
@ -143,7 +141,7 @@ vec2 screenCoords = gl_FragCoord.xy / screenRes;
#if defined(DISTORTION) && DISTORTION #if defined(DISTORTION) && DISTORTION
gl_FragData[0].a *= getDiffuseColor().a; gl_FragData[0].a *= getDiffuseColor().a;
gl_FragData[0] = applyDistortion(gl_FragData[0], distortionStrength, gl_FragCoord.z, texture2D(opaqueDepthTex, screenCoords / @distorionRTRatio).x); gl_FragData[0] = applyDistortion(gl_FragData[0], distortionStrength, gl_FragCoord.z, sampleOpaqueDepthTex(screenCoords / @distorionRTRatio).x);
return; return;
#endif #endif
@ -258,7 +256,7 @@ vec2 screenCoords = gl_FragCoord.xy / screenRes;
viewNormal, viewNormal,
near, near,
far, far,
texture2D(opaqueDepthTex, screenCoords).x, sampleOpaqueDepthTex(screenCoords).x,
particleSize, particleSize,
particleFade, particleFade,
softFalloffDepth softFalloffDepth

View file

@ -40,3 +40,10 @@ vec3 sampleSkyColor(vec2 uv)
return texture2D(sky, uv).xyz; return texture2D(sky, uv).xyz;
} }
#endif #endif
uniform sampler2D opaqueDepthTex;
vec4 sampleOpaqueDepthTex(vec2 uv)
{
return texture2D(opaqueDepthTex, uv);
}

View file

@ -17,4 +17,6 @@ vec4 samplerLastShader(vec2 uv);
vec3 sampleSkyColor(vec2 uv); vec3 sampleSkyColor(vec2 uv);
#endif #endif
vec4 sampleOpaqueDepthTex(vec2 uv);
#endif // OPENMW_FRAGMENT_H_GLSL #endif // OPENMW_FRAGMENT_H_GLSL

View file

@ -2,6 +2,7 @@
#extension GL_OVR_multiview : require #extension GL_OVR_multiview : require
#extension GL_OVR_multiview2 : require #extension GL_OVR_multiview2 : require
#extension GL_EXT_texture_array : require
#include "lib/core/fragment.h.glsl" #include "lib/core/fragment.h.glsl"
@ -44,3 +45,10 @@ vec3 sampleSkyColor(vec2 uv)
return texture(sky, vec3((uv), gl_ViewID_OVR)).xyz; return texture(sky, vec3((uv), gl_ViewID_OVR)).xyz;
} }
#endif #endif
uniform sampler2DArray opaqueDepthTex;
vec4 sampleOpaqueDepthTex(vec2 uv)
{
return texture2DArray(opaqueDepthTex, vec3((uv), gl_ViewID_OVR));
}