Jump to content
  • Advertisement
Sign in to follow this  
Richard3d

Terrain Collision for Geo-mipmapping based algorithms

This topic is 2569 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

I am wondering if anyone here can discuss some techniques for implementing collision detection / terrain querying for terrain engines that rely on geo-mipmapping techniques (such as geo clipmapping etc). Since all geometry is offset and actually height calculated on the GPU I am wondering how entities can perform height queries and also normal queries on the terrain. Reading geometry back is not an option as the transform happens on the GPU and the vertex buffer is unaltered (need this to work for D9 which it seems this has been done). The only other option I see is querying the heightmap itself but it seems lots of texture readbacks would be very expensive. Can any one shed some light here? Thanks - R

Share this post


Link to post
Share on other sites
Advertisement

Hello,

I am wondering if anyone here can discuss some techniques for implementing collision detection / terrain querying for terrain engines that rely on geo-mipmapping techniques (such as geo clipmapping etc). Since all geometry is offset and actually height calculated on the GPU I am wondering how entities can perform height queries and also normal queries on the terrain. Reading geometry back is not an option as the transform happens on the GPU and the vertex buffer is unaltered (need this to work for D9 which it seems this has been done). The only other option I see is querying the heightmap itself but it seems lots of texture readbacks would be very expensive. Can any one shed some light here? Thanks - R


You should be able to use the same math that generates the height on the GPU with the CPU, depending on your solution. Querying the heightmap seems the first and easiest way.

I would have said test geometry but I'm not sure what transforms you're doing on the geometry in the GPU, once again you should just be able to use the same math as the GPU uses, and as long as you're not doing lots of height tests it shouldn't be too expensive. Trying to read a texture from video memory is expensive, so you might end up with a memory duplicate of the height map though, one in ram and one in video memory.

For stuff that you'll have a lot of height tests for, maybe a fluid simulation or something, you might want to pre-compute the boundary of that fluid, and then use that boundary to pre-compute the height values that the fluid will need in real time.

Share this post


Link to post
Share on other sites
The only other option I see is querying the heightmap itself but it seems lots of texture readbacks would be very expensive
Don't read the GPU's copy of the texture -- keep a separate copy of that pixel data for yourself (preferably not even in a D3D type object - just an array of bytes would do).

Share this post


Link to post
Share on other sites
I am wondering if anyone here can discuss some techniques for implementing collision detection / terrain querying for terrain engines that rely on geo-mipmapping techniques (such as geo clipmapping etc). Since all geometry is offset and actually height calculated on the GPU...
I think I'm missing something
Geomipmaps.
Clipmapping.
The connection between the two is loose at best. Neither algorithms compute height on GPU.
For geomipmaps, computing collision on the finest mesh only appears reasonable.
I cannot say much for clipmaps.

Share this post


Link to post
Share on other sites
Hi,

Base line every time should be to keep graphic related stuff (textures, geometry etc) separated from other things such as physics.
Terrain collision is a question related to physics. Anything with the word "collision" is more or less physics related question.

Practically you should have a separated physical model for handling collisions. The physical model may be less accurate than the graphics presentation, which may be good in some cases. Depending on the size of the terrain you may or may not keep the whole physical model in memory all the time.

Best regards!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!