1

I am developing a framework to create terrains for games.

enter image description here

The problem I am facing is how to uv-map the mesh so the textures are not stretched in steep locations. Right now uvs are in [0-1] range and the vertex uv is calculated based on vertex position in xz plane(y is upward). There are two issues I am concerned with:

  1. In steep regions the textures are stretched horribly:

enter image description here

  1. It is not absolutely necessary but it would be very nice to have direction awareness so on steep regions the uvs become horizontal. Consider the following image. The layered rock texture is fine in the left side of image because it is horizontal and looks like the layers are parallel to sea level. But on the right side it's not horizontal and it looks dreadful and unrealistic.

enter image description here

I am looking for an algorithm to calculate uvs in design time, not runtime so it needs a calculation solution not a rendering solution like triplanar rendering. I am starting to think of this as a 2D difference field problem but have no expertise in the matter.

It's a GPU computing project and even vertex uvs are stored in a render target so an iterative algorithm would perfectly fit the situation.

morteza khosravi
  • 1,599
  • 1
  • 20
  • 36
  • 1
    Parameterization is a pretty complex field. Take a look at Tutte embedding for a start. Many approaches that exist have some implementation available. Just go ahead and try what suits your needs. For your second problem, you want to fit gradients in some way. Things like positional and rotational symmetry could be considered here. Altogether, not too simple but doable. – Nico Schertler Nov 13 '17 at 15:43
  • Yes I need something similar to it. I'll dig more into the matter. – morteza khosravi Nov 13 '17 at 17:58

0 Answers0