mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-04 02:41:19 +00:00
Merge branch 'sky_blending_multiview' into 'master'
Support sky blending in multiview mode See merge request OpenMW/openmw!2113
This commit is contained in:
commit
a1e7622a30
@ -1,7 +1,8 @@
|
||||
uniform float far;
|
||||
|
||||
#if @skyBlending
|
||||
uniform sampler2D sky;
|
||||
#include "openmw_fragment.h.glsl"
|
||||
|
||||
uniform float skyBlendingStart;
|
||||
#endif
|
||||
|
||||
@ -23,14 +24,13 @@ vec4 applyFogAtDist(vec4 color, float euclideanDist, float linearDist)
|
||||
color.xyz = mix(color.xyz, gl_Fog.color.xyz, fogValue);
|
||||
#endif
|
||||
|
||||
#if @skyBlending && !@useOVR_multiview
|
||||
#if @skyBlending
|
||||
float fadeValue = clamp((far - dist) / (far - skyBlendingStart), 0.0, 1.0);
|
||||
fadeValue *= fadeValue;
|
||||
#ifdef ADDITIVE_BLENDING
|
||||
color.xyz *= fadeValue;
|
||||
#else
|
||||
vec3 skyColor = texture2D(sky, gl_FragCoord.xy / screenRes).xyz;
|
||||
color.xyz = mix(skyColor, color.xyz, fadeValue);
|
||||
color.xyz = mix(mw_sampleSkyColor(gl_FragCoord.xy / screenRes), color.xyz, fadeValue);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -31,3 +31,12 @@ vec4 mw_samplerLastShader(vec2 uv)
|
||||
{
|
||||
return texture2D(omw_SamplerLastShader, uv);
|
||||
}
|
||||
|
||||
#if @skyBlending
|
||||
uniform sampler2D sky;
|
||||
|
||||
vec3 mw_sampleSkyColor(vec2 uv)
|
||||
{
|
||||
return texture2D(sky, uv).xyz;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef OPENMW_FRAGMENT_H_GLSL
|
||||
#define OPENMW_FRAGMENT_H_GLSL
|
||||
|
||||
@link "openmw_fragment.glsl" if !@useOVR_multiview
|
||||
@link "openmw_fragment_multiview.glsl" if @useOVR_multiview
|
||||
|
||||
@ -8,4 +11,10 @@ vec4 mw_sampleRefractionMap(vec2 uv);
|
||||
float mw_sampleRefractionDepthMap(vec2 uv);
|
||||
#endif
|
||||
|
||||
vec4 mw_samplerLastShader(vec2 uv);
|
||||
vec4 mw_samplerLastShader(vec2 uv);
|
||||
|
||||
#if @skyBlending
|
||||
vec3 mw_sampleSkyColor(vec2 uv);
|
||||
#endif
|
||||
|
||||
#endif // OPENMW_FRAGMENT_H_GLSL
|
||||
|
@ -35,4 +35,13 @@ uniform sampler2DArray omw_SamplerLastShader;
|
||||
vec4 mw_samplerLastShader(vec2 uv)
|
||||
{
|
||||
return texture2DArray(omw_SamplerLastShader, vec3((uv), gl_ViewID_OVR));
|
||||
}
|
||||
}
|
||||
|
||||
#if @skyBlending
|
||||
uniform sampler2DArray sky;
|
||||
|
||||
vec3 mw_sampleSkyColor(vec2 uv)
|
||||
{
|
||||
return texture2DArray(sky, vec3((uv), gl_ViewID_OVR)).xyz;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user