How is terrain blending done now?

Started by
13 comments, last by SimmerD 19 years, 1 month ago
Quote:Original post by SimmerD
To get volume texture slabs working with mip-maps, you need to use more than a single pixel slab per terrain layer.

For instance, if you have 256x256 textures with 4 different layers, and you want 4 levels of mipmaps, you make the top 3d texture layer

256x256x32.

then, the lower mip-levels become :

128x128x16
64x64x8
32x32x4

Each slice in the top layer is 8 pixels high, and your texture coordinate should sample from the middle of each slice. That way, as you drop miplevels, you are still grabbing from only that one layer.

I know of at least one commercial game that uses my idea for this successfully.


I had the same idea when I experimented a bit with this some time ago. Isn't there a problem with blending between different texture layers as it will never will work the same way for all resolutions without adjusting texture coordinates according to which mipmap level is currently used?

By simply doubling each slice each mipmap level will get "sharper" transistions between ground levels wouldn't it? Even when manually interpolating the inbetween slices I never got it excectly right.

Advertisement
see here
http://motueka.homeip.net/captain_courgette.html
under shaders directory ... terrain ... .glsl
they give an example of how to do it, u can easily expand the num of layers ie
rgba = 4 but u can easily pack two (or four) values into r thus giving u 8 or 16 layers
If my card only has 2 texture units, can I still pass info to shaders using the tex-coord pointers for other texture units (TEXCOORD0-7)?
Are there any cards with only 2 texture units that run shaders? DX8 class hardware is required to have 4 texture units I think. Anyway if there are only 2 texture units there won't be more texture registers to pass data to fragment processing.
The idea is that you use the volume trick to reduce batch size, not for blending the layers.

You can use the volume trick to give you one of several layers with proper tiling & mip-maps, then fetch this multiple times in the shader for each layer at a different 'r' texture coordiante, and blend them together.

Otherwise, if you have many combinations of layers, like each terrain chunk can have 4 layers out of a possible 16, then you can do this all in one call. Otherwise, you'd need to handle many more permutations.


Quote:Original post by muhkuh
Quote:Original post by SimmerD
To get volume texture slabs working with mip-maps, you need to use more than a single pixel slab per terrain layer.

For instance, if you have 256x256 textures with 4 different layers, and you want 4 levels of mipmaps, you make the top 3d texture layer

256x256x32.

then, the lower mip-levels become :

128x128x16
64x64x8
32x32x4

Each slice in the top layer is 8 pixels high, and your texture coordinate should sample from the middle of each slice. That way, as you drop miplevels, you are still grabbing from only that one layer.

I know of at least one commercial game that uses my idea for this successfully.


I had the same idea when I experimented a bit with this some time ago. Isn't there a problem with blending between different texture layers as it will never will work the same way for all resolutions without adjusting texture coordinates according to which mipmap level is currently used?

By simply doubling each slice each mipmap level will get "sharper" transistions between ground levels wouldn't it? Even when manually interpolating the inbetween slices I never got it excectly right.

This topic is closed to new replies.

Advertisement