0

I have a 3D terrain (a voxel mesh, my "arbitrary mesh"). I know how to "splat" the texture down from above the mesh, but on vertical or steep slopes it smears.

I have access to the normals and positions of each vertex. How would I generate UVs (without using a shader, so no true tri-planar colour blending) so that the texture is not smeared on steep slopes and meets up nicely with itself (no sharp seams)?

Clonkex
  • 3,373
  • 7
  • 38
  • 55

1 Answers1

2

Without a shader, you are a bit stuck. Tri-planar works by using three planar projection for uvs ( one for each world planes : XY, YZ, and XZ ) and then blend the three layers with the normal values pow by some value as coefficient.

What are the options you have to render your terrain, are you allowed to edit the geometry ? Can you do multi pass rendering with alpha blend ?

Everything is shader, why are they inaccessible ?

galop1n
  • 8,573
  • 22
  • 36
  • Oh I know it's not really possible now (posted to a forum also). I was just hoping there'd be a straightforward mathematical way of calculating it. I generate the mesh from scratch and can control everything. Shaders are not inaccessible, I just wanted to keep the shader I have to use simple. Don't worry about it, I'll just add tri-planar projection to my current shader :) – Clonkex Sep 08 '13 at 23:22
  • 1
    To keep things as simple as possible in shaders, always move possible operations in the stage it belongs. So do not put instructions in a pixel shader if the calculations can be done in vertex shader, do not put instructions in vertex shader doable by code and resolve them into collapsed constant buffers. – galop1n Sep 09 '13 at 07:09
  • Thanks for the tip! I'll make sure I remember that :D – Clonkex Sep 09 '13 at 12:56