Blender (Python): Checking if vertex is visible from camera in script (with occlusion)
Asked Answered
R

0

2

How can I check if a vertex in a model can be seen by a camera or if it's hidden behind another object?

I aim to use that information to find the coordinates and size of a bounding box that would be drawn around an object viewed from a camera, then save that bounding box's info in a text file (which is already done and working).

I do not need nor want the vertexes to be selected, I simply want their position and if they can be seen by the camera. That way, I can check for the highest and lowest vertexes as well as the most left and most right vertexes and use these coordinates to create my bounding box.

Thanks!

Reck answered 16/8, 2018 at 22:30 Comment(2)
There is a Scene.ray_cast function, you can send a ray at each vertex and check if it collides with your object. Unclear what you're tryong to do though, it may be that all vertices are out of camera view but polygons are visible - e.g. when you're extremely close to polygon and facing it directly.Kegan
I'll see what I can do with this. That kind of situation most likely won't happen, but it's good to know.Reck

© 2022 - 2024 — McMap. All rights reserved.