DOF can effect transparent objects now, close #28240
This commit is contained in:
parent
82a86e8074
commit
5ff4b13271
1 changed files with 13 additions and 1 deletions
|
@ -1121,13 +1121,23 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_m
|
||||||
|
|
||||||
if (state.current_depth_draw != p_material->shader->spatial.depth_draw_mode) {
|
if (state.current_depth_draw != p_material->shader->spatial.depth_draw_mode) {
|
||||||
switch (p_material->shader->spatial.depth_draw_mode) {
|
switch (p_material->shader->spatial.depth_draw_mode) {
|
||||||
case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS:
|
case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS: {
|
||||||
|
glDepthMask(GL_TRUE);
|
||||||
|
// If some transparent objects write to depth, we need to re-copy depth texture when we need it
|
||||||
|
if (p_alpha_pass && !state.used_depth_prepass) {
|
||||||
|
state.prepared_depth_texture = false;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_OPAQUE: {
|
case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_OPAQUE: {
|
||||||
|
|
||||||
glDepthMask(!p_alpha_pass);
|
glDepthMask(!p_alpha_pass);
|
||||||
} break;
|
} break;
|
||||||
case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALWAYS: {
|
case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALWAYS: {
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
|
// If some transparent objects write to depth, we need to re-copy depth texture when we need it
|
||||||
|
if (p_alpha_pass) {
|
||||||
|
state.prepared_depth_texture = false;
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_NEVER: {
|
case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_NEVER: {
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
|
@ -4616,6 +4626,8 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (env && (env->dof_blur_far_enabled || env->dof_blur_near_enabled) && storage->frame.current_rt && storage->frame.current_rt->buffers.active)
|
||||||
|
_prepare_depth_texture();
|
||||||
_post_process(env, p_cam_projection);
|
_post_process(env, p_cam_projection);
|
||||||
// Needed only for debugging
|
// Needed only for debugging
|
||||||
/* if (shadow_atlas && storage->frame.current_rt) {
|
/* if (shadow_atlas && storage->frame.current_rt) {
|
||||||
|
|
Loading…
Reference in a new issue