-
Notifications
You must be signed in to change notification settings - Fork 433
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
How can I tell if an object is obscured by another object in the camera view? #990
Comments
Hey @cuijiale123, one thing you can do is: Render for each object a separate segmentation mask where all other objects are hidden. Then in the end you check whether the object mask is bigger when rendering the object alone compared to rendering it with all other objects together. If that is the case, the object is occluded by another object. You can also apply the same logic using raycasts. This is probably more efficient but might be harder to implement |
stumbled upon this issue and quickly wanted to add my 50 cents: I think @cornerfarmer is right that the easiest way to determine object visibility is to render segmentation masks and compare them. If you want to do a more fine-grained visibility check, you can use raycasting. I've done this recently to check if a certain vertex is visible:
You could also use this to check if an object is visible by iterating over all vertices as below. Though I am not sure how efficient this is, depending on your mesh resolution and image resolution it might be better to cast rays from the camera instead. def is_object_occluded_for_scene_camera(obj: bpy.types.Object) -> bool:
|
Describe the issue
Hi, I need to make a coco data:
if the object is occlusioned, don't render its mask.
But I can't tell if it's obscured by other objects in the camera's view.
How can I tell if an object is obscured by another object in the camera view?
Look forward to your reply very much, thank you.
Minimal code example
No response
Files required to run the code
No response
Expected behavior
How to tell if the object is occlusioned from the camera Angle?
BlenderProc version
3.3.1
The text was updated successfully, but these errors were encountered: