Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Generate Tri-Planar UVs For Arbitrary Mesh?

Author
Message
Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 8th Sep 2013 07:26
Hey all

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)?

Any help would be much appreciated

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Sep 2013 13:19
Quote: "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)?"


That is a very difficult task and has been the subject of a number of research reports. The shader solution is very simple. Why not use it?

You might be able to achieve something using blend mapping - but it won't remove the steep slope problem completely. Have a look at this thread:

blend mapped terrains



Powered by Free Banners
Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 8th Sep 2013 15:42
Quote: "The shader solution is very simple. Why not use it?"


Um....because I hoped there was a simple way to mathematically calculate the UVs directly. As it seems there isn't such a thing, I suppose I'll have to use the shader. I tell you what, though, now that I understand the basics of shaders, I've decided they're really fun to play with, and there's all sorts of fun things you could do with them

As soon as someone answers my next question, I'll try a shader-based tri-planar projection method. I've studied this before and as far as I can see it's rather simple.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Sep 2013 17:23
Quote: "Um....because I hoped there was a simple way to mathematically calculate the UVs directly."


So did I when I looked into this a few years ago. I got something more or less working but wasn't happy with the result. I then looked around for other approaches and found a few which seemed to use a lot of complex math. I don't mind complex math but seemed OTT for what I really wanted so I finally opted for simpler methods using the triplanar idea. It works well and is easy to apply in a shader. It would be a good problem to practice your shader skills on.

I think mr Handy has answered your next question.



Powered by Free Banners
Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 9th Sep 2013 02:27
Quote: "It would be a good problem to practice your shader skills on."


Indeed. Thanks for your help

STUPID. ROTTEN. CARS. I was going to be driving the 3 hours to Ballina with my brother today but the battery's flat on the Land Rover. No lights were left on so we think the alternator is on its way out. Might be the cause of the large amount of electrical issues we've been having too *fingers crossed*

Login to post a reply

Server time is: 2026-07-08 13:41:38
Your offset time is: 2026-07-08 13:41:38