How to make terrain texture like you see in Civilization IV. [see this pic]

It has at least 4 different textures: dirt, light green, fresh green and rock (or something like).

I know that terrain may use 2 textures: base and detail, but it's applied to all area which is defferent from the picture (some area use dirt, grass, etc.).

Any advise would be much appreciated.

texture splatting…

Thanks MrCoder  :smiley:

Is there an example for texture splatting in jme?

no it's not, but hopefully the monkeyworld3d team will add some support for that in their editor (at leat, in my dreams)  :wink:

isnt "texture splatting" the same as what ProceduralTextureGenerator does over the entire terrain. The only mod you will need to make is how PTG is told what images to blend

no it's not…putting one texture over the full thing isnt the same as alternating between different textures based on an alphatexture(that covers the full terrain)

PTG does the "mixing" of the terrain textures in software (a simple for loop even). What Civ4 seems to do, is let the video hardware mix them, probably using alphamaps. It can even use a fixed number of pregenerated alphamaps because their terrain in the end still exists out of different tiles. Look at the hills for example, even without paying much attention you see they often look the same. Not exactly Civ4's prettiest feature if you ask me.

ok, i'll try to explain in a different way…

say you create a PTG with createTexture of size 2. this would blend colors from the different textures and put 4 colors on the 2x2 texture…with texture splatting this would result in an alphatexture that is 2x2 in size, but the terrain would not be covered by 4 huge evenly colored rectangles, but with 4 different textures(who can be in which scale you wish independant of each other)…the alphamap can be very small but the terrain would still look good cause of the high detail textures blended between…

It is probably not the best way to do it but you could modify the ProceduralTextureGenerator to mix the textures based a tile grid instead of height

It's an option Badmi, but it'll be terribly slow. I suppose you could pregenerate everything.

A better option is to let something like PTG generate the alphamaps, since they're smaller and require less calculation.

not if you just used java2d to place each tile image into the larger image. Could be done with one iteration, provided you knew up front what needed to be rendered.

i have just tested it for 1024 tiles , its actually quicket than the PTG