That’s normally handled at the shader level, not the application level. For example, you can use the SV_IsFrontFace Semantic in HLSL to find out if a triangle is front facing or not - but that data isn’t saved off each frame or send back to the CPU.
Hi Matt, thank you for this information. I managed to script it inside 3D Studio Max, but I didn’t know it would be so hard to in UE4.
Indeed I would need the data since I want to do complex vertex animation which is different for each vertex.
As I’m new to UE4, am I correct in stating that I would have to study writing a new shading model with my own custom geometry shaders embedded in the shader section of the engine?
You could get the normal of each polygon and do a dot product with the camera direction vector. Any face that is less than 90 degrees from the camera direction is facing away from the camera.
EDIT: This won’t find polygons that are facing the camera but hidden by other surfaces between the polygon and the camera.
Hi GBX, that is exactly what I did in 3DSMax, I also added a raycasting part to find front facing faces that were occluded by other faces.
I was just hoping that info on faces (like being culled/visible or not) would be available inside UE4 giving way to a much faster and realtime version.
But I’m really disappointed now that things like access to faces, vertices et cetera is way more difficult than in 3DSMax. ;-(