Sign in to follow this  

Texturing terrain slopes

This topic is 3782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Presently I'm texturing my terrain based on vertex heights, which is okay but the results it produces are not very natural looking. I was wondering what's the best way to go about texturing terrain geometry that takes into account slope angles, so that steeper areas can be textured to look like rock and flat areas like grass etc. Would I be along the right lines in thinking that the terrains surface normals are what I would use to compute the correct texture to use? I've searched around for some tutorials that cover terrain texturing this way but with no luck - any help would be greatly appreciated. Thanks!

Share this post


Link to post
Share on other sites
Several terrain texturing approaches are possible.
I will explain a few of the more wider used techniques in short.

1. Planar mapping
The most simple way is to apply one planar mapped texture.
Pro's
- Very simple to implement.
- Fast
- No advanced techniques needed (shaders etc.)
Con's
- Texture must be hand made to fit the terrain
- On large terrain the quality suffers
- On steep areas the texels stretch

2a. Blend texturing
Blend up to three tiling textures using the RGBA components of the vertex colors.
Pro's
- No hand made
- No

2b. Blend texturing
Blend several tiling textures using blend info from a terrain covering map.
Map one blend-info map on the entire terrain. Each component (RGBA) containing a blend factor
Pro's
- Blend resolution can be as good as the blend info map's resolution (vertex density independant)
- Compatible with older hardware
- No shaders needed.
- High resolution texturing
Con's
- Limited to three textures
- May not be fast on older hardware
- Blend info map must be hand made for the terrain
- Texel stretching on steep slopes

3a. Detail texturing
Mapping one big texture on the terrain containing simple colors.
The color from the texture is used to select a specific (tiling) detail texture. The detail texture is combined with the color map. Transition between detail maps are also possible using the color info.
Pro's
- Many different detail maps are possible
- Good quality results (Far Cry uses this technique)
- Not extremely difficult to implement.
Con's
- Shaders needed
- Slow on older hardware
- Global color map must be made by hand to match the terrain
- Texel stretching on steep slopes

3b. Detail texturing
In the fragment shader, use the elevation and the components of surface normal to calculate blend factors for blending (tiling) detail textures. The surface normal manipulates the blend factor for steep or flat terrain sections, the elevation selects different textures to match the altitude.
Pro's
- No hand made terrain matching texture needed
- Very good result are possible
- High resolution texturing
- Alternative info can be used to improve/alter detail texture selection
- No texel stretching
- As many different textures as the hardware allows are possible.
Con's
- Shaders needed
- Only for modern hardware
- More difficult to implement
- All possible detail textures must be available in the fragment shader

4. A combination of the above mentioned techniques.
For example, the blend map from option 2b could be generated using the techniques from 3b.

It's up to your own inventiveness to come up with a clever combination that suits your goals.


Serge van Keulen

Share this post


Link to post
Share on other sites
Quote:
Original post by Treesong
...

3b. Detail texturing
In the fragment shader, use the elevation and the components of surface normal to calculate blend factors for blending (tiling) detail textures. The surface normal manipulates the blend factor for steep or flat terrain sections, the elevation selects different textures to match the altitude.
Pro's
- No hand made terrain matching texture needed
- Very good result are possible
- High resolution texturing
- Alternative info can be used to improve/alter detail texture selection
- No texel stretching
- As many different textures as the hardware allows are possible.
Con's
- Shaders needed
- Only for modern hardware
- More difficult to implement
- All possible detail textures must be available in the fragment shader

...


Great post thanks, but 3b. was all I was after - Rating++ for the help!

Share this post


Link to post
Share on other sites
Sorry, option 2b got mangled:

2a. Blend texturing
Blend up to three tiling textures using the RGBA components of the vertex colors.
Pro's
- No hand made blend texture needed, blend info can be calculated and stored in the vertex color.
- No shaders needed
- Compatible with older hardware
- High resolution texturing possible
Con's
- The blending is as good as the vertex density. This is less of a problem with high density regular grids. With terrain meshes that use LOD techniques this may be a less suitable approach.
- Only three different textures possible
- May be slow on older hardware
- Stretching of texels on steep slopes

Hope it helps

Serge van keulen

Share this post


Link to post
Share on other sites
Quote:
Original post by FunLogic
Quote:
Original post by Treesong
...

