I have a third person camera that contains two matrices: view and projection, and two Vector3's: camPosition and camTarget. I've read up on frustum culling and it makes it seem easy enough for a first person camera, but how would I implement this for a third person camera? I need to take into effect the objects I can see behind me too. How would I implement this into my camera class so it runs at the same time as my update method?
public void CameraUpdate(Matrix objectToFollow)
{
camPosition = objectToFollow.Translation + (objectToFollow.Backward *backward) + (objectToFollow.Up * up);
camTarget = objectToFollow.Translation;
view = Matrix.CreateLookAt(camPosition, camTarget, Vector3.Up);
}
Can I just create another method within the class which creates a bounding sphere with a value from my camera and then uses the culling based on that? And if so, which value am I using to create the bounding sphere from?
After this is implemented, I'm planning on using occlusion culling for the faces of my objects adjacent to other objects. Will using just one or the other make a difference? Or will both of them be better? I'm trying to keep my framerate as high as possible
BoundingBox
- have one for each cube - and do the intersection check right before you draw the cube. (Again - not the right approach - but that's how you'd do it.) – Andrew Russell Jun 27 '13 at 05:47VertexBuffer
,IndexBuffer
). (4) Then, at draw time, simply draw the whole chunk from those buffers with a single draw call. (Optionally: check if the chunk intersects the view frustum, and skip drawing it if it does not). – Andrew Russell Jun 27 '13 at 06:10VertexBuffer
.List
and thenToArray()
would work. But using an array directly would be better - although you must manage its size yourself. – Andrew Russell Jun 27 '13 at 06:52