|
![](/i/fill.gif) |
Thank you!
This works quite well, just a little fudging with the epsilon value is all
that is needed.
:-D
"triple_r" <nomail@nomail> wrote in message
news:web.497e0741a7c34478ef2b9ba40@news.povray.org...
> "[GDS|Entropy]" <gds### [at] hotmail com> wrote:
>> I've never used the trace function, or vlength...you wouldn't happen to
>> have
>> a link to an example would you?
>
> Here's an example. It should be pretty self-explanatory. Six glows are
> drawn,
> one on each face of a cube, and three are blocked.
>
> - Ricky
>
>
>
>
>
> #version unofficial megapov 1.21;
> #declare s = seed(123501);
>
> // MACRO
>
> /* Test whether a ray starting at start_pt and
> * ending at target_pt hits test_obj before it
> * gets there. Returns either true if it reaches
> * it or false otherwise. Add an extra epsilon
> * so that conindident points ARE drawn. */
> #macro test_ray( start_pt, target_pt, test_obj )
> #local epsilon = 1.0e-10;
> #local nrml = <0,0,0>;
> #local direc = target_pt - start_pt;
> #local intersec = trace( test_obj, start_pt, direc, nrml );
> !(vlength(nrml) > 0 & vlength(direc) >
> vlength(intersec-start_pt)+epsilon)
> #end
>
> // SCENE
>
> // Light/camera
> light_source{ <15,25,-20> rgb 0.2 }
> #declare cam_pt = <2.5,3.0,-3.5>;
> camera{
> location cam_pt
> look_at 0
> }
>
> #macro draw_glow( pt, cam_pt, test_obj )
> #if(test_ray(cam_pt, pt, test_obj))
> glow{
> type 0
> location pt
> size 0.05
> radius 1.0
> fade_power 2
> color rgb vnormalize(<rand(s),rand(s),rand(s)>)
> }
> #end
> #end
>
> // Draw the objects
> #declare thing = box{-1,1}
> draw_glow( x, cam_pt, thing )
> draw_glow( -x, cam_pt, thing )
> draw_glow( y, cam_pt, thing )
> draw_glow( -y, cam_pt, thing )
> draw_glow( z, cam_pt, thing )
> draw_glow( -z, cam_pt, thing )
> object{ thing pigment{rgb 1} }
>
>
>
>
>
>
Post a reply to this message
|
![](/i/fill.gif) |