3b. Detail texturing
In the fragment shader, use the elevation and the components of surface normal to calculate blend factors for blending (tiling) detail textures. The surface normal manipulates the blend factor for steep or flat terrain sections, the elevation selects different textures to match the altitude.
Pro's
- No hand made terrain matching texture needed
- Very good result are possible
- High resolution texturing
- Alternative info can be used to improve/alter detail texture selection
- No texel stretching
- As many different textures as the hardware allows are possible.
Con's
- Shaders needed
- Only for modern hardware
- More difficult to implement
- All possible detail textures must be available in the fragment shader

...


Great post thanks, but 3b. was all I was after - Rating++ for the help!


That technique sounds nice, I've googled a bit but apparently I only get results for 3a... any idea if there's an article available somewhere?? :)

Share this post


Link to post
Share on other sites
Quote:
Original post by Treesong
Several terrain texturing approaches are possible.
I will explain a few of the more wider used techniques in short.

1. Planar mapping
The most simple way is to apply one planar mapped texture.
Pro's
- Very simple to implement.
- Fast
- No advanced techniques needed (shaders etc.)
Con's
- Texture must be hand made to fit the terrain
- On large terrain the quality suffers
- On steep areas the texels stretch

2a. Blend texturing
Blend up to three tiling textures using the RGBA components of the vertex colors.
Pro's
- No hand made
- No

2b. Blend texturing
Blend several tiling textures using blend info from a terrain covering map.
Map one blend-info map on the entire terrain. Each component (RGBA) containing a blend factor
Pro's
- Blend resolution can be as good as the blend info map's resolution (vertex density independant)
- Compatible with older hardware
- No shaders needed.
- High resolution texturing
Con's
- Limited to three textures
- May not be fast on older hardware
- Blend info map must be hand made for the terrain
- Texel stretching on steep slopes

3a. Detail texturing
Mapping one big texture on the terrain containing simple colors.
The color from the texture is used to select a specific (tiling) detail texture. The detail texture is combined with the color map. Transition between detail maps are also possible using the color info.
Pro's
- Many different detail maps are possible
- Good quality results (Far Cry uses this technique)
- Not extremely difficult to implement.
Con's
- Shaders needed
- Slow on older hardware
- Global color map must be made by hand to match the terrain
- Texel stretching on steep slopes

3b. Detail texturing
In the fragment shader, use the elevation and the components of surface normal to calculate blend factors for blending (tiling) detail textures. The surface normal manipulates the blend factor for steep or flat terrain sections, the elevation selects different textures to match the altitude.
Pro's
- No hand made terrain matching texture needed
- Very good result are possible
- High resolution texturing
- Alternative info can be used to improve/alter detail texture selection
- No texel stretching
- As many different textures as the hardware allows are possible.
Con's
- Shaders needed
- Only for modern hardware
- More difficult to implement
- All possible detail textures must be available in the fragment shader

4. A combination of the above mentioned techniques.
For example, the blend map from option 2b could be generated using the techniques from 3b.

It's up to your own inventiveness to come up with a clever combination that suits your goals.


Serge van Keulen



One question:
Where does the texture splatting technique fits ? Or its something different from what you described ?

Share this post


Link to post
Share on other sites
Yes, i would like to see splatting there, thats a good technique.

And dont forget, steep slopes causes stretching (on a regular heightmap), so you may need a different texture for X and Z angled slopes (not talking about XZ angled ones). But this can be a real pain, and you dont really have to deal with it usually.

Share this post


Link to post
Share on other sites
In addition to the actual vertex height, you can use the normal. For example, you could use the .y value of the normal to lerp between horizontal and vertical surface textures (or multiple variations thereof).

Share this post


Link to post
Share on other sites
Other option, for high end graphic cards: use a giant, very detailed texture (this is the premice of Id's Tech5 (MegaTexture)). Of course, you'll need to provide a way to stream the texture to memory, as there is no way to get a full blown 32K x 32K x 32bits texture in memory (that's 4 GB). This is the basic idea behind Id's MegaTexture.

Good thing is that it's not that hard to get a working prototype. Optimizing can be difficult, but that's definitely doable. And you can get more for free: the texture can also contain the normal/parallax map, as well as other information. It can also be modified (why not adding a splat of blood here?).

Suddenly, me thinks that I'd like to implement that...

Share this post


Link to post
Share on other sites
Simply put the technique from 3b is combining planar mapping from 5 directions using 2 different textures. This minimizes stretching. It is very much like cubemapping. The surface normal determines what side of the cube to use. To get nice transitions the normal is also used to calculate blend factors for blending textures.

It's a relatively new idea to use for terrain texturing. Without branching it demands three samples per fragment just for the diffuse color af the fragment.

Regards,

Serge van Keulen

Share this post


Link to post
Share on other sites

This topic is 3782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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