Jump to content

Case of the vanishing meshes: culling?


Rastar
 Share

Recommended Posts

I am laying out a large array of mesh patches that will be heightmap displaced in the shader. It's working fine, except that when the camera moves a certain distance from the origin (about 1500 units or so) all meshes suddenly vanish. Moving a little back they appear again. This is independent of the camera's clipping planes.

 

Bug or feature? If feature: Is there a way around this?

 

post-6662-0-75177700-1379752649_thumb.png

There...

 

post-6662-0-24739800-1379752694_thumb.png

...and gone. The meshes in the back are gone as well.

Link to comment
Share on other sites

I call

 

patch->UpdateAABB(Entity::LocalAABB|Entity::GlobalAABB);

 

after creating and/or scaling a patch. But a question: I am displacing many of those patches a fair amaount after creating them. Do I have to call UpdateAABB(Entity::GlobalAABB) after moving them?

Link to comment
Share on other sites

As Shadmar says, culling is done using AABB. Workarounds might include manually adjusting the AABB values (then calling the aabb update) or adding a couple of vertices to the mesh to make it bigger.

 

Could be a bug though, had many frustrating times with objects being culled. Are these patches parented at all?

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

It's hard to say without seeing your code.

 

If the local AABB is correct then the engine will automatically adjust the global and recursive AABBs whenever things move. There is also a cull distance command that will make them disappear a certain distance away.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Well, here is my code (don't be too harsh, I'm in the process of relearning C++ ... ;-)

 

I am trying an implementation of the geometric clipmap method as described here http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter02.html. It uses a series of concentric mesh rings with decreasing LOD, each ring assembled from several patches.

 

As described, run forward using "W" to about 1500 units and all patches vanish.

 

Thanks!

Link to comment
Share on other sites

Try adding this to the end of the RectangleTesselator::Computer function:

surface->UpdateAABB();

 

I am curious why you are duplicating the built-in terrain. That paper is describing almost the same exact technique I implemented. (Their geometry approach is a little different, but it looks like the texturing technique is identical.) Not that I mind.

 

Their geometry approach is nice in that it would only require a few passes, although it would be more restrictive with LOD distances and max view range. Something to think about at some later point...

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Whoaa, I wasn't aware of that. I noticed your texturing approach looked similar to their structure for the heightmap base mesh. I am heading for a very large terrain, and their approach seemed very interesting to me, especially with the method for compressing the height data. If I can use that with the built-in terrain I would be more than happy!

 

I've tried the various UpdateAABB() calls, but that doesn't seem to help.

Link to comment
Share on other sites

I understand, but adding that call to the RectangleTesselator doesn't change the behavior, at least on my end.

 

Just wanted To say: I really appreciate your support, I know you have a load of stuff on your plate and more urgent business to do than fixing other people's code... unsure.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...