Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

Testing Visibility

Started by EnochDagor Jan 30, 2006 at 1:51 PM 1 replies 850+ views
Original Post
EnochDagor
EnochDagor
This is in DirectX 9 using 3D. Using the View Transform Matrix, how do I know what entities are visible in the current frame? I want to be able to simply say: If NeedToRender(oObj) Then Render(oObj) What's the math, function calls, etc... inside NeedToRender? Also, my game is oriented to a 2D plane (Y locations vary very little). What kind of shortcuts could I take? Thanks.
Enoch DagorLead DeveloperDark Sky EntertainmentBeyond Protocol
abso
abso
Sounds like you want info on view-frustum culling. Lots of info is out there on the web that will help you. Flipcode has a good explanation of it here: http://www.flipcode.com/articles/article_frustumculling.shtml

[Edited by - abso on January 30, 2006 5:26:29 PM]
matches81
matches81
You can extract the planes that define the view-frustum (capped pyramide resembling the area seen by the camera) from the view-projection matrix (view and projection matrix combined). Extracting the planes from this matrix would give the frustum in world space.
Using that planes you can test which entity is inside the frustum and thus needs to be rendered. This process is commonly referred to as view-frustum culling, which abso mentioned.
You should also use bounding volumes for that purpose, as they really simplify that process.

For a "close to 2-D" scene you should look into quadtrees I suppose, too. Should speed visibility testing up quite much.

quite good PDF explaining the plane extraction from a matrix and plane equations:

http://www2.ravensoft.com/users/ggribb/plane%20extraction.pdf

hope that helps.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.