POV-Ray : Newsgroups : povray.advanced-users : Volume-preserving blob : Re: Volume-preserving blob Server Time
29 Jul 2024 12:24:33 EDT (-0400)
  Re: Volume-preserving blob  
From: Christopher James Huff
Date: 13 Oct 2002 22:31:24
Message: <chrishuff-932032.22255513102002@netplex.aussie.org>
In article <3DA99C87.2980A601@dcs.gla.ac.uk>,
 John Williamson <wil### [at] dcsglaacuk> wrote:

> That's true, but I think the gradient can be easily _evaluated_ at 
> any point even in a mixture, so it may still be of help (i.e we don't 
> have to approximate the gradient numerically -- doesn't the current 
> iso code need to do something like this?)

Hmm, I'm not sure...


> That's a real problem with using exp, although the influence is 
> effectively bounded since the drop-off is pretty sharp -- cutting off 
> after n standard deviations from the center is an option. 

I did something similar with my glow patch, it was hard to get the 
radius large enough to make the cutoff invisible and small enough to be 
useful for bounding. It was still of use there because it resembled a 
lens flare with sharp edges, but that doesn't apply to blobs.


> > Ken Perlin recently updated his perlin noise algorithm with a new
> > polynomial S-curve function that eliminated second-derivative
> > discontinuities, maybe that could be of some use as a bounded function...
> 
> Do you have any details of this? Sounds quite interesting...

The new polynomial is "1 - r*r*(3 - 2*r)".

Here are some tests I've done. The new polynomial is "fn_scurve", but 
seems to cause some odd bulges. fn_gauss is yours, fn_oldblob is an 
isosurface implementation of the function used in the blob primitive, 
and fn_cos is a cosine function that seems to work pretty well. There 
are other differences between the results, but I don't have time to 
adjust them further.

#declare fn_gauss = function (x, y, z, r) {1.0 - exp(-(x*x + z*z + 
y*y)/r)}

#declare scurve = function (r) {1 - r*r*(3 - 2*r)}
#declare fn_scurve = function (x, y, z, r) {scurve(min(1, sqrt(x*x + z*z 
+ y*y)/r))}

#declare oldblob = function (r) {pow(1 - r*r, 2)}
#declare fn_oldblob = function (x, y, z, r) {oldblob(min(1, sqrt(x*x + 
z*z + y*y)/r))}

#declare fn_cos = function (x, y, z, r) {cos(min(1, sqrt(x*x + z*z + 
y*y)/r)*pi)*0.5 + 0.5}

#declare fn_blob =
function (x, y, z) {
/*  (fn_gauss(x - 1, y, z, 1.75)
    +fn_gauss(x + 1, y, z, 1.75)
    +fn_gauss(x, y - 1.7, z, 1.75))/2*/
    
/*   fn_oldblob(x - 1, y, z, 1.75)
    +fn_oldblob(x + 1, y, z, 1.75)
    +fn_oldblob(x, y - 1.7, z, 1.75)*/
    
/*   fn_scurve(x - 1, y, z, 1.75)
    +fn_scurve(x + 1, y, z, 1.75)
    +fn_scurve(x, y - 1.7, z, 1.75)*/
    
     fn_cos(x - 1, y, z, 1.75)
    +fn_cos(x + 1, y, z, 1.75)
    +fn_cos(x, y - 1.7, z, 1.75)
}

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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