Archived

This topic is now archived and is closed to further replies.

Terrain Texturing

This topic is 5125 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

Ok my question is about different way of texturing a heightmapped terrain. Currently I have a 1024*1024 texture stretched across a 100*100 vertex square mesh. Each vertex has it''s x and z coordinate on a grid in 1 unit intervals. The y (height) value is loaded from a file. The texture coordinates are evenly distributed across the x and z values by the formula tu = x/width and tv = z/length. I''m curious about what other ways I should look into texturing the terrain as currently the texture gets stretched when the terrain changes altitude. Thanks for any ideas on how I should texture or load the terrain.

Share this post


Link to post
Share on other sites
i cant give you a detailed answer so let me point you in some good directions.

you''ll want to google ''texture splatting'', which is one of the more common implementations.

the one i have in mind is for my vertex format to hold 2 or more texture coords and to iterate thru my vertices, apply a texture based on the Y value, and then select a blending mode based on the average delta between the 8 surrounding vetices Y value and the current vertice Y value. havent implemented it though.

Dredd
________________________________________

"To die with your sword still in its sheath is most regrettable" -- Miyomoto Musashi


Share this post


Link to post
Share on other sites
I mae a method up (I think).

Basically I calcluated a colour for every vertex for every texture in the level.

So basically for every terrain texture (grass, mud, rock, snow) there''s an alpha texture. The alpha texture is the same size as the heightmap. The alpha textures are calculated depending on things like height and gradient.

The clever thing is that if the textures the same size of the terrain, the alpha-texture texture stage uses a magfilter to shae in the gaps, creating a smooth blend.

It works quite well. You can check out the first screenies here

http://uk.geocities.com/oh_so_skillfull/game.htm

The only problem is that for every terrain texture, you need a seperate pass. I''m hoping to cut that down.

The good thing is it cuts down loads on texture memory with the largest textures being the size of your HM.

maybe you followed that, hope so

matt

Share this post


Link to post
Share on other sites
You could use a pixel shader to very simply combine the varying texel colours using pre calculated weighting values passed as the color value. It only requires one pass but obviously older hardware will be unable to run it.

http://www26.brinkster.com/potatoesnack/TerrainDemo1.jpg

Theres a very rough example of the kind of effect that can be produced.

[edited by - LowCalorieSoftDrink on November 30, 2003 3:29:51 PM]

Share this post


Link to post
Share on other sites