POV-Ray : Newsgroups : povray.binaries.images : Tracing an object through a soft-edged mask; or objects as airbrush 'spray' : Re: Tracing an object through a soft-edged mask; or objects as airbrush 'spray' Server Time
18 May 2024 11:23:13 EDT (-0400)
  Re: Tracing an object through a soft-edged mask; or objects as airbrush 'spray'  
From: Zeger Knaepen
Date: 13 May 2008 06:13:35
Message: <482969cf$1@news.povray.org>
Cool, but you don't need the height_field, just use eval_pigment.  That way, 
you can use any pigment as a mask

something like this:

--- begin code ---
#include "functions.inc"

#local TraceObject=plane {y,0}

#local Mask=pigment {granite poly_wave 2}
#local Number=100000;
#local Seed=seed(123);
union {
    #while (Number>0)
        //trace from a random value ranging from <-2,..,-2> to <2,..,2>
        #local 
TracePosition=<rand(Seed)-rand(Seed),500,rand(Seed)-rand(Seed)>*<2,1,2>;
        #local Position=trace(TraceObject,TracePosition,-y);

        //Two ways: use the mask as a 2D mask, using only the X and Y values
        #local 
Probability=eval_pigment(Mask,<Position.x,Position.z,0>).gray;
        //or... use it as a 3D mask
        #local Probability=eval_pigment(Mask,Position).gray;

        #if (rand(Seed)<=Probability)
            sphere {
                Position,.01
            }
        #end
        #local Number=Number-1;
    #end
    pigment {red 1}
}
object {TraceObject pigment {rgb 1}}

//camera and light_source
camera {
    location <-3,5,-10>
    look_at 0
}
light_source {
    <500,500,-500>
    rgb 1
}
--- end code ---

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


Post a reply to this message

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