mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-14 03:06:45 +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
4 changed files with 33 additions and 6 deletions
|
@ -1,7 +1,8 @@
|
||||||
uniform float far;
|
uniform float far;
|
||||||
|
|
||||||
#if @skyBlending
|
#if @skyBlending
|
||||||
uniform sampler2D sky;
|
#include "openmw_fragment.h.glsl"
|
||||||
|
|
||||||
uniform float skyBlendingStart;
|
uniform float skyBlendingStart;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -23,14 +24,13 @@ vec4 applyFogAtDist(vec4 color, float euclideanDist, float linearDist)
|
||||||
color.xyz = mix(color.xyz, gl_Fog.color.xyz, fogValue);
|
color.xyz = mix(color.xyz, gl_Fog.color.xyz, fogValue);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if @skyBlending && !@useOVR_multiview
|
#if @skyBlending
|
||||||
float fadeValue = clamp((far - dist) / (far - skyBlendingStart), 0.0, 1.0);
|
float fadeValue = clamp((far - dist) / (far - skyBlendingStart), 0.0, 1.0);
|
||||||
fadeValue *= fadeValue;
|
fadeValue *= fadeValue;
|
||||||
#ifdef ADDITIVE_BLENDING
|
#ifdef ADDITIVE_BLENDING
|
||||||
color.xyz *= fadeValue;
|
color.xyz *= fadeValue;
|
||||||
#else
|
#else
|
||||||
vec3 skyColor = texture2D(sky, gl_FragCoord.xy / screenRes).xyz;
|
color.xyz = mix(mw_sampleSkyColor(gl_FragCoord.xy / screenRes), color.xyz, fadeValue);
|
||||||
color.xyz = mix(skyColor, color.xyz, fadeValue);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -31,3 +31,12 @@ vec4 mw_samplerLastShader(vec2 uv)
|
||||||
{
|
{
|
||||||
return texture2D(omw_SamplerLastShader, 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.glsl" if !@useOVR_multiview
|
||||||
@link "openmw_fragment_multiview.glsl" if @useOVR_multiview
|
@link "openmw_fragment_multiview.glsl" if @useOVR_multiview
|
||||||
|
|
||||||
|
@ -9,3 +12,9 @@ float mw_sampleRefractionDepthMap(vec2 uv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec4 mw_samplerLastShader(vec2 uv);
|
vec4 mw_samplerLastShader(vec2 uv);
|
||||||
|
|
||||||
|
#if @skyBlending
|
||||||
|
vec3 mw_sampleSkyColor(vec2 uv);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // OPENMW_FRAGMENT_H_GLSL
|
||||||
|
|
|
@ -36,3 +36,12 @@ vec4 mw_samplerLastShader(vec2 uv)
|
||||||
{
|
{
|
||||||
return texture2DArray(omw_SamplerLastShader, vec3((uv), gl_ViewID_OVR));
|
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 a new issue