Merge pull request #61382 from clayjohn/alpha-bug

This commit is contained in:
Rémi Verschelde 2022-05-24 23:50:07 +02:00 committed by GitHub
commit 2344bf6431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 0 deletions

View File

@ -3192,6 +3192,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();
if (env) {
if (max_glow_level >= 0) {
@ -3230,6 +3231,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_BCS, 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) {

View File

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

View File

@ -4001,6 +4001,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
}
}
state.tonemap_shader.set_conditional(TonemapShaderGLES3::DISABLE_ALPHA, !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]);
state.tonemap_shader.set_conditional(TonemapShaderGLES3::V_FLIP, storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]);
state.tonemap_shader.bind();
@ -4064,6 +4065,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_BCS, false);
state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_COLOR_CORRECTION, false);
state.tonemap_shader.set_conditional(TonemapShaderGLES3::V_FLIP, false);
state.tonemap_shader.set_conditional(TonemapShaderGLES3::DISABLE_ALPHA, false);
}
bool RasterizerSceneGLES3::_element_needs_directional_add(RenderList::Element *e) {

View File

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