Sign in to follow this  
jmakitalo

Terrain "palette texturing"

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote name='King Joffrey' timestamp='1313273174' post='4848761']
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.
[/quote]

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this