-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the occlusion culling debug draw mode draw a translucent overlay #79733
base: master
Are you sure you want to change the base?
Make the occlusion culling debug draw mode draw a translucent overlay #79733
Conversation
34195cf
to
63a59c9
Compare
I think this is a useful change, especially since the jittered buffer makes it very difficult to see the shapes of the objects. Needs a rebase though |
Rebased and tested again, it works as expected. The "vignette" effect is also gone (it was already fixed in |
63a59c9
to
2823936
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I tested it on several scenes with many meshes and it works correctly. Additionally it makes it easier to notice how the occluders interact with the scene
@@ -203,6 +203,14 @@ void main() { | |||
color.rgb = normalize(color.rgb * 2.0 - 1.0) * 0.5 + 0.5; | |||
} | |||
|
|||
#ifdef MODE_OCCLUSION_CULLING_BUFFER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just be a flag otherwise we are increasing load times for no reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a second commit to attempt this, but it doesn't seem to work on my end (it just renders as it did before).
ff35f6e
to
34f10ed
Compare
@@ -568,6 +586,10 @@ void CopyEffects::copy_to_fb_rect(RID p_source_rd_texture, RID p_dest_framebuffe | |||
copy_to_fb.push_constant.flags |= COPY_TO_FB_FLAG_NORMAL; | |||
} | |||
|
|||
if (p_occlusion_culling_buffer) { | |||
copy.push_constant.flags |= COPY_TO_FB_FLAG_OCCLUSION_CULLING_BUFFER; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be
copy.push_constant.flags |= COPY_TO_FB_FLAG_OCCLUSION_CULLING_BUFFER; | |
copy_to_fb.push_constant.flags |= COPY_TO_FB_FLAG_OCCLUSION_CULLING_BUFFER; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 🙂 I've tried this but now I just see a fully opaque red viewport when the debug draw mode is enabled. So there's still an issue somewhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct pipeline is never applied since it relies on the "COPY_TO_FB_OCCLUSION_CULLING_BUFFER" mode that doesn't get used now
This allows for easy, depth-aware navigation in the 3D editor while being able to view which meshes are occluders and which meshes aren't. Co-authored-by: myaaaaaaaaa <[email protected]>
34f10ed
to
06efb5b
Compare
This allows for easy, depth-aware navigation in the 3D editor while being able to view which meshes are occluders and which meshes aren't.
I've tested this change with both Forward+ and Mobile rendering methods. No Vulkan validation errors are reported when running with
--gpu-validation
on either rendering method. (The Compatibility rendering method currently doesn't support most debug draw modes, including the occlusion culling buffer. Occlusion culling itself does work though.)Thanks @myaaaaaaaaa for the help 🙂
Testing project: test_occlusion_culling_buffer.zip
Preview
The two cubes in the front have occluders, while the cube in the back doesn't.