Road Texture on heigtmap


Here is my situation : i have an heightmap composed of GeomTriangles. I have a texture for my whole world and i give a tex_coord to each vertex of my GeomTriangles depending on its position in the world (position/world_size).

This works great. But now i wanna add a few roads dynamically on my heightmap (so no precomputing things with software like Freeworld3D, all dynamic).

The problem is that the roads can have any orientation and don’t recover all GeomTriangles completely.

So I looked for some solutions and read about textures projection (that isn’t good for me) and decals (kind of a solution).

But i wonder if it isn’t possible to simply apply the road texture to the GeomTriangles with the good UV.
For an example, i have a corner of one road at (3,3) which corresponds to UV (0,0) of the road texture.
But my GeomTriangle is composed of these points : (0,0), (0,10), (10,0).

Is it possible to put the UV of these points with computed values like (-0.3, -0.5) so that the texture only begins at my point?
I tried that and it was as if i had a kind of mirror effect on the texture.

Thanks for your help.

See Try WMClamp or WMBorderColor.



Thanks a lot! I’m confused i miss this part of the manual (though i looked the texture part…).

I tried WMBorderColor and it works. Well it’s good for the UV and i’ll see for the transparency.

Thanks again

If I understand the nature of your question correctly, there’s a way to do what you want.

in the showcase section there’s a thread I posted about minimaps. The world used as a demo of minimaps employs the kind of thing you are talking about. It uses a grayscale heightmap, then a different .png file to use as texture for the whole map. Also, the demo has a “Plant” class that paints the terrain green and then with time places a tree model on that spot. The code should show you how to define the texture in the beginning by using an image file or how to draw on the texture itself at run-time if that’s what you want to do.

Hope this helps.