How to check if face in mesh is culled/invisible to camera?

Hi everyone,

If I have a static or skeletal mesh, is there a way to get the IDs of all the faces in that mesh that are invisible to the camera?

Obviously the Unreal Engine knows it should not draw them, but I couldn’t find a way to access that info in the reference.

Perhaps unnecessary, but I have attached two images to illustrate.

Thank you for any ideas or feedback!

251794-camera-viewpoint.jpg

Why do you want those faces?

I’d have a look at vertex manipulation relative to the camera in materials. you might have some success there without needing to access the face data. Its not C++ and it will not be accessible after its been done but it may be worth investigating.

I want to do some calculations for vertex animations at the border of the culling. But I need the face IDs. I already managed to do this in 3DSMax and would like to know how this is done in UE4.

Why do you ask? Your question implies that you think there might be another, easier way to do what I want to do. But I’m not a newbie at 3D scripting, I’m just new to UE4 C++ :slight_smile:

Thanks for mentioning that Harry, but the animation code is too complex for a material and also not generic for each vertex. That’s why I need to do it like this unfortunately…

I bet you could cycle through all the vertices or faces and get their normals, then compare that unit vector to the inverse of the viewport camera’s direction with dot product or something, and see if the result is negative or not, and base your next decision on that, of whether to include that face or vertex in the returned array.

I don’t know if the API has that, but it has procedural mesh generation so I would be surprised if it didn’t have a way to access existing mesh data.