Skip to content
Snippets Groups Projects
Commit 2e648754 authored by Julian Schakib's avatar Julian Schakib
Browse files

glow shaders included properly, shadows on no background in screenshot too

parent ee478f92
No related branches found
No related tags found
No related merge requests found
......@@ -265,6 +265,8 @@ void RenderingPipeline::render(const std::function<void(RenderPass const& pass)>
// copy shader (with downsampling and dithering)
auto shader = mShaderOutput->use();
shader.setTexture("uTexture", toColorTmp ? mTargetColor : mTargetColorTmp);
shader.setTexture("uTextureDepth", mTargetDepth);
shader.setTexture("uTexRevealage", mTargetTranspReveal);
shader.setUniform("uOutputSize", glm::vec2(getOutputWidth(), getOutputHeight()));
shader.setUniform("uDitheringStrength", mDitheringStrength);
......
#include "utils.glsl"
uniform sampler2DRect uTexture;
uniform sampler2DRect uTextureDepth;
uniform sampler2DRect uTexRevealage;
uniform vec2 uOutputSize;
uniform float uDitheringStrength;
in vec2 aPosition;
out vec3 fColor;
out vec4 fColor;
void main()
{
// this is tested to properly down-scale 2-to-1
vec3 color = texture(uTexture, gl_FragCoord.xy * textureSize(uTexture) / uOutputSize).rgb;
vec4 color = texture(uTexture, gl_FragCoord.xy * textureSize(uTexture) / uOutputSize).rgba;
uint seed = uint(gl_FragCoord.x) + uint(gl_FragCoord.y) * 8096;
float r = wang_float(wang_hash(seed * 3 + 0));
......@@ -20,5 +22,11 @@ void main()
float b = wang_float(wang_hash(seed * 3 + 2));
vec3 random = vec3(r, g, b);
fColor = color + (random - .5) * uDitheringStrength;
fColor.rgb = color.rgb + (random - .5) * uDitheringStrength;
float alpha = texelFetch(uTexRevealage, ivec2(gl_FragCoord.xy)).r;
fColor.a = float(texture(uTextureDepth, gl_FragCoord.xy).r != 1);
if(alpha != 1)
fColor.a = alpha;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment