0
votes

Given a model-view-projection matrix, how would I determine if an object is displayed on the screen? Determining if it is within the clipping bounds is easy, but how do I use the numbers if the mvp matrix to determine if object is too far left/right/high/low given the object position and the screen width and height in pixels? (For simplicity, we can say that we only care about the object's center of mass)

1
Are you trying to implement frustum culling? - peppe
Its for a tessellation evaluation shader - I apply 0 level tessellation if the patch is outside of the viewer's view - danglingPointer

1 Answers

4
votes

simply apply the mvp matrixes to the center: centerInScreen = projMartix*viewMatrix*modelMatrix*center

then see if centerInScreen is inside the -1,-1 to 1,1 box, (which opengl maps to the viewport)