POV-Ray : Newsgroups : povray.general : How to create a transparent (invisible) material with scattering media? Server Time
26 Dec 2024 11:40:00 EST (-0500)
  How to create a transparent (invisible) material with scattering media? (Message 1 to 5 of 5)  
From:
Subject: How to create a transparent (invisible) material with scattering media?
Date: 26 Mar 2015 10:50:00
Message: <web.55141bd1be156284dcf99f670@news.povray.org>
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
}


Post a reply to this message

From: Doctor John
Subject: Re: How to create a transparent (invisible) material with scattering media?
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

From: Doctor John
Subject: Re: How to create a transparent (invisible) material with scatteringmedia?
Date: 26 Mar 2015 12:59:11
Message: <55143adf@news.povray.org>
Additional: I assume you need the photon block and keywords for later
development, because right now they're not doing anything

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

From: Alain
Subject: Re: How to create a transparent (invisible) material with scattering media?
Date: 26 Mar 2015 19:16:34
Message: <55149352$1@news.povray.org>

> 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 ?
>

My take:

#include "colors.inc"

global_settings {
     max_trace_level 15
     photons {// I prefer using spacing, but count is OK
         count 100000
         autostop 0
         jitter .4
         //media 100 no longer needed
     }
}

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 }// Not needed

// a laser ray

#declare ray_radius = 0.01 ;
light_source {
     < 100 , 0 , 0.01 > // far to the right
     color rgb 100 * < 1 , 0 , 0 >
     parallel
     point_at < 0 , 0 , 0 > //and going very slightly down
projected_through{cylinder{100*z, -100*z, 0.02}}
// realy a plane of light

}

// A real plane to show the beam
plane{z 0 pigment{rgb 1}
	finish{brilliance 0 ambient 0} // This is the "magic" part !
}

// place the opticaly active objects here

// End of code


This work best when the camera is directly above the plane. It also only 
work when you are realy only working in 2D. If the light need to be 
represented in 3D, then, you realy need to use media.


Alain


Post a reply to this message

From:
Subject: Re: How to create a transparent (invisible) material with scattering media?
Date: 1 Apr 2015 05:55:00
Message: <web.551bbfc13478a96bdcf99f670@news.povray.org>
Thank you very much to both of you !


Post a reply to this message

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