POV-Ray : Newsgroups : povray.general : uv mapping triangles in mesh {} : Re: uv mapping triangles in mesh {} Server Time
19 Apr 2024 07:43:25 EDT (-0400)
  Re: uv mapping triangles in mesh {}  
From: Josh English
Date: 24 Mar 2023 17:36:00
Message: <641e17c0$1@news.povray.org>
On 3/24/2023 3:35 AM, Bald Eagle wrote:
> Josh English <Jos### [at] joshuarenglishcom> wrote:
> 
>> I added the uv_mapping keyword to the Test texture and got the following
>> result.
>>
>> IS this what you're looking for?
> 
> It IS!
> 
> Thanks, Josh.   That would have driven me crazy.
> I'm not sure I would have ever found that, unless I resorted to blind "try
> everything" mode.  I normally associate uv_mapping with some sort of object
> instantiation, as in "use uv_mapping to apply whatever texture, instead of the
> normal mode".  Instead, it looks like I'm having to use uv_mapping as the first
> argument in the texture definition itself, before the pigment {} statement.
> 
> I honestly can't say that I've ever seen this before, or actually noticed this
> for what it was.   Great catch.
> 
> 
> Kenneth and Thomas - the object pattern does not use the intersection of 2
> objects.  It partitions space between inside and outside of an object.  So I can
> make a texture appear in the shape of an object, or everywhere _but_ where the
> object is, or texture the object's 3D space in one way, and the space around it
> in another.   Or layer that concept, as TdG and I have done in past scenes.
> 
> And you definitely are catching on to where I'm going with that.  ;)
> 
> - BW
> 
> 
> 
> 
> (Note, the clipping of the torus is due to it being placed for proper
> positioning in the 1st and 3rd triangles, so it gets clipped in the middle one.)
> 
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

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

#declare Test2 = texture {uv_mapping pigment {rgb 1 }}

#declare Test = texture {uv_mapping pigment {object {Torus rgbt 1, rgb 0}}}

#declare Zero = <0, 0>;
#declare Mid = <0.5, sqrt(3)/2>;
#declare X = <1, 0>;

#declare FZero = <0, sqrt(3)/2>;
#declare FMid = <0.5, 0>;
#declare FX = <1, sqrt(3)/2>;

#declare hx = x/2;


mesh {
  triangle {
   <0, 0, 0>, Mid, x
   uv_vectors <0, 0>, Mid, <1, 0>
   texture {Test}
  }

   triangle {
   FZero+hx, FMid+hx, FX+hx
   uv_vectors <0,0>, Mid, <1,0>
   texture {Test2}
  }

  triangle {
   <0, 0, 0>+x, x+x, Mid+x
   uv_vectors <0, 0>, Mid, <1, 0>
   texture {Test}
  }

  translate <-1, -1, 0>
}


That is, there's no reason not to use the same UV vectors on all the 
triangles you want to highlight.

-- Josh


Post a reply to this message

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