merge apply shaders
This commit is contained in:
@@ -4,22 +4,20 @@ in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uDhColorTexture;
|
||||
uniform sampler2D uDhDepthTexture;
|
||||
uniform sampler2D uSourceColorTexture;
|
||||
uniform sampler2D uSourceDepthTexture;
|
||||
|
||||
// DH apply frag
|
||||
void main()
|
||||
{
|
||||
//fragColor = texture(uApplyTexture, TexCoord);
|
||||
|
||||
fragColor = vec4(0.0);
|
||||
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// only update fragments that were drawn to
|
||||
float fragmentDepth = texture(uDhDepthTexture, TexCoord).r;
|
||||
float fragmentDepth = texture(uSourceDepthTexture, TexCoord).r;
|
||||
if (fragmentDepth != 1)
|
||||
{
|
||||
fragColor = texture(uDhColorTexture, TexCoord);
|
||||
fragColor = texture(uSourceColorTexture, TexCoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -4,7 +4,10 @@ in vec2 vPosition;
|
||||
|
||||
out vec2 TexCoord;
|
||||
|
||||
// DH apply
|
||||
/**
|
||||
* This is specifically used by application shaders.
|
||||
* IE post process or pixel transfer shaders, anything that is rendered using a single rectangle.
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||
|
||||
@@ -4,8 +4,8 @@ in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uSsaoColorTexture;
|
||||
uniform sampler2D uDhDepthTexture;
|
||||
uniform sampler2D uSourceColorTexture;
|
||||
uniform sampler2D uSourceDepthTexture;
|
||||
|
||||
uniform vec2 gViewSize;
|
||||
uniform int gBlurRadius;
|
||||
@@ -38,8 +38,8 @@ float BilateralGaussianBlur(const in vec2 texcoord, const in float linearDepth,
|
||||
float fx = Gaussian(g_sigmaX, ix);
|
||||
|
||||
vec2 sampleTex = texcoord + ivec2(ix, iy) * pixelSize;
|
||||
float sampleValue = textureLod(uSsaoColorTexture, sampleTex, 0).r;
|
||||
float sampleDepth = textureLod(uDhDepthTexture, sampleTex, 0).r;
|
||||
float sampleValue = textureLod(uSourceColorTexture, sampleTex, 0).r;
|
||||
float sampleDepth = textureLod(uSourceDepthTexture, sampleTex, 0).r;
|
||||
float sampleLinearDepth = linearizeDepth(sampleDepth);
|
||||
|
||||
float depthDiff = abs(sampleLinearDepth - linearDepth);
|
||||
@@ -60,7 +60,7 @@ void main()
|
||||
{
|
||||
fragColor = vec4(1.0);
|
||||
|
||||
float fragmentDepth = textureLod(uDhDepthTexture, TexCoord, 0).r;
|
||||
float fragmentDepth = textureLod(uSourceDepthTexture, TexCoord, 0).r;
|
||||
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// we only want to apply SSAO to LODs, not to the sky outside the LODs
|
||||
@@ -73,7 +73,7 @@ void main()
|
||||
}
|
||||
else
|
||||
{
|
||||
fragColor.a = texelFetch(uSsaoColorTexture, ivec2(gl_FragCoord.xy), 0).r;
|
||||
fragColor.a = texelFetch(uSourceColorTexture, ivec2(gl_FragCoord.xy), 0).r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user