0
$\begingroup$

as the question suggests I have to identify all the faces that are visible from the camera's view and do some processing with them. I have a single mesh.

I am thinking of giving individual faces a different colour and do a blind render. This will enable me to read the FBO. Then I have to traverse all the pixel and find the unique faces by their colour.

Are there any faster way?

$\endgroup$
7
  • $\begingroup$ for simple convex objects the normal vector can be used to determine visibility, just dot it with the forward vector from the view matrix $\endgroup$
    – pmw1234
    Commented May 29, 2021 at 20:43
  • $\begingroup$ actually the above trick will give you every triangle facing the camera but triangles that are completely occluded by other triangles will also be in the list. $\endgroup$
    – pmw1234
    Commented May 31, 2021 at 10:51
  • $\begingroup$ I am dealing with non convex objects $\endgroup$ Commented May 31, 2021 at 16:07
  • $\begingroup$ This works with any object convex or not, what it won't do is give you occlusion information, so if 1 triangle completely occludes another, both will still be in the list. I should not have put convex in there. It would even work with scenes. $\endgroup$
    – pmw1234
    Commented May 31, 2021 at 16:12
  • $\begingroup$ Oh right! I need to exclude the triangles that are occluded by other triangles. $\endgroup$ Commented May 31, 2021 at 16:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.