svxtc

Anyone know a good way to make dynamic terrain and quickly at that I can read a black and white image file and read the grayscale and calculate a heightmap but it doesn't seem efficient to me or easily changable (if thats a word). :)

Any help is always appreciated.

Thanks!



Re: XNA Game Studio Express Terrain?

Fluxtah

If you mean generate it then perlin noise is something to look into, there is a good page here about that http://freespace.virgin.net/hugo.elias/models/m_perlin.htm

I use a few tools to create heightmaps, I first use world machine to get an initial heightmap ( http://www.world-machine.com ) and then freeworld to tweak it and paint the surface ( http://www.freeworld3d.org/ ).

After using freeworld I take the assets and organise them into a suitable format to pull them into my engine.





Re: XNA Game Studio Express Terrain?

svxtc

So, freeworld allows you to export to a file so that you can read it in XNA or just DirectX I find it to be really cool, it actually really looks like a level editor in a way.



Re: XNA Game Studio Express Terrain?

Fluxtah

Yep, freeworld exports heightmaps ( a greyscale image like you mentioned) in a flexible way, depending on how you want to use it in your engine. It can export the raw data in a raw file as 8 bit, 16 bit and 32 bit, as a bmp or I think also a tga.

I use a 32 bit raw file as this gives me approx 4 billion height values instead of only 255 in an 8bit heightmap.

freeworld is like a level editor, I did not want to go down the route of making my own level editor in XNA as this could be very time consuming.

There is also a free piece of software that also can procedurally create heightmaps and I found it quite useful when I first started on my terrain system http://www.ridgecrest.ca.us/~jslayton/software.html

It might be worthwhile starting out with something like wilbur, until you have an efficient way to read in the heightmap and display it as terrain, an efficient culling system (quadtree or octree) and possibly a LOD system.





Re: XNA Game Studio Express Terrain?

svxtc

I wrote a method to calculate the heightmap info but it seemed to run rather slowly when I tried to calculate it. It was off of a bmp image and I also found that the map was not nearly as detailed as I wanted. I guess I will have to use a raw file to increase the detail but at the same time I am worried that the increase in detail will have a dramatic decrease in performance. Do you know of any places that I may find some efficient ways of calculating the data

Thanks.





Re: XNA Game Studio Express Terrain?

Fluxtah

I would say its not really the resolution of the height of the terrain, but the resolution of the Z and X axis asuming Y is the world up.

I use 1 unit between each vertice but the detail depends on a few factors, the units between each vertice on the Z and X axis being one of them.

The position of the viewers eye location would matter because the closer you are to the terrain the more you will be able to sense the resolution is not as good as it could be.

Add to that, the resolution of the terrain texture, can make a very large world, look like a small world when stretching a low resolution texture across the terrain,  or could be tiled, that the tiles are so small it seems like your far away or running over the terrain very fast or even worse, its quite obvious the terrain is tiled, again, looking of unnacceptable quality.

Balancing these factors can make the terrain look good, or bad, depending on how you look at it.

I stuck with 1 unit = 1 meter, assume your viewer is average 2 meters tall. This would mean a heightmap of 1024x1024 will give you 1KM square of playing area, using 32bit height values, you can easily do smooth rolling hills or rocky mountains that look of an acceptable quality, but this is just my preference and another scale would work just as well providing everything is in proportion to one another.

EDIT: forgot to mention that culling portions of the terrain that are not visible will also have a drastic impact on wether your terrain is going to perform well, at acceptable quality, or not.

If you have any more questions feel free to ask, I am on a terrain mission right now and its the only thing I have been thinking about since XNA was released! big subject once you get into it but a lot of fun :D

 

 





Re: XNA Game Studio Express Terrain?

svxtc

Well, one thing I was thinking was if it was possible to create multiple heightmaps like in a grid and have them all compute to make one large piece of terrain. I would rather make it in pieces than have to try to create one large one. I have a couple of games in mind and this one is better suited for my adventure game. Also, is there a way to load terrain while exploring it Like, the terrain that you don't see, is being loaded the closer that you get to it. Just like in Oblivion, the game is quite large and the terrain cannot be loaded all at once so parts of it are loaded when they are needed. Is this possible in XNA



Re: XNA Game Studio Express Terrain?

Fluxtah

Yes, cutting your terrain up into tiles is a good start, I cut my heightmap up into chunks of 33x33 vertices, and I keep these tiles in a quadtree. I can then cull large portions of the terrain tiles based on the view frustum, but again this is just a size I have chosen you might want your tiles to be bigger than this.

If you want the terrain chunks to load from disk (I think the term is terrain paging but not sure) as the user progresses over the terrain.. well to be honest I havent got that far yet so I couldnt offer any decent advice on it, you should be able to google for terrain paging from disk or try gamedev.net that probably has this question answered a few times (found one here http://www.gamedev.net/community/forums/topic.asp topic_id=250855, not sure how in depth it is)