POV-Ray : Newsgroups : povray.general : Apparent Error in Cylindrical Pigment Map Server Time
31 Oct 2024 22:22:16 EDT (-0400)
  Apparent Error in Cylindrical Pigment Map (Message 1 to 4 of 4)  
From: Dawn McKnight
Subject: Apparent Error in Cylindrical Pigment Map
Date: 4 Nov 2000 19:56:47
Message: <3A04B04E.99B55D3F@mac.com>
So, I'm working on this object.  I won't bore you by telling you what it
is, or what I'm using it for, or like that, but I will say that I'm
trying to get a smooth color gradient between the edge and the center,
which is to say, I need it to be a gradient in both x and z directions,
constant as per y.  

Which sounds like a cylindrical pigment type, to me.  I read the
documentation, page 262, first paragraph, which says "It starts at 1.0
at the origin and increases to a maximum [sic] value of 0.0 as it
approaches a distance of 1 unit from the Y axis.  It remains at 0.0 for
all areas beyond that distance."

So, if I understand this correctly, if I set a color_map with an entry
of color Blue at 1.0, and color Yellow at 0.0, I should get a
cylindrical pattern where the edge is yellow, and the center is blue,
and in between is interpolated shading... in other words, various shades
of green.

Well, I don't need a one unit cylindrical pattern... I need one that's
scaled to an ellipse of about 300x125 units.  So I do the scaling, and
translate the origin of the pattern to where I need it to be... and...
Huh.  that's weird.  Instead of interpolated colors, I get an oval of
blue, with a sharp-edge delineation where it becomes abruptly yellow.

Also, it seems to actually start with 0.0 at the origin, and increase to
1.0, in contradiction to the documentation.

Also, if I put in more than two colors, most of the color entries
disappear... only the lowest value color, and the highest value color, appear.

My code follows, so you can see for yourself what happens when it
renders.  If someone could confirm for me that this is a bug, or
alternately, point out to me where I'm making my mistake, I'd be grateful.

/*
// Persistence of Vision Ray Tracer Scene Description File
// File: bussard.pov
// Vers: 3.1
// Desc: bussard collector for the front of the nacelle
// Date: 30 Oct '00
// Last: 4 Nov '00
// Auth: Dawn McKnight
*/

background { color Black }

light_source { <300, 50, 300> color White }

camera {
	location <-500, 0, -400>
	look_at <-500, 0, 0>
	} // close camera

#local Bus1 = intersection {

prism {
	quadratic_spline
	linear_sweep
	-1, // height 1
	1, // height 2.. this is just for visualization purposes, I'll extend
it later.
	6, // number of control points
	<200, 100>, <400, -25>, <185, -135>, <0, -25>, <200, 100>, <400, -25>
	} // close prism
	
	box {
		<214, -2, 120>,
		<-10, 2, -25>
		} // close box
		
	} // close intersection
	

#local Bus2 = merge {
	object { Bus1 }
	object { Bus1 rotate 180*x translate -49.99*z }
	} // close merge

#local BusCap = intersection {	
	lathe {
		quadratic_spline
		4, 
		<-110, 185>, <0, 0>, <125, 200>, <0, 400>
		sturm
		//rotate 90*z
		} // close lathe 
	
	box {
		<-130, -10, -130>,
		<130, 214, 0>
		} // close box
	
	} // close intersection

#local BussCut = union {	
	object { Bus2 scale 25*y rotate 90*x rotate 90*z translate 25*x}
	object { BusCap translate -25*z }
	object { BusCap rotate 180*y translate 25*z }
	} // close merge

#local BusShape = merge {
	object { BussCut }
	box { <-125, 213.9, -25>, <125, 314, 25> }
	cylinder { <0, 213.9, -25>, <0, 314, -25>, 125 }
	cylinder { <0, 213.9, 25>, <0, 314, 25>, 125 }
	} // close union


light_source {
	<0, 0, 0>
	color White	
	looks_like {
		BusShape
		rotate -90*z
		pigment { 
			cylindrical
			scale <300, 125, 125>
			translate 300*x
			color_map {
				[1.0 color Yellow]
				[0.1 color Blue]
				} // close color_map
			} // close pigment
		finish { ambient 0.8 diffuse 0.6 }
		} // close looks_like
	rotate 90*x
	translate <-700, -25, 0>
	} // close light_source


Post a reply to this message

From: Y Tanabe
Subject: Re: Apparent Error in Cylindrical Pigment Map
Date: 4 Nov 2000 20:10:30
Message: <3A04B39B.3196ABD7@kh.rim.or.jp>
Dear

How about this is O.K. or NOT ?

                        color_map
                        {
                            [0.0 0.1 color Blue color Blue]
                            [0.9 1.0 color Yellow color Yellow]
                        } // close color_map

Y.Tanabe
Kobe,Japan


Dawn McKnight wrote:

