0 votes

I need some help as im just starting to confuse myself at this point.

I have this shader assigned to a texturerect where im mixing between the root viewport and another viewport with a skyscene in it.

it renders fine except additive shaders dont work right. but mainly, im trying to get the bloom effect in this shader to work and it jsut wont work. I lower the threshold very low and it will start to bloom but i have emissive objects that are very bright not blooming on this...

shader_type canvas_item;
uniform sampler2D viewport_texture : hint_black;
uniform float bloomThreshold : hint_range(0.0, 1.0) = 1.0;
uniform float bloomIntensity = 1.0;
uniform float bloomRadius : hint_range(2.0, 5.0) = 3.0;

vec3 Contrast (vec3 value, float contrast)
{
    return vec3((value - vec3(0.5)) * contrast) + vec3(0.5);
}

vec3 sample_glow_pixel(sampler2D tex, vec2 uv, float thresh, float radius, float intens)
{
    return max(textureLod(tex, uv, radius).rgb - thresh, vec3(0.0)) * intens;
}

void fragment()
{
    vec4 screen_fragment = texture(SCREEN_TEXTURE, SCREEN_UV);
    vec4 sky = texture(viewport_texture, SCREEN_UV);

    vec3 final_color = mix(sky.rgb, screen_fragment.rgb, screen_fragment.a);

    COLOR.rgb = final_color;
    COLOR.rgb = sample_glow_pixel(SCREEN_TEXTURE, SCREEN_UV, bloomThreshold, 
bloomRadius, bloomIntensity);
}
in Engine by (18 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.