Page 1 of 1

how to calculate textures for a terrain?

PostPosted: 06 Dec 2009, 20:31
by titi
I'm currently reimplementing the game glest in java using the jmonkey engine.
I got a bit strucked now, because I complely don't know how the textures for the terrain are precalculated.

What i have in glest is a group of compatible and tiling textures for every sort of ground.
These groups are used randomly. With this i can easily setup the textures for the ground but glest does something more ...
if there are two different types of ground textures next to another the texture borders are shown some kind of smooth.

Now for my question:
How is something like this done in general? Is the texture for the whole ground one huge texture? Or is every tile bound to its texture coordinates and the fade out on the borders is done with a trick?

I also read something about "splatting" http://en.wikipedia.org/wiki/Texture_splatting
Is this the right way to go?

Re: how to calculate textures for a terrain?

PostPosted: 06 Dec 2009, 20:57
by ghoulsblade
depends on the game, but in the general wide area games i think a huge texture, overlaid by detail-textures is rather common.
interesting website on the topic : http://vterrain.org/

Re: how to calculate textures for a terrain?

PostPosted: 07 Dec 2009, 11:37
by titi
One huge texture is not possible in my case, it's too huge ( big maps would have a texture size of 768 MB! ).
I'm implementing soemthing using splatting now, lets see if this works. I will report my results.

Re: how to calculate textures for a terrain?

PostPosted: 15 Jun 2010, 10:30
by titi
Its a long time ago, but I forgot to post my results:
Texture splatting was the right keyword. Here is what I did:
http://www.jmonkeyengine.com/forum/inde ... ic=12729.0

( I don't work on this any more :( )

Re: how to calculate textures for a terrain?

PostPosted: 15 Jun 2010, 11:24
by charlie
How come you don't work on it anymore? It looked like you were making good progress. I guess you work on Mega Glest full time now.

Re: how to calculate textures for a terrain?

PostPosted: 15 Jun 2010, 12:21
by titi
yes , time is limited and megaglest is in focus now :(

Re: how to calculate textures for a terrain?

PostPosted: 15 Jun 2010, 13:56
by Julius
Well Megaglest seems to make good progress however ;) I am definitely looking forward to a release with Masterserver support! Any plans to also update the GUI? It's pretty much the last part of Glest (after implementing proper multiplayer) which could really benefit from a mayor update (graphical but also froma userbility standpoint, e.g. tool tips etc).

Re: how to calculate textures for a terrain?

PostPosted: 15 Jun 2010, 19:59
by alapshin
titi
Huge texture for the landscape is called "mega-texture approach" and it was developed by John Cormack in his Unreal engine if I'm not mistaken. This is not a general approach at all, but with some tricks provides very high details and no patterns of tiles.

As for general approach (my opinion):
1. Use shaders if possible. Provide them texture that defines how tile textures should be mixed and mixed them up in this way. For example you have rgb texture that defines how to mix textures (r + g +b = 1 for this map) and three tiles are set, so the result will be r * colorFromTexture1 + g * colorFromTexture2 + b * colorFromTexture3

2. If shaders are not available or shouldn't be used you may use "glColor" command and GL_MODULATE texture mapping mode to produce different smooth effects. Or some smooth effects can be made using multitexturing with different rules for mixing. I do not remember what commands of OpenGL sets multitexture mixing, cause I do not like this very old fixed-function pipeline style.

So, general appoach depends on your needs and target GPU capabilities :)