Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | project_Blue_Bird |
Can someone with technical knowledge about the engine please explain to me why HDR bloom isn’t possible GLSL 2.0 ? (I’m making the assumption my tablet is running GLSL 2.0)
I decided to custom write my own shader code to do this as the environment node was tanking performance on mobile in 2d mode. Otherwise 60fps or greater.
Code im using is fairly bog standard and unfinished.
//******************************************************************************************************************************************
shader_type canvas_item;
vec4 sample_glow_pixel(sampler2D tex, vec2 uv, float lod){
float hdr_threshold = 1.0;
return max(textureLod(tex, uv, lod) - hdr_threshold, vec4(0.0));
}
void fragment(){
vec4 screen_Texture_Sample = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0);
vec4 sample_Glowing_Pixel = sample_glow_pixel(SCREEN_TEXTURE, SCREEN_UV, 3.0); //mipmapped screen sample used for blur and HDR value checking.
vec4 final_Colour = vec4(screen_Texture_Sample.rgb + sample_Glowing_Pixel.rgb, screen_Texture_Sample.a); //combine both screen samples here before output.
COLOR = final_Colour;
}
//**********************************************************************************************************************************************
Now this code does work on my pc but not on tablet. I have tried adding it to both a sprite and a texturerect but to no avail.
I have broken down the code and have tested chunks of it on tablet.
The shader does have access to SCREEN_TEXTURE and SCREEN_UV (otherwise it would be a big white rectangle displayed if it didnt as the default texture is a a white rectangle)
and shader can both Mipmap on both pc and tablet.
Max function Does work on tablet and pc.
However for some reason Godot does not wont to combine both the screen sample and the hdr mipmapped sample together and instead I just get the sprite/texturerect grabbing
the underlying Screen pixel with no glow surrounding areas above LDR values.
Can someone with technical knowledge in godot explain this to me?
would it be possible to have 2d glow GLES 2.0 in godot via viewports and combining render textures?
Many Thanks.