Visibility check in Blender


Is there any function or Python API which can do vertices visibility checking in recent Blender? For example, I have a 3D mesh model, could I get the mesh’s vertices visibility information easily?


Moved from “General Forums > Blender and CG Discussions” to “Coding > Python Support”

No one knows it?

Do you mean when you hide/show an object or vertex by pressing ‘h’ or ‘alt-h’?

If so then “Object.hide” is a boolean that tells if the Object should be hidden. In the same way the vertices in the mesh have ‘Vertex.hide’ that tells if the individual vertex should be hidden in edit mode. Note that the setting on the vertex only updates if you lave edit mode and go back in. i.e. To see this value change in Python you have to:

  • go into edit mode
  • hide the vertex
  • Return to Object mode

Then you will see the property update.

Thanks for your reply. But what I need is that give a mesh, I would like to know if a vertex on the mesh will be rendered in current camera setting. Now I start to write a program to implement outside blender. Anyway, thanks a lot for your kind reply.

I’m not sure if Blender has a quick or easy way to process that since lot of different aspects of the render determine if a given vertex will be drawn on screen. In fact, vertices are not ever really drawn on screen per-se. Note the image below, the green triangle overlapps the red triangle. All the vertices on the ‘red’ triangle are not really drawn on the screen but it still affects the image since its location does affect the visible portions of the red triangle. The visibility of that single vertex depends on the location of the camera and all the other geometry and material settings in the scene. That point might still be visible if the green triangle has some transparency.

There are easier things that can be checked. For example, if you know that you only have 1 model in the environment and there is no overlapping geometry or transparency then it would be possible to compute the screen coordinate for each vertex and then just see if they are bounded by your screen. That would just involve some matrix multiplies but I’m not sure which ones since I’ve never tried to access the matrices in the camera that convert from “world space” to “eye” or “screen” space.


Thanks for your advice.

Actually, my case does not consider about transparency, and it is a pure geometry problem. Even in the scene there is only one model without self-intersection. I just would like to find a quick way to check vertex visibility without programming.

However, I still can not understand the way you proposed. For example, the cube in the image, the front corner vertex and the back corner vertex both will be in the convex hull if you project all the vertices on the screen, but they have different visibility properties.

I am wondering if there is a API function which can get some information like depth map. That should be great.

Thank again. :slight_smile:


I suspect that you are out of luck for an easy answer, but I might be wrong. Part of the rendering process is figuring out where the geometry is in relation to the camera and figuring out which faces are “in front”. A depth buffer is one way to determine which of the faces are “in front” relative to the current camera position. I’m not sure if blender has an option to render the depth buffer but it would not surprise me if someone has done this before.

The only other way that I can think of doing it (without doing your own projection math and keeping your own depth buffer) would be to assign a unique color to each vertex and render that to an image then see which colors show up in the render. I’m not sure if that helps you or not. The problem of what is “visible” is a big one for real-time graphics (i.e. games). Lots of efforts goes into compiling data sets that let the computer quickly cull out geometry that cannot be seen so that it can be skipped by the rendering system. But at the end of the day, the geometry that might be visible still has to get projected to screen space and pass the depth tests before it is known if it is really visible or not.

To do this with the API you would

align view
go into edit mode
Limit selection to Visible (clip with depth buffer)
select no verts
Box select all you can see

you could emulate those actions with a script.

Exactly. 'cause my case is a special case that the point which are need to check are exact the vertices on the mesh. So I am writing some code to compute as following: First I compute a line section between camera position and a vertex, then I check if this line section intersect with the mesh (Loop all the triangles, brute force, not efficient). And there is a quick way to fulfill this

GOOD IDEA! Thanks a lot :wink: