• Advertisement

Archived

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

terrain texture types

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

alright, i''ve got bitmap textures to use and generated vertices for terrain...how do i tell renderer that at this specific part of terrain, it''s going to be sandy, and that part of terrain it''s going to be grassy? some people implement by height, where the highest part of terrain is snow texture, middle is stoney texture, and lowest is grassy texture...how about not through height, what if i wish to, say, add a road whose texture is soil, how do i specify that from terrain coordinates (x,y) to (x2,y2), this line is soil texture? thanks.

Share this post


Link to post
Share on other sites
Advertisement
A good technique is to use an AlphaMap for each texture. You blend the textures based on the alpha map.

So, you have a base grass texture, and a detail road texture. And then you have a third texture which is your alpha map and it''s just a grayscale image. The white parts of this third image is where road will be, the black parts will not have road.

Then when you do your blending you load the Alpha based on the third texture and your set.

Share this post


Link to post
Share on other sites
Hey, This is something that I am really interested in as well. Does anyone out there know of a good book, or link for teaching these techniques? Right now I have a 1024x1024 bitmap that I use to texture my terrain ! I would like to make it so I can "draw" things on like grass, and sand, etc using a nice technique that is fast....

Please, any links to tutorials if you can.

Thank you,


Michael Rhodes

Share this post


Link to post
Share on other sites
You could always add the ''road'' as a seperate mesh that would bend itself to fit around your geometry.

Share this post


Link to post
Share on other sites
about the alpha map, i''ll try it...but when i generate the terrain, how can i make it that the white lines in my alpha map will that be of the road, that the generated terrain should have equal height for that part of the road? i can''t just subtract its height value with the height value of the heightmap in those particular locations (or can i?)...

as for the separate mesh bending, how does one do that?

thanks.

Share this post


Link to post
Share on other sites
quote:

as for the separate mesh bending, how does one do that?



It''d take a little bit of programming, but essentially you''d take a rectangular mesh (made up of at least a few hundred triangles) and "warp" it to match your terrain (move the vertex locations to be slightly offset from the terrain itself).

You would probably want to calculate the road''s vertices at load time (not at run time) by comparing height values of the terrain at the location where your road is going to be.

something like:


void BendRoadVerts()
{
for(int i=0; i < Road.length; i++) // "Road" = the structure holding your road mesh.

{
for(int i2=0; i2 < Road.width; i2++)
{
int iWorldXLoc,iWorldZLoc; // This would be the position that the vertex lies in world-space.

iWorldXLoc = Road.XOffset+i;
iWorldZLoc = Road.ZOffset+i2;
Road.Verts[i][i2].y = Map.Heights[iWorldXLoc][iWorldZLoc]; // Where "Map" is a structure holding your map heights.

}

}

}

Share this post


Link to post
Share on other sites

  • Advertisement