POV-Ray : Newsgroups : povray.binaries.images : Use of Sam Benge's strand utility : Re: Use of Sam Benge's strand utility Server Time
30 Jul 2024 16:15:32 EDT (-0400)
  Re: Use of Sam Benge's strand utility  
From: Samuel Benge
Date: 31 Jan 2012 17:55:01
Message: <web.4f286ff631e146104264af6e0@news.povray.org>
Thanks for the replies, everyone!

Christian Froeschlin <chr### [at] chrfrde> wrote:
> Samuel Benge wrote:
>
> > I took the output from strands.exe and
>
> ... with almost incomprehensible explanation ... ;)

It's what I do ;)

Let me try again... If you've ever taken a look at the vector analysis macros in
math.inc, you'll have an idea how it works. Those macros pretty much allow you
to determine a gradient's normal or even its falloff rate at any point. When
applied to a function, a variety of effects can be achieved. Since it's better
explained as code, here's the basic setup for pushing a pattern away from
itself:

    #declare PixelSize = 1/image_width;
    #declare Accuracy = 2*PixelSize;
    #declare Amount = 8.0;
    FPgmt(
        x+2*Amount*PixelSize*(FPgmt(x+Accuracy,y,0)-FPgmt(x-Accuracy,y,0)),
        y+2*Amount*PixelSize*(FPgmt(x,y+Accuracy,0)-FPgmt(x,y-Accuracy,0)),
        0
    )

As you can imagine, using five samples quickly becomes expensive if applied
again and again to a function in a single render, which is why I iterate over
pre-rendered data instead.

> Did I understand correctly that you used povray animation
> to implement an iterative 2d filter for thickening the strands
> in the height field produces by your strands.exe tool?

Yep. Same thing I've been doing for a while now, but without all the useless
images stealing HD space :D

> > fake subsurface scattering (diffuse-occluding absorbing media)
>
> Sounds interesting, how does it work?

Absorbing media from one object occludes the diffuse reflection of another:

    sphere{
        0, 1
        pigment{rgb 1}
        finish{brilliance 0}
        double_illuminate
        no_shadow
        hollow
    }

    sphere{
        0, 1.001
        pigment{rgbt 1}
        interior{
            media{
                absorption 4
            }
        }
        hollow
    }

It renders very quickly, but generally doesn't look too great unless big
area_lights are used, which obviously doesn't work for all scenes. There's
probably some light_group trickery that would allow for more flexibility, but I
haven't tried anything along those lines yet. It doesn't play well with
radiosity. And there's also the fact that it requires two objects, one shifted
outward from the other. This makes the technique difficult to use for complex
objects :(

> > The water's meniscus
>
> Nice trick ;) Did you compare it to simply rendering the height
> data near the water line as water? I suppose the blurring makes
> it smoother to give a curved appearance.

I think I've tried that before by placing the height data into an object
pigment, putting that into a normal block, and giving it a highish accuracy. But
the effect just wasn't as nice.

> > For both the proximity pattern and blurred height data, I used points
> > created with Fermat's spiral
>
> Is your proximity pattern sampling in 2d? Or do you generate
> points on a sphere for tracing the surface of a 3d object?

It starts with a sharp, black/white plane function. This is displaced using
height data to make a "height field" function. It is then blurred in 2D (using a
2D point set) and reverse-displaced to make it flat once again. A planar warp is
then applied to make it infinite along the z-axis.

I'll be releasing some new proximity patterns soon, and the 2D version will be
among them so you'll be able to see how it works.

Sam


Post a reply to this message

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