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);
}