Terrain creation and visualisation

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
nikolaiko
Posts: 43
Joined: Mon Aug 04, 2014 8:26 am

Terrain creation and visualisation

Post by nikolaiko »

Hi, I have a question about terrain, creation and visualization.

1.Did somebody know a not bad (there is no need for some really great tool) free, or at least with full functional trial, program for terrain creating and exporting height map from it, for future use in BEPU Engine?

2.Second one is about drawing terrain. In my application I use BEPU on server for physics calculation and simulation. All drawing - on the client. I created a function for exporting terrain from client editor (Unity) to BEPU. Using simple xml file. I already posted it here and can find if it will be needed.

But now I am downloaded from internet some terrain for unity, exported and put it in BEPU. It is working very well, except one thing - very often character start walking almost on one place, very slowly moving forward, looks like he is not going on open space, but moving throught something. I want to draw exported terrain and see how it looks "for server". I tried to use XNA, but it says - to many vertexes for one object, or something like this. So, is there any other options to draw objects from BEPU Engine?

Thanks.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Terrain creation and visualisation

Post by Norbo »

1.Did somebody know a not bad (there is no need for some really great tool) free, or at least with full functional trial, program for terrain creating and exporting height map from it, for future use in BEPU Engine?
This may not meet the 'not bad' threshold, but since it is just a height map, creating grayscale images in something like paint.net can work.
I tried to use XNA, but it says - to many vertexes for one object, or something like this. So, is there any other options to draw objects from BEPU Engine?
The debug drawer targets the Reach profile, which can only use 16 bit indices. To draw larger things using the demos debug drawer, you would need to set the profile to HiDef and then change the relevant batch index types to ints rather than shorts.

It would be easier to try a smaller model renderable by both systems to narrow down the source of inconsistencies. There might just be a scaling issue.
nikolaiko
Posts: 43
Joined: Mon Aug 04, 2014 8:26 am

Re: Terrain creation and visualisation

Post by nikolaiko »

1. Thanks, I will try this site.

2. I already turned it ti HiDef, but this still not enought, I have an error :

Code: Select all

XNA Framework HiDef profile supports a maximum VertexBuffer size of 67108863.
I think I will try to split my terrain to several peaces. I mean, in client it will be one object, but I will modify exporting function, to export it as 2 or 3 different terrains.

Thanks.
nikolaiko
Posts: 43
Joined: Mon Aug 04, 2014 8:26 am

Re: Terrain creation and visualisation

Post by nikolaiko »

Ok I found a problem it is laying in exporting from client. I tried to create terrain (small) 50x50 with heightmap resolution 513.
Image
But after importing exported data to server and drawing it using XNA framework I got :
Image
So, looks like it copying not all of the data during export, or something else. Working on solving this.

And I have one question, is there any way to create a terrain in BEPUPhysics using heightmap in *.raw format?

Thanks.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Terrain creation and visualisation

Post by Norbo »

So, looks like it copying not all of the data during export, or something else. Working on solving this.
That looks a lot like the debug drawer has not been fully updated to support 32 bit indices.

You may want to debug it using a mesh which is 256x256 vertices or less to avoid those problems.

And I have one question, is there any way to create a terrain in BEPUPhysics using heightmap in *.raw format?
BEPUphysics itself isn't aware of any import logic. It just takes height data in its array format. Any method which converts the .raw to the array format will work.
nikolaiko
Posts: 43
Joined: Mon Aug 04, 2014 8:26 am

Re: Terrain creation and visualisation

Post by nikolaiko »

Norbo wrote:That looks a lot like the debug drawer has not been fully updated to support 32 bit indices.
Is there any way to fix/change it?
nikolaiko
Posts: 43
Joined: Mon Aug 04, 2014 8:26 am

Re: Terrain creation and visualisation

Post by nikolaiko »

I am desperate....I didn't thought that it is so hard. I just need to debug my server. All that I need - draw terrain. How does it works in the other games, they draw so big levels, terrains and didn't have problems. I want just to look at my terrain and get error about VertexBuffer size of 67108863...

So, did I have ANY option to draw terrain from my server to look on it and debug?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Terrain creation and visualisation

Post by Norbo »

Is there any way to fix/change it?
Yes, it's possible to make the necessary code changes to the demos, but there's nothing built in to help out with the process. The debug drawer isn't really designed to do big terrain visualization. It's just a simulation debug utility designed to run on pretty low-end hardware.
How does it works in the other games, they draw so big levels, terrains and didn't have problems. I want just to look at my terrain and get error about VertexBuffer size of 67108863...
Games with very large worlds jump through some hoops to render the terrain. At very large sizes (above 2048x2048, for example), it isn't possible to rasterize the whole terrain at full resolution while maintaining good performance. In addition, many graphics cards are simply unable to handle that many primitives in a single draw call and will throw an error.

You might find that just splitting the terrain into a multiple chunks and rendering each one separately works acceptably- this would bypass the vertex buffer size error, since each chunk vertex buffer would be smaller than the limit.

If that ends up being too slow, you may need to apply some kind of level of detail technique. This drastically lowers the number of triangles that are far from the camera. It can reduce the required primitives from hundreds of millions per frame to only hundreds of thousands. Geoclipmapping is one example of such a technique, but there are many possibilities depending on the game's requirements.
So, did I have ANY option to draw terrain from my server to look on it and debug?
The debug drawer can't handle enormous terrains by default, but you can get most of the debugging value while working at a smaller size. If a 256x256 terrain works correctly, there's no reason why a 1024x1024 or 4096x4096 terrain wouldn't so long as they are handled in a consistent way.
nikolaiko
Posts: 43
Joined: Mon Aug 04, 2014 8:26 am

Re: Terrain creation and visualisation

Post by nikolaiko »

Ok, finaly I was able to solve it.

Just found the way to low down Hightmap resolution (but it doesn't affect terrain to much). After that I was able to render all terrain in DebugDrawer. Then I fixed all problems.

Thanks.
Post Reply