POV-Ray : Newsgroups : povray.general : How to create a transparent (invisible) material with scattering media? : Re: How to create a transparent (invisible) material with scattering media? Server Time
15 Jun 2024 16:40:49 EDT (-0400)
  Re: How to create a transparent (invisible) material with scattering media?  
From: Doctor John
Date: 26 Mar 2015 12:53:57
Message: <551439a5$1@news.povray.org>
On 26/03/15 14:46, nomail@nomail wrote:
> Hi,
> 
> I would like to draw laser rays. In my project, they are always in a given
> plane, so I try to add a thin invisible object around this plane, with an
> interior defining scattering. I can visualize the laser rays, and of course, as
> expected, if an object comes in front of it, the ray is stopped by the object.
> But my problem is that I don't find any way for thsi object to be invisible. A
> small piece of code allowing to reproduce my problem is the following. Does
> someone know how I could modify it to make the plane invisible while still
> seeing the rays ?
> 
> #include "colors.inc"
> 
> global_settings {
>     ambient_light rgb < 1 , 1 , 1 >
>     max_trace_level 15
>     photons {
>         count 100000
>         autostop 0
>         jitter .4
>         media 100
>     }
> }
> 
> camera {
>     perspective
>     up < 0 , 0 , 1 >
>     right y * image_width / image_height
>     location < 0 , -20 , 2.5 >
>     look_at < 0 , 0 , 0.8 >
>     angle 40 // horizontal FOV angle
> }
> 
> background { Quartz }
> 
> // a laser ray
> 
> #declare ray_radius = 0.01 ;
> light_source {
>     < 0 , 0 , 0 >
>     color rgb 100 * < 1 , 0 , 0 >
>     cylinder
>     point_at < 1 , 0 , 0 >
>     radius ray_radius
>     falloff ray_radius
>     tightness 0
> }
> 
> // virtual plane needed to observe the laser rays
> 
> #declare dx = 13 ;
> #declare dy = 6 ;
> box {
>     < - dx / 2 , - dy / 2 , - ray_radius > < dx / 2 , dy / 2 , ray_radius >
>     material {
>         texture {
>             pigment { Clear }
>         }
>         interior {
>             media {
>                 scattering {
>                     1 /* isotropic */ , rgb 5 * < 1 , 1 , 1 >
>                 }
>             }
>         }
>     }
>     photons { pass_through }
>     hollow
> }
> 
> 
> 

Try this:
/************Start Code*************/

#version 3.7;

#include "colors.inc"

global_settings {
    assumed_gamma 1
    //ambient_light rgb < 1 , 1 , 1 >
    max_trace_level 15
    photons {
        count 100000
        autostop 0
        jitter .4
        media 100
    }
}

camera {
    perspective
    up < 0 , 0 , 1 >
    right y * image_width / image_height
    location < 0 , -20 , 2.5 >
    look_at < 0 , 0 , 0.8 >
    angle 40 // horizontal FOV angle
}

background { Quartz/4 }

// a laser ray

#declare ray_radius = 0.01 ;
light_source {
    < 0 , 0 , 0 >
    color rgb 100 * < 1 , 0 , 0 >
    cylinder
    point_at < 1 , 0 , 0 >
    radius ray_radius
    falloff ray_radius
    tightness 0
}

// virtual plane needed to observe the laser rays

#declare dx = 13 ;
#declare dy = 6 ;
box {
    < - dx / 2 , - dy / 2 , - ray_radius > < dx / 2 , dy / 2 , ray_radius >
    material {
        texture {
            pigment { Clear }
            finish {ambient 0 diffuse 0}
        }
        interior {
            media {
                scattering {
                    1 /* isotropic */ , rgb < 1 , 1 , 1 >
                    extinction 0.000001
                }
                samples 20, 50
            }
        }
    }
    photons { pass_through }
   hollow
}

/************End Code******************/

I have made a change in your background, killed the global ambient light
and made changes in your box material. I leave it as an exercise for you
to work out why it works ;-)

John
-- 
Protect the Earth
It was not given to you by your parents
You hold it in trust for your children


Post a reply to this message

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