POV-Ray : Newsgroups : povray.unofficial.patches : uv_mapping bug? : Re: uv_mapping bug? Server Time
2 Sep 2024 18:17:17 EDT (-0400)
  Re: uv_mapping bug?  
From: Nathan Kopp
Date: 21 Aug 1999 23:43:01
Message: <37BF725F.A4ECF606@Kopp.com>
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

smellenbergh wrote:
> 
> Rendering a gradient with uv_mapping seems to have a bug when
> using the gradient pattern: no mapping is done with gradient z ! With
> gradient x and gradient y it renders fine. This is the case with the
> sphere, lathe and box objects.
> Rendering a bicubic_patch with uv_mapping has a problem with all
> gradients. With gradient x the gradient goes in the z-direction. With
> gradient y it goes in the x-direction and with gradient z no mapping is
> done.
> 
> Rendering the scene below will show the problem. The top row shows
> gradient x, gradient y and gradient z with the 'classic' gradient.
> The bottom row shows the same gradients with uv_mapping.
> 
> //************** Scene with uv_mapping bug ? *************
> // Change Obj_Switch for different objects
> #declare Obj_Switch = 0; //0 =Sphere;  1= Lathe;  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 = 0)
>         #declare Object = sphere  { < 0.0, 0.0, 0.0 >, 0.5 }
> #end
> #if (Obj_Switch = 1)
>         #declare Object =
>                 lathe  {
>                         quadratic_spline
>                         6,
>                         <0.0, 0.000000 >,
>                         <0.00000, 0.00645 >,
>                         <0.86452, 0.09677 >,
>                         <0.28387, 0.35484 >,
>                         <0.24516, 0.48 >,
>                         <0.00000, 1.00645 >
>                         scale <0.7, 0.8, 0.7>
>                 }
> #end
> #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.