now I am running into another problem... Painting the terrains.

Since they are randomly generated during runtime there are no masks etc textures created beforehand for any shader to work with.

and i am thinking that if i have to create the masks at runtime and then pass them to the shaders... i would rather direclty generate the final bmaps myself and save a step!

the problem is I dont know how. I already have my separate textures i want to use (and they are the same size as each terrain).

My idea is this:

create at runtime empty bmap for each terrain, assign each one as skin to each terrain, and then for each bmap do the folowwing:

1. fill its full texture to the base texture (grass for example).
2. going through the bitmap comparing to the respective height data, set any part lower than (for example 16) to sand. (for beach, river lines, and uderwater terrain).
3. set any part of the bmap covering a part of the terrain with a height > 50 to my rocky texture.
4. set any part of the bmap covering terrain height > 100 to my snowy texture.
5 go through the whole terrain again and replace any part with a slope angle > 60º with my cliff texture.

The bmaps i want to use for my terrains are 512x512, my terrains are 33x33 vertixes with a spacing of 16q between each vertex (which also gives 512x512 size). That was planned beforehand to have the size of the terrains = the size of their texture and not nned any tiling of textures or anything.

My problem is the height data... I dont have 512x512 height data, i only have 33x33 height data. How do I know what to paint on the spaces in between my height data? and how do I detect what parts have an angle > 60º?

The first solution that came to my mind was using c_trace to detect heights of each pixel and also calculate angles with those c_trace... but it seems crazy... it will mean 252144 c_trace instructions per terrain just to get the data to draw the texture.

I thought of averaging out the diference between each point based on distance from any vertex, but i realized that the calculations would be wrong in most cases. as illustrated below the program would assume from A to B everything was the same height. i also thought of calculating the mid point but that does not work either. Any ideas would be greatly apreciated, I have hit a brick wall and cannot see around it!



"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1