POV-Ray : Newsgroups : povray.pov4.discussion.general : Feature request: "resolution" keyword for gradients and maps Server Time
24 Nov 2024 07:31:32 EST (-0500)
  Feature request: "resolution" keyword for gradients and maps (Message 1 to 7 of 7)  
From: SharkD
Subject: Feature request: "resolution" keyword for gradients and maps
Date: 22 Jun 2008 15:05:00
Message: <web.485ea1dafacb78e423ce54f40@news.povray.org>
I would like to request the addition of a "resolution" keyword for gradients and
maps. This keyword would be used to create steps in a gradient so that one
doesn't necessarily have to interpolate it smoothly.

I know this can be done manually by inserting additional steps, but it is a
chore to do.

-Mike


Post a reply to this message

From: Warp
Subject: Re: Feature request: "resolution" keyword for gradients and maps
Date: 22 Jun 2008 15:24:19
Message: <485ea6e2@news.povray.org>
SharkD <nomail@nomail> wrote:
> I would like to request the addition of a "resolution" keyword for gradients and
> maps. This keyword would be used to create steps in a gradient so that one
> doesn't necessarily have to interpolate it smoothly.

  This can already be done by putting your pattern in a function, and
then creating a second function which calls that function and returns
the value stepped in the way you want (by appropriately using
multiplication, int() and division).

-- 
                                                          - Warp


Post a reply to this message

From: SharkD
Subject: Re: Feature request: "resolution" keyword for gradients and maps
Date: 22 Jun 2008 17:40:02
Message: <web.485ec6a79d0a8abb23ce54f40@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> SharkD <nomail@nomail> wrote:
> > I would like to request the addition of a "resolution" keyword for gradients and
> > maps. This keyword would be used to create steps in a gradient so that one
> > doesn't necessarily have to interpolate it smoothly.
>
>   This can already be done by putting your pattern in a function, and
> then creating a second function which calls that function and returns
> the value stepped in the way you want (by appropriately using
> multiplication, int() and division).
>
> --
>                                                           - Warp

Could you please post an example? Especially about the function referencing
another function part. Functions and related objects are confusing to me.

-Mike


Post a reply to this message

From: Warp
Subject: Re: Feature request: "resolution" keyword for gradients and maps
Date: 22 Jun 2008 18:47:45
Message: <485ed691@news.povray.org>
SharkD <nomail@nomail> wrote:
> Could you please post an example?

#default { finish { ambient 1 } }
background { rgb z*.5 }
camera { location <0, 0, -10> look_at 0 angle 35 }

#declare ThePattern = function { pattern { gradient y } };
#declare SteppedPattern = function { int(10*ThePattern(x, y, z))/10 };

// Original pattern:
box
{ <-1, -2, 0>, <1, 2, .1>
  pigment
  { function { ThePattern(x, y, z) }
    color_map { [0 rgb 0][1 rgb 1] }
  }
  translate -x*1.1
}

// Stepped pattern:
box
{ <-1, -2, 0>, <1, 2, .1>
  pigment
  { function { SteppedPattern(x, y, z) }
    color_map { [0 rgb 0][1 rgb 1] }
  }
  translate x*1.1
}


-- 
                                                          - Warp


Post a reply to this message

From: SharkD
Subject: Re: Feature request: "resolution" keyword for gradients and maps
Date: 22 Jun 2008 19:30:01
Message: <web.485edfcf9d0a8abb23ce54f40@news.povray.org>
Thank you very much, it is clear to me now.

-Mike


Post a reply to this message

From: SharkD
Subject: Re: Feature request: "resolution" keyword for gradients and maps
Date: 23 Jun 2008 22:25:01
Message: <web.48605a1a9d0a8abb1729cc4e0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> SharkD <nomail@nomail> wrote:
> > Could you please post an example?
>
> #default { finish { ambient 1 } }
> background { rgb z*.5 }
> camera { location <0, 0, -10> look_at 0 angle 35 }
>
> #declare ThePattern = function { pattern { gradient y } };
> #declare SteppedPattern = function { int(10*ThePattern(x, y, z))/10 };
>
> // Original pattern:
> box
> { <-1, -2, 0>, <1, 2, .1>
>   pigment
>   { function { ThePattern(x, y, z) }
>     color_map { [0 rgb 0][1 rgb 1] }
>   }
>   translate -x*1.1
> }
>
> // Stepped pattern:
> box
> { <-1, -2, 0>, <1, 2, .1>
>   pigment
>   { function { SteppedPattern(x, y, z) }
>     color_map { [0 rgb 0][1 rgb 1] }
>   }
>   translate x*1.1
> }
>
>
> --
>                                                           - Warp

Thanks for the response! I turned your suggestion into a wiki article so that
others may benefit from it.

http://wiki.povray.org/content/HowTo:Turn_a_function_into_a_stepped_function

-Mike


Post a reply to this message

From: Warp
Subject: Re: Feature request: "resolution" keyword for gradients and maps
Date: 24 Jun 2008 08:53:39
Message: <4860ee53@news.povray.org>
SharkD <nomail@nomail> wrote:
> http://wiki.povray.org/content/HowTo:Turn_a_function_into_a_stepped_function

  One small error: int() doesn't round the value to the nearest integer.
It simply drops the decimal part of the value.

  If you want to round, you have to say int(theValueToBeRounded + .5).
(Although one should note that this works correctly only for positive
values. OTOH, pattern values are always positive.)

-- 
                                                          - Warp


Post a reply to this message

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