Merge branch 'astoecke-fix-6386-water-reflection' into 'master'

Use `gl_FragCoord`  in `water_fragment.glsl` (fixes #6386)

Closes #6386

See merge request OpenMW/openmw!1347
macos-builds-only-for-openmw
psi29a 3 years ago
commit bea8df7dd4

@ -73,6 +73,7 @@
Bug #6354: SFX abruptly cut off after crossing max distance; implement soft fading of sound effects Bug #6354: SFX abruptly cut off after crossing max distance; implement soft fading of sound effects
Bug #6363: Some scripts in Morrowland fail to work Bug #6363: Some scripts in Morrowland fail to work
Bug #6376: Creatures should be able to use torches Bug #6376: Creatures should be able to use torches
Bug #6386: Artifacts in water reflection due to imprecise screen-space coordinate computation
Feature #890: OpenMW-CS: Column filtering Feature #890: OpenMW-CS: Column filtering
Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record
Feature #2780: A way to see current OpenMW version in the console Feature #2780: A way to see current OpenMW version in the console

@ -132,7 +132,6 @@ vec2 normalCoords(vec2 uv, float scale, float speed, float time, float timer1, f
return uv * (WAVE_SCALE * scale) + WIND_DIR * time * (WIND_SPEED * speed) -(previousNormal.xy/previousNormal.zz) * WAVE_CHOPPYNESS + vec2(time * timer1,time * timer2); return uv * (WAVE_SCALE * scale) + WIND_DIR * time * (WIND_SPEED * speed) -(previousNormal.xy/previousNormal.zz) * WAVE_CHOPPYNESS + vec2(time * timer1,time * timer2);
} }
varying vec3 screenCoordsPassthrough;
varying vec4 position; varying vec4 position;
varying float linearDepth; varying float linearDepth;
@ -152,6 +151,8 @@ uniform vec3 nodePosition;
uniform float rainIntensity; uniform float rainIntensity;
uniform vec2 screenRes;
#define PER_PIXEL_LIGHTING 0 #define PER_PIXEL_LIGHTING 0
#include "shadows_fragment.glsl" #include "shadows_fragment.glsl"
@ -178,8 +179,7 @@ void main(void)
float shadow = unshadowedLightRatio(linearDepth); float shadow = unshadowedLightRatio(linearDepth);
vec2 screenCoords = screenCoordsPassthrough.xy / screenCoordsPassthrough.z; vec2 screenCoords = gl_FragCoord.xy / screenRes;
screenCoords.y = (1.0-screenCoords.y);
#define waterTimer osg_SimulationTime #define waterTimer osg_SimulationTime

@ -2,7 +2,6 @@
uniform mat4 projectionMatrix; uniform mat4 projectionMatrix;
varying vec3 screenCoordsPassthrough;
varying vec4 position; varying vec4 position;
varying float linearDepth; varying float linearDepth;
@ -13,14 +12,6 @@ void main(void)
{ {
gl_Position = projectionMatrix * (gl_ModelViewMatrix * gl_Vertex); gl_Position = projectionMatrix * (gl_ModelViewMatrix * gl_Vertex);
mat4 scalemat = mat4(0.5, 0.0, 0.0, 0.0,
0.0, -0.5, 0.0, 0.0,
0.0, 0.0, 0.5, 0.0,
0.5, 0.5, 0.5, 1.0);
vec4 texcoordProj = ((scalemat) * ( gl_Position));
screenCoordsPassthrough = texcoordProj.xyw;
position = gl_Vertex; position = gl_Vertex;
vec4 viewPos = gl_ModelViewMatrix * gl_Vertex; vec4 viewPos = gl_ModelViewMatrix * gl_Vertex;

Loading…
Cancel
Save