POV-Ray : Newsgroups : povray.unofficial.patches : uv_mapping bug? : Re: uv_mapping bug? Server Time
2 Sep 2024 18:19:12 EDT (-0400)
  Re: uv_mapping bug?  
From: smellenbergh
Date: 22 Aug 1999 04:35:13
Message: <1dwxn1c.dzd38212wkyeoN@dialup45.leuven.skynet.be>
Nathan Kopp <Nat### [at] Koppcom> wrote:

> It's not really a bug, just a mis-understanding.  You see, the UV-mapping
> implemented here simply maps the X and Y of the texture to the U and V of
> the object.  It takes a slice of the texture from the XY plane (Z=0) and
> wraps that slice around the object.
> 
> Any slice of gradient z parallel to the XY plane will have a uniform color,
> since the texture will only change in the z direction.
> 
> -Nathan
> 
Oh, I see: a mis-understanding indeed. But also a bit disappointed.
Couldn't you use a slice of the texture from the XZ plane and wrap that
around the object for gradient z (this is also true for the mandel
pattern).
Well that explains it for the sphere, lathe and box objects. But there
is still a problem with the bicubic_patch object. With gradient x the
gradient goes in the z-direction. With gradient y it goes in the
x-direction
Just render the scene below and you will see the problem. 

 
//******** Scene with uv_mapping bug ? *************
// Change Obj_Switch for different objects
#declare Obj_Switch = 2; //  2= Bicubic_patch
 
#declare C_Map =
         color_map {
                 [ 0.0 color rgb < 1.0, 1.0, 1.0 > ]
                 [ 0.3 color rgb < 1.0, 1.0, 1.0 > ]
                 [ 0.3 color rgb < 1.0, 0.0, 0.0 > ]
                 [ 0.6 color rgb < 1.0, 0.0, 0.0 > ]
                 [ 0.6 color rgb < 0.211505, 0.530358, 0.728481 > ]
                 [ 1.0 color rgb < 0.211505, 0.530358, 0.728481 > ]
         }
 
 #if (Obj_Switch = 2)
         #declare Object =
                 bicubic_patch  {
                         type 1 flatness 0.0 u_steps 4 v_steps 3
                         < -0.6, -1, 0.5 >,      < -0.33, 0.0, 0.5 >,  <
0.33 , 0.0, 0.5 >,    < 0.5, -1, 0.6 >,
                         < -0.5, 0.0, 0.33 >,    < -0.33, -0.2, 0.33 >,
 < 0.33, -0.2, 0.33 >,   < 0.5, 0.0, 0.33 >,
                         < -0.5, 0.0, -0.33 >,   < -0.33, -0.2, -0.33 >,
 < 0.33, -0.2, -0.33 >,  < 0.5, 0.0, -0.33 >,
                         < -0.6, -1, -0.5 >,     < -0.33, 0.0, -0.5 >,
 < 0.33, 0.0, -0.5 >,    < 0.5, -1, -0.6 >
                         translate y*0.6
                 }
 #end
 
 //Top row with classic gradient
 object  {
         Object
         pigment { gradient x color_map { C_Map } scale 0.5 }
         translate <-1.3, 0.4, 0.6>
 }
 object  {
         Object
         pigment { gradient y color_map { C_Map } scale 0.5 }
         translate <0, 0.4, 0.6>
 }
 object  {
         Object
         pigment { gradient z color_map { C_Map } scale 0.5 }
         translate <1.3, 0.4, 0.6>
 }
 
 //Lower row with uv_mapping
 object  {
         Object
         uv_mapping
         pigment { gradient x color_map { C_Map } scale 0.5 }
         translate <-1.3, -0.6, 0>
 }
 object  {
         Object
         uv_mapping
         pigment { gradient y color_map { C_Map } scale 0.5 }
         translate <0, -0.6, 0>
 }
 object  {
         Object
         uv_mapping
         pigment { gradient z color_map { C_Map } scale 0.5 }
         translate <1.3, -0.6, 0>
 }
 
 camera {
         location < 0.0, 3, -5 >
         angle 40
         look_at < 0.0, 0.0, 0.0 >
 }
 
 light_source { <0, 50, -60> rgb 1.5 }
 

-- 
e-mail:sme### [at] skynetbe

http://users.skynet.be/smellenbergh


Post a reply to this message

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