Skip to main content
gamedev.net
🔒 Locked

Near Camera View Frustum Culling - Too Aggressive

Started by PhillipHamlyn 5 replies 1.8k views
Original Post
PhillipHamlyn
PhillipHamlyn

Hi,

I generally cull my landscape using the camera frustum. When the camera gets close to the ground or any other object, I find it being culled before it passes out of visibility. My guess is that the points which make up the triangle are outside the frustum, but the surface formed by them is/should be still visible to the camera.

My best idea to prevent this is to use a different culling frustum to the camera frustum, perhaps just moving the "camera position" "back" some way - is this a normal technical to counter the over-vigorous frustum culling ?

Phillip

Seabolt
Seabolt

The simplest solution would probably be to just create a spherical bounding volume and test against that. That way if any part of model is in view, it will be shown, though you'll get a lot more false positives.

Perception is when one imagination clashes with another
PhillipHamlyn
PhillipHamlyn

Seabolt,

That sounds quite drastic - it would tend to at least double the number of positives I get wouldn't it ? Or is the bounding volume not centred on the camera - is the camera on the circumference looking at the sphere centre ?

Phillip

cozzie
cozzie

From what I read it might be that either the meshes/ objects of the terrain are to big OR the near plane is too far from 0.0f

(unless I misread the question)

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me
21st Century Moose
21st Century Moose

...or the frustum culling code is at fault.

Generally, and with good frustum culling code, if all points of a triangle are outside the frustum, but (parts of) the triangle itself are inside, it should detect that the triangle intersects the frustum. This is because two points of the triangle will be on opposite sides of the same frustum plane; hence it's an intersection and your code should be telling you to draw it.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
Jason Z
Jason Z

I would guess that the terrain triangles are too big. If you are testing against the points to see if they are within the frustum, then you should ensure that either your algorithm is robust to the sparse vertices, or that you disable culling for terrain sections that are very close to the camera.

If this is a pervasive problem, perhaps you could comment on how large your test points are with respect to your near clipping plane size in world space? You could always switch to a different algorithm for very close by patches, and do an automatic subdivision until you reach a certain screen space metric size...

The simples solution would be to disable culling on the terrain node when you are close by though. If the triangles are very large, then culling one or two fewer of them probably won't make any difference anyways....

Jason Zink :: DirectX MVP   Direct3D 11 engine on CodePlex: Hieroglyph 3 Direct3D Books: 
PhillipHamlyn
PhillipHamlyn

Jason, Cozzie,

Thanks for your replies. I understand now - a different, more tolerant frustum for close in objects, and a coarser one for distant objects. I hadn't considered the problem that way. Out of interest I'm just using the standard DirectX (XNA) object.BoundingSphere.Intersects(CameraViewFrustum) which might not be very subtle.

I'll try with different frustums - thanks

Phillip

Topic Locked

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

Sign in to reply to this topic.