DRTVWR-559 Fix SSR on transparent PBR surfaces.
parent
8f83724f7e
commit
0336c1a06d
|
|
@ -49,10 +49,9 @@ uniform mat3 texture_normal_matrix;
|
|||
uniform mat3 texture_metallic_roughness_matrix;
|
||||
uniform mat3 texture_emissive_matrix;
|
||||
|
||||
#ifdef HAS_SUN_SHADOW
|
||||
out vec3 vary_fragcoord;
|
||||
|
||||
uniform float near_clip;
|
||||
#endif
|
||||
|
||||
in vec3 position;
|
||||
in vec4 diffuse_color;
|
||||
|
|
@ -86,9 +85,7 @@ void main()
|
|||
#endif
|
||||
gl_Position = vert;
|
||||
|
||||
#ifdef HAS_SUN_SHADOW
|
||||
vary_fragcoord.xyz = vert.xyz + vec3(0,0,near_clip);
|
||||
#endif
|
||||
|
||||
basecolor_texcoord = (texture_matrix0 * vec4(texture_basecolor_matrix * vec3(texcoord0,1), 1)).xy;
|
||||
normal_texcoord = (texture_matrix0 * vec4(texture_normal_matrix * vec3(texcoord0,1), 1)).xy;
|
||||
|
|
|
|||
|
|
@ -46,8 +46,9 @@ uniform vec3 moon_dir;
|
|||
|
||||
out vec4 frag_color;
|
||||
|
||||
in vec3 vary_fragcoord;
|
||||
|
||||
#ifdef HAS_SUN_SHADOW
|
||||
in vec3 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
#endif
|
||||
|
||||
|
|
@ -191,8 +192,9 @@ void main()
|
|||
vec3 atten;
|
||||
calcAtmosphericVarsLinear(pos.xyz, norm, light_dir, sunlit, amblit, additive, atten);
|
||||
|
||||
#ifdef HAS_SUN_SHADOW
|
||||
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
|
||||
|
||||
#ifdef HAS_SUN_SHADOW
|
||||
scol = sampleDirectionalShadow(pos.xyz, norm.xyz, frag);
|
||||
#endif
|
||||
|
||||
|
|
@ -211,7 +213,7 @@ void main()
|
|||
float gloss = 1.0 - perceptualRoughness;
|
||||
vec3 irradiance = vec3(0);
|
||||
vec3 radiance = vec3(0);
|
||||
sampleReflectionProbes(irradiance, radiance, vec2(0), pos.xyz, norm.xyz, gloss);
|
||||
sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss);
|
||||
// Take maximium of legacy ambient vs irradiance sample as irradiance
|
||||
// NOTE: ao is applied in pbrIbl (see pbrBaseLight), do not apply here
|
||||
irradiance = max(amblit,irradiance);
|
||||
|
|
|
|||
|
|
@ -7821,18 +7821,6 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
|
|||
stop_glerror();
|
||||
}
|
||||
|
||||
channel = shader.enableTexture(LLShaderMgr::SCENE_MAP);
|
||||
if (channel > -1)
|
||||
{
|
||||
gGL.getTexUnit(channel)->bind(&mSceneMap);
|
||||
}
|
||||
|
||||
channel = shader.enableTexture(LLShaderMgr::SCENE_DEPTH);
|
||||
if (channel > -1)
|
||||
{
|
||||
gGL.getTexUnit(channel)->bind(&mSceneMap, true);
|
||||
}
|
||||
|
||||
if (shader.getUniformLocation(LLShaderMgr::VIEWPORT) != -1)
|
||||
{
|
||||
shader.uniform4f(LLShaderMgr::VIEWPORT, (F32) gGLViewport[0],
|
||||
|
|
@ -8765,6 +8753,21 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)
|
|||
|
||||
setEnvMat(shader);
|
||||
}
|
||||
|
||||
// reflection probe shaders generally sample the scene map as well for SSR
|
||||
channel = shader.enableTexture(LLShaderMgr::SCENE_MAP);
|
||||
if (channel > -1)
|
||||
{
|
||||
gGL.getTexUnit(channel)->bind(&mSceneMap);
|
||||
}
|
||||
|
||||
channel = shader.enableTexture(LLShaderMgr::SCENE_DEPTH);
|
||||
if (channel > -1)
|
||||
{
|
||||
gGL.getTexUnit(channel)->bind(&mSceneMap, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void LLPipeline::unbindReflectionProbes(LLGLSLShader& shader)
|
||||
|
|
|
|||
Loading…
Reference in New Issue