Sign in to follow this  
neoaikon

Terrain Texturing and Steepness

Recommended Posts

I'm currently messing around with hlsl shaders. I used to know of a couple websites, that discuss how to texture the terrian such that, on steep parts it shows bare rock. But now that I'm messing with it, I cannot seem to find them, I tried searching the forums, so I apologize if I missed this, I'm sure its easy. I am currently blending 3 textures, grass, dirt, and snow. and lerping between them to blend. I want to try to produce results that are similar to the following: http://img241.imageshack.us/img241/8274/wowscrnshot071609015924.jpg This is a screenshot of Silithus, a desert area in world of warcraft. This screenshot best illustrates what I'd like to achieve, the area i was in was barren rock, with the next height level becoming sand, but the steep areas show sand spilling off the above terrain and covering the rock. as much as I'd like to do that effect, I'm unsure how. Would lerping between the base texture (grass, dirt, snow) and the slope texture, based on the angle between the up normal and vector normal be the way to go? :?

Share this post


Link to post
Share on other sites
I don't know exactly how WoW does it's terrain texture, but looking at that screenshot, it looks like they're using a technique called texture splatting. Texture splatting is pretty basic, but relies on an artist to "paint" which sections of the terrain get what texture - it's not done automatically (though you could pre-process the splatt texture by looking at things like slope, height, etc)

Share this post


Link to post
Share on other sites
You can do "procedural splatting" by setting up rules for when to use each texture.

E.g. something like this will use grass for pixels below 100units high, sand for pixels over 110 units (lerping between grass/sand in between) and will lerp to a rock texture on slopes.

float slopeWeight = 1.0 - normal.y;
float startBlend = 100;
float endBlend= 110;
float highWeight = smoothstep( startBlend, endBlend, position.y );
highWeight = saturate( highWeight - slopeWeight );
float lowWeight = saturate( 1 - (highWeight+slopeWeight) );

float3 finalColour = grass*lowWeight + sand*highWeight + rock*slopeWeight;


Here's another example in GLSL, but it's pretty much the same as HLSL:
http://www.horde3d.org/wiki/index.php5?title=Shading_Technique_-_Terrain_Shading

Share this post


Link to post
Share on other sites
Thanks for your answers. I was actually planning on using splatting, but wanted to handle steep terrain procedurally. Thanks to Hodgman, I was able to find one of the pages I'd lost. Basically what I need to do is calculate a normal per-pixel, the page I did find detailed a 3-star routine. Which is sufficient until I find the others. Thanks again.

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