Original Post
Here is an idea I have been thinking about for some time, but have not really ever got round to implementing... Let me explain. When representing a terrain as a height field, it is easiest to consider top down mapping of the texture, being projected onto the terrain... This however, leads to low quality textures, on steep slopes. My method, is simply intended to compensate for this.
1. You need a texture, as though it would be projected top down onto the terrain, but about 4 times the resolution (ie for 256x256 texture... 1024x1024 is the basis, but the bigger the better).
2. You go along each horizontal and vertical line in your height field, and calculate the length of that ridge, using pythagoras lots of times.
3. Instead of generating texture coordinates, dependant purely on the x,y (z being height) coordinates, you generate the u coordinates, based on how far, from the left edge of the texture you are, (compared to the length of that rigde), then do the same vertically.
4. You then distort the original image as follows: you make a normal grid representing the pure x,y coordinates of the points on the terrain, then you distort them to the shape of the u,v coordinates you generated... This is why you need a high res to down image, because steep slopes, need more detail (since I was using a top down map to start with). This image is then scaled down to the required resolution (or the distortion could incorporate this for you).
5. You now use your u,v coordinates, in conjunction with your new texture map.
I believe that this will give you textures that are more evenly distributed over the surface of the terrain, and not purely projected down... I think that this will eliminate the problems regarding steep slopes appearing low resolution. Since you need a larger texture to start with, I thought this method may be to space intesive, but if you suply the texture maps, in distorted form, the program could calculate the texture coordinates at run-time, thus not requiring any more storage.
So could you guys tell me: Has anyone tried this method/seen this method before/got a better method? and also, What do you think of it? and Do you think it will work?
Thanks