Landscape autogen texture
Does anyone know of any tutorials or examples on autogenerating a texture for a landscape based on slope and height? Something like snow above a certain height and on a shallow slope, grass on shallow slopes lower down, and rock where the slope is steep.
Thanks.
Well, it''s so easy you don''t need a tutorial
I assume you know how to color vertices (glColor3f(x.xf, x.xf, x.xf))
If you have an array of heightmap data, like array[x][x] where each field contains a height value for 1 vertex (you draw polygons from the vertices to actually create the landscape, but you probably already know that story)
Now, before calling in glVertex..., you do another command based on the height
For example:
if (height < 0,5f)
{
glColor.....->Green
}
else if (height < 0,9f)
{
glColor.....->Rocky
}
else
{
glColor.....->Snow
}
glVertex3f(x, y, height);
You get where I''m going? If you''re not clear, I can post some code here, but you''ll have to alter it to your own code of course...
I assume you know how to color vertices (glColor3f(x.xf, x.xf, x.xf))
If you have an array of heightmap data, like array[x][x] where each field contains a height value for 1 vertex (you draw polygons from the vertices to actually create the landscape, but you probably already know that story)
Now, before calling in glVertex..., you do another command based on the height
For example:
if (height < 0,5f)
{
glColor.....->Green
}
else if (height < 0,9f)
{
glColor.....->Rocky
}
else
{
glColor.....->Snow
}
glVertex3f(x, y, height);
You get where I''m going? If you''re not clear, I can post some code here, but you''ll have to alter it to your own code of course...
Good suggestion, and actually I do use a similar method already. I wanted to move up a step and generate a bitmap texture with rock- and snow-like effects for better detail. Any suggestions on piecing together a bitmap from small bitmaps, or any better ideas?
Thanks.
Thanks.
December 02, 2002 05:58 AM
Theres an article on delphi3d.net that sounds like what your after, the sample code that accompanies it is in pascal (delphi) but the article that explains the theory applies for any language.
Provided you transform your landscape mesh into POVRay 3.5 language, you can define a texture that do what you want, and render your landscape from above with an orthographic camera.
There is an exemple of this feature included with the Povray package
http://www.povray.org
----
David Sporn AKA Sporniket
There is an exemple of this feature included with the Povray package
http://www.povray.org
----
David Sporn AKA Sporniket
----David Sporn AKA SporniketThe blog of the Sporniket(in French) | Sporniket-Studio.com, my gallery of poster (via zazzle.com) | Sanctuaire Tokugawa, free Japanese lesson (in French)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement