POV-Ray : Newsgroups : povray.general : Glows show through objects? : Re: Glows show through objects? Server Time
30 Jul 2024 12:19:55 EDT (-0400)
  Re: Glows show through objects?  
From: [GDS|Entropy]
Date: 26 Jan 2009 16:09:54
Message: <497e26a2$1@news.povray.org>
Thank you!
That does illustrate the concept quite effectively.

Now my only task is to make that idea work with objects which are unioned 
with glows in one loop and then translated via a second loop to different 
positions.

:-D

Ian

"triple_r" <nomail@nomail> wrote in message 
news:web.497e0741a7c34478ef2b9ba40@news.povray.org...
> "[GDS|Entropy]" <gds### [at] hotmailcom> 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

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