Terrain "palette texturing"

Started by
4 comments, last by jmakitalo 12 years, 8 months ago
I have implemented a terrain renderer, where multiple normal mapped textures can be blended together
and this is done in multipass. I think that since most of the time a significant portion of the terrain is visible,
the framerate is fillrate limited at the moment.

I was thinking of a way to have multiple blended textures and still render in single pass. It occurred to me
that if I limit the number of textures per terrain enough, I could achieve this at some level. More specifically,
if I limit the number of textures to 16, I could pack 256x256 textures into one 1024x1024 "palette texture". A vertex
shader would then be used to produce correct texture repeating by mapping texture coordinates to a proper
area in the texture space.

The texture weighting would be done on vertex level as is done in my current implementation. Texture weights
are stored per-vertex e.g. in color attributes. This will limit the number of textures locally to four, which is
still enough for many scenes I think.

My intuition says that there will be some problems with mipmapping and bilinear filtering. The textures must
probably be a bit smaller than 256x256 as some extra space must be reserved to prevent texture bleeding.

Are there any other potential drawbacks here that you can point out? Is this kind of terrain texturing
described somewhere in detail?
Advertisement
What you're describing is splatting using an atlas texture. You will get filtering artefacts unless you place borders between textures and you will need to recalculate the derivatives to avoid view dependent seams when mip mapping. A more elegant solution to circumvent both these issues is to use array textures. The only limitation is all textures must be the same dimensions but for what you describe, this will already be the case.

What you're describing is splatting using an atlas texture. You will get filtering artefacts unless you place borders between textures and you will need to recalculate the derivatives to avoid view dependent seams when mip mapping. A more elegant solution to circumvent both these issues is to use array textures. The only limitation is all textures must be the same dimensions but for what you describe, this will already be the case.


Thanks for the tips. I wasn't aware of texture arrays. Are there any drawbacks in using them? I mean why not use these arrays all over the place e.g.
one texture array for each mesh object in a scene sounds efficient if meshes have many textures. Of course the limitation that each texture
must be of the same size is a small minus there.
Other than the size limitations discussed, texture atlases can be used on a broader range of hardware as array textures require more "modern" hardware, although even that is becoming less and less of an issue.
This should help you out.
http://developer.download.nvidia.com/SDK/10/direct3d/screenshots/samples/TextureArrayTerrain.html
Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.
I will definitely try texture arrays. They seem to be supported by GeForce 8 series and up, which is fine.

This topic is closed to new replies.

Advertisement