POV-Ray : Newsgroups : povray.general : uv mapping triangles in mesh {} : Re: uv mapping triangles in mesh {} Server Time
31 Oct 2024 19:13:52 EDT (-0400)
  Re: uv mapping triangles in mesh {}  
From: Josh English
Date: 25 Mar 2023 14:07:29
Message: <641f3861$1@news.povray.org>
On 3/25/2023 2:21 AM, Thomas de Groot wrote:
> Op 24-3-2023 om 22:36 schreef Josh English:
>> Yup. uv_mapping needs to be triggered on the texture and the object to 
>> work. I played with it a bit more and managed to get the torus onto 
>> each triangle that has the Test texture
>>
> I have bit of a problem with this:
>> #declare TorusRadius = sqrt(3)/6;
>> #declare Torus = torus {TorusRadius-Line, Line rotate x*90 translate 
>> <0.5, TorusRadius-Line, 0>}
>>
> and I got a better fit with:
> 
> #declare Line = 0.02;
> #declare Torus = torus {sqrt(3)/8, Line rotate x*90 translate <0.5, 
> sqrt(3)/6, 0>}
> 
> ...which is less elegant but which fits better the triangle centres 
> somehow. I don't know how to translate this to your solution though.
> 

It looks good to me. I didn't get a satisfactory "kiss the edge of the 
triangle" look but I didn't do a lot of heavy math. Even the sqrt(3)/6 
was a guess that just seemed to work well enough.

I made a few more adjustments to the code

#declare TorusRadius = sqrt(3)/6;
#declare Torus = torus {TorusRadius-Line, Line rotate x*90 translate 
<0.5, TorusRadius, 0>}

And then I experimented with stretching some triangles, which would 
happen in a mesh and got the expected distortions of the radius. I'm not 
sure that's even possible to fix without customizing ellipses for each 
triangle, so probably at that point a cylinder and not a torus creates a 
better marker.


Post a reply to this message


Attachments:
Download 'uv_test.png' (27 KB)

Preview of image 'uv_test.png'
uv_test.png


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.