How to code cameras and draw distances
Posted 06 March 2012 - 06:10 AM
How is the actual camera, and what it views, and et cetera, programmed? Obviously, that's tied to draw distance, but much more so, I'm very curious/puzzled as to the math/programming involved in cameras, which obviously have to "draw more of" the environment with the receding distance. Is there a certain ratio or math to get the cam to look right? I'm trying to code a camera system from scratch, and I'd like to know how to go about it. I hope this Q is coming across in a more or less understandable manner...
Posted 06 March 2012 - 07:12 AM
Posted 07 March 2012 - 05:14 AM
What's the general logic and process that governs the detection of meshes and...everything in the environment, really, within the viewing frustum?
Posted 07 March 2012 - 05:54 AM
For more efficient frustum culling of large numbers of objects, a hierarchy of bounding volumes is used, such as an AABB tree, sphere tree, octree or BSP tree.
Note that if you're just trying to get the camera working, you should avoid frustum culling and simply draw all objects each frame, then put the frustum culling in later once you've got other things working (since it is a bit of a fiddly process with the potential for lots of odd bugs).
Posted 07 March 2012 - 06:18 AM
Frustum culling is just an optimization to avoid sending stuff to the hardware if it will all be clipped away anyway. Some primitive shape like a sphere or a box is assigned to each object. If the shape is completely outside the frustum, the object is not drawn.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users