> So, I'm working on this object.  I won't bore you by telling you what it
> is, or what I'm using it for, or like that, but I will say that I'm
> trying to get a smooth color gradient between the edge and the center,
> which is to say, I need it to be a gradient in both x and z directions,
> constant as per y.
>
> Which sounds like a cylindrical pigment type, to me.  I read the
> documentation, page 262, first paragraph, which says "It starts at 1.0
> at the origin and increases to a maximum [sic] value of 0.0 as it
> approaches a distance of 1 unit from the Y axis.  It remains at 0.0 for
> all areas beyond that distance."
>
> So, if I understand this correctly, if I set a color_map with an entry
> of color Blue at 1.0, and color Yellow at 0.0, I should get a
> cylindrical pattern where the edge is yellow, and the center is blue,
> and in between is interpolated shading... in other words, various shades
> of green.
>
> Well, I don't need a one unit cylindrical pattern... I need one that's
> scaled to an ellipse of about 300x125 units.  So I do the scaling, and
> translate the origin of the pattern to where I need it to be... and...
> Huh.  that's weird.  Instead of interpolated colors, I get an oval of
> blue, with a sharp-edge delineation where it becomes abruptly yellow.
>
> Also, it seems to actually start with 0.0 at the origin, and increase to
> 1.0, in contradiction to the documentation.
>
> Also, if I put in more than two colors, most of the color entries
> disappear... only the lowest value color, and the highest value color, appear.
>
> My code follows, so you can see for yourself what happens when it
> renders.  If someone could confirm for me that this is a bug, or
> alternately, point out to me where I'm making my mistake, I'd be grateful.
>
> /*
> // Persistence of Vision Ray Tracer Scene Description File
> // File: bussard.pov
> // Vers: 3.1
> // Desc: bussard collector for the front of the nacelle
> // Date: 30 Oct '00
> // Last: 4 Nov '00
> // Auth: Dawn McKnight
> */
>
> background { color Black }
>
> light_source { <300, 50, 300> color White }
>
> camera {
>         location <-500, 0, -400>
>         look_at <-500, 0, 0>
>         } // close camera
>
> #local Bus1 = intersection {
>
> prism {
>         quadratic_spline
>         linear_sweep
>         -1, // height 1
>         1, // height 2.. this is just for visualization purposes, I'll extend
> it later.
>         6, // number of control points
>         <200, 100>, <400, -25>, <185, -135>, <0, -25>, <200, 100>, <400, -25>
>         } // close prism
>
>         box {
>                 <214, -2, 120>,
>                 <-10, 2, -25>
>                 } // close box
>
>         } // close intersection
>
>
> #local Bus2 = merge {
>         object { Bus1 }
>         object { Bus1 rotate 180*x translate -49.99*z }
>         } // close merge
>
> #local BusCap = intersection {
>         lathe {
>                 quadratic_spline
>                 4,
>                 <-110, 185>, <0, 0>, <125, 200>, <0, 400>
>                 sturm
>                 //rotate 90*z
>                 } // close lathe
>
>         box {
>                 <-130, -10, -130>,
>                 <130, 214, 0>
>                 } // close box
>
>         } // close intersection
>
> #local BussCut = union {
>         object { Bus2 scale 25*y rotate 90*x rotate 90*z translate 25*x}
>         object { BusCap translate -25*z }
>         object { BusCap rotate 180*y translate 25*z }
>         } // close merge
>
> #local BusShape = merge {
>         object { BussCut }
>         box { <-125, 213.9, -25>, <125, 314, 25> }
>         cylinder { <0, 213.9, -25>, <0, 314, -25>, 125 }
>         cylinder { <0, 213.9, 25>, <0, 314, 25>, 125 }
>         } // close union
>
> light_source {
>         <0, 0, 0>
>         color White
>         looks_like {
>                 BusShape
>                 rotate -90*z
>                 pigment {
>                         cylindrical
>                         scale <300, 125, 125>
>                         translate 300*x
>                         color_map {
>                                 [1.0 color Yellow]
>                                 [0.1 color Blue]
>                                 } // close color_map
>                         } // close pigment
>                 finish { ambient 0.8 diffuse 0.6 }
>                 } // close looks_like
>         rotate 90*x
>         translate <-700, -25, 0>
>         } // close light_source


Post a reply to this message

From: Chris Colefax
Subject: Re: Apparent Error in Cylindrical Pigment Map
Date: 4 Nov 2000 21:58:30
Message: <3a04ccd6@news.povray.org>
Dawn McKnight <mck### [at] maccom> wrote:
> So, I'm working on this object.  I won't bore you by telling you what it
> is, or what I'm using it for, or like that, but I will say that I'm
> trying to get a smooth color gradient between the edge and the center,
> which is to say, I need it to be a gradient in both x and z directions,
> constant as per y.
[snip]
> color_map {
> [1.0 color Yellow]
> [0.1 color Blue]
[snip]

The problem is with your colour map, as quoted above.  Although, as the docs
state, the colours 'start' at the origin with a colour map index of 1,
progressing to the edge of the cylinder with a colour map index of 0, colour
maps must always be specified in increasing order of indices, e.g.:

   color_map {[0.1 color Blue] [1 color Yellow]}

Using this, you should get the colour interpolation you expect.  All in all,
it's probably best to think of the colour map moving *inward* from the
outside edge to the centre axis of the cylinder, rather than vice versa.


Post a reply to this message

From: Dawn McKnight
Subject: Re: Apparent Error in Cylindrical Pigment Map
Date: 5 Nov 2000 01:13:19
Message: <3A04FA80.412B9E13@mac.com>
Wow!

Thank you so much, Chris!  Amazing what difference a minor error like
that will make!  Your suggested revision in my code did in fact clear
the problem right up.  You're my hero!


Post a reply to this message

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