LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: blue_tomato on October 02, 2005, 17:50:58

Title: Realistic 3D landscape texturing
Post by: blue_tomato on October 02, 2005, 17:50:58
I am working on a landscape engine, and want to improve how the textures look in steep hills.

Normally when rendering landscapes, a texture is simply projected down on the height-mapped polygons from above. This works fine in most cases where, but when a hill is very steep, the texture will be stretched and the result looks unnatural like in this screenshot:

(http://image.com.com/gamespot/images/2003/pc/fs2004/0603/fs_screen007.jpg)

Notice the steeper the hill, the more stretched the texture becomes because of the lack of vertical texture information.

Normally this is solved by using a new texture for slopes that are steeper than a given angle. A stone texture is often used for example, like here:

(http://image.com.com/gamespot/images/2005/271/reviews/917534_20050929_screen029.jpg)

In my case, I want one surface texture to be used over the whole landscape, but instead of being stretched on downhill and uphill, I want the engine to always paint the same amount of texture pixels per m2 at all times.

Any ideas on how this can be accomplished? Thanks :)
Title: hmmmmmmm...
Post by: Fool Running on October 03, 2005, 13:34:54
You could calculate the distance between vertexes and put enough of the texture to cover the distance. (I assume you can pre-compute this information  :lol: )
Title: Re: hmmmmmmm...
Post by: blue_tomato on October 03, 2005, 16:03:17
Quote from: "Fool Running"You could calculate the distance between vertexes and put enough of the texture to cover the distance. (I assume you can pre-compute this information  :lol: )

Yeah, this is the first solution that came into my mind too, have a repeating detail texture and non-linear uv coordinate distribution.

But, would this not mean the textures would get distorted, as the repeating textures would no longer be properly aligned?

I did not actually try it, anyone has experience with it?
Title: Realistic 3D landscape texturing
Post by: hvor on October 04, 2005, 07:30:11
Only good solution that I came to is to have more polygons on very steep hills. I don't know how you could  paint the same amount of texture pixels per m2 at all time, if you are constrained with vertex information - you can attach texel to vertex.