POV-Ray : Newsgroups : povray.programming : Clipping Gradient Z Server Time
28 Jul 2024 16:15:31 EDT (-0400)
  Clipping Gradient Z (Message 1 to 3 of 3)  
From: dan
Subject: Clipping Gradient Z
Date: 16 Aug 2000 10:13:10
Message: <399aa176@news.povray.org>
Explanation:  to generate realistic range images I need to create a Z based
pigment using the 'gradient' pigment modifier.

Problem:   'gradient' wraps from 0 to 1 continuously based upon a modulo
operation on Z, i.e. 'gradient' = fmod(z,1.0) where fmod = "floating point
remainder" in VC6++   (see pattern.c, void gradient for more details)

Question:   how do I force or modify gradient z so that it is valid only
from   0<Z<1 and gradient z = 0 otherwise?  If we can answer this question,
then creating random dot stereograms and producing other such range imagery
will become faster and more realistic using povray.  My only alternative at
this point is to clip the scene, which causes a 10X increase in compute
time.

#declare DepthMapTexture = texture {
  pigment {
      gradient z        // this little fellow keeps wrapping around with
increased z, i want to make him
      color_map {   // stop wrapping and return 0 when z > 1 and z < 0.
        [0.0 color Black]
        [1.0 color Red] }
      scale 40
  }
  finish{ambient 1.0 diffuse 0.0}
}

Many Thanks! dan


Post a reply to this message

From: Chris Huff
Subject: Re: Clipping Gradient Z
Date: 16 Aug 2000 11:09:33
Message: <chrishuff-25573C.10104616082000@news.povray.org>
In article <399aa176@news.povray.org>, "dan" 
<dan### [at] snwpafbafmil> wrote:

> Explanation:  to generate realistic range images I need to create a Z 
> based pigment using the 'gradient' pigment modifier.

Why not just use the MegaPOV "depth" post_process filter?


> Question:   how do I force or modify gradient z so that it is valid 
> only from   0<Z<1 and gradient z = 0 otherwise?  If we can answer 
> this question, then creating random dot stereograms and producing 
> other such range imagery will become faster and more realistic using 
> povray.  My only alternative at this point is to clip the scene, 
> which causes a 10X increase in compute time.

You could use a function (in MegaPOV) specifying the blend you want, 
clipping it to the correct range. If your entire scene is to be 
contained within the range of the depth buffer, then you can simply 
scale the gradient up to fit the scene.

-- 
Christopher James Huff - Personal e-mail: chr### [at] maccom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://homepage.mac.com/chrishuff/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: PoD
Subject: Re: Clipping Gradient Z
Date: 16 Aug 2000 13:45:56
Message: <399AD353.8C0637EF@merlin.net.au>
dan wrote:
> 
> Explanation:  to generate realistic range images I need to create a Z based
> pigment using the 'gradient' pigment modifier.
> 
> Problem:   'gradient' wraps from 0 to 1 continuously based upon a modulo
> operation on Z, i.e. 'gradient' = fmod(z,1.0) where fmod = "floating point
> remainder" in VC6++   (see pattern.c, void gradient for more details)
> 
> Question:   how do I force or modify gradient z so that it is valid only
> from   0<Z<1 and gradient z = 0 otherwise?  If we can answer this question,
> then creating random dot stereograms and producing other such range imagery
> will become faster and more realistic using povray.  My only alternative at
> this point is to clip the scene, which causes a 10X increase in compute
> time.
> 
> #declare DepthMapTexture = texture {
>   pigment {
>       gradient z        // this little fellow keeps wrapping around with
> increased z, i want to make him
>       color_map {   // stop wrapping and return 0 when z > 1 and z < 0.
>         [0.0 color Black]
>         [1.0 color Red] }
>       scale 40
>   }
>   finish{ambient 1.0 diffuse 0.0}
> }
> 
> Many Thanks! dan

Does 'planar' do what you want?

PoD


Post a reply to this message

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