Ported: Disable alpha in post process when using opaque framebuffer - clayjohn

9927515254
This commit is contained in:
Relintai 2022-07-28 11:11:23 +02:00
parent 942c23af34
commit 42b0cd29ab
2 changed files with 6 additions and 0 deletions

View File

@ -3106,6 +3106,7 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
} }
} }
state.tonemap_shader.set_conditional(TonemapShaderGLES2::DISABLE_ALPHA, !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]);
state.tonemap_shader.bind(); state.tonemap_shader.bind();
if (env) { if (env) {
if (max_glow_level >= 0) { if (max_glow_level >= 0) {
@ -3144,6 +3145,7 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_MULTI_TEXTURE_GLOW, false); state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_MULTI_TEXTURE_GLOW, false);
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_BCS, false); state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_BCS, false);
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_COLOR_CORRECTION, false); state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_COLOR_CORRECTION, false);
state.tonemap_shader.set_conditional(TonemapShaderGLES2::DISABLE_ALPHA, false);
} }
void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, const int p_eye, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID p_environment, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass) { void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, const int p_eye, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID p_environment, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {

View File

@ -358,4 +358,8 @@ void main() {
#endif #endif
gl_FragColor = color; gl_FragColor = color;
#ifdef DISABLE_ALPHA
gl_FragColor.a = 1.0;
#endif
} }