POV-Ray : Newsgroups : povray.general : custom blendfunction? : Re: custom blendfunction? Server Time
1 Aug 2024 22:16:22 EDT (-0400)
  Re: custom blendfunction?  
From: Zeger Knaepen
Date: 9 Mar 2005 14:20:07
Message: <422f4c67@news.povray.org>
"Christopher James Huff" <cja### [at] gmailcom> wrote in message
news:cjameshuff-30D709.14105909032005@news.povray.org...
> In article <422f40ab@news.povray.org>,
>  "Zeger Knaepen" <zeg### [at] studentkuleuvenacbe> wrote:
>
> > Is there a way to define a custom blend-function for patterns ?
> > I can't do it with function's, because it's the aoi-pattern which cannot be
> > used inside a function.
>
> Do you mean a custom waveform function? You could imitate doing so by
> applying the inverse of the function to the color map t-values. You may
> have to add entries to the color map to get reasonably correct results,
> though.
>
> One of the patches I recently released allows the aoi pattern to be
> written as a function...though you probably can't wait for that to be
> added to MegaPOV.

not really :)

but I fixed it another way.

In case anyone's interested, here's my solution to my problem.

First the problem :)  I'm trying to simulate media-effects with aoi, as probably
everybody now already knows :)  I also want to make things have a glow-effect.
With media, that's quite easy to simulate:

sphere {0,1 pigment {rgbt 1} interior {media {emission 1 density {spherical
poly_wave 5}}}}

(it's the poly_wave that does the trick)

But with aoi, it's more complicated!  To simulate a simple media-effect using
aoi, you need something like the following:

sphere {0,1 pigment {aoi color_map {[0 rgb 1][.5 rgbt 1]}}}

The color_map is needed because aoi gives 0 when the normal is pointed towards
the camera, .5 when it's perpendicular to the camera and 1 when it's pointing in
the same direction as the camera, so everything between .5 and 1 is of no
importance and should be left out.  However, because of that, poly_wave will not
behave the same way as with media: the .5 in the color_map will 'shift' and will
no longer correspond to normals perpendicular to the camera.

my solution:

sphere {
  0,1
  pigment {
    aoi
    #declare P=.5;
    color_map {
      [0 rgb 1]
      [pow(.5,P) rgbt 1]
    }
    poly_wave P
  }
}

very simple, I just didn't think of it :)

cu!
--
camera{location-z*3}#macro G(b,e)b+(e-b)*(C/50)#end#macro L(b,e,k,l)#local C=0
;#while(C<50)sphere{G(b,e),.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1
;#end#end L(y-x,y,x,x+y)L(y,-x-y,x+y,y)L(-x-y,-y,y,y+z)L(-y,y,y+z,x+y)L(0,x+y,
<.5,1,.5>,x)L(0,x-y,<.5,1,.5>,x)               // ZK http://www.povplace.be.tf


Post a reply to this message

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