POV-Ray : Newsgroups : povray.newusers : Emitting media : Emitting media Server Time
19 Apr 2024 06:38:30 EDT (-0400)
  Emitting media  
From: Loren
Date: 31 Aug 2017 19:00:01
Message: <web.59a894a889ceac4b1d4ddc70@news.povray.org>
Hello,

I'm having great difficult getting emitting media (glowing red media, as in a
laser), in my scenes. First, a simple example which doesn't work:


-------------
// #include "shapes.inc"
// #include "colors.inc"
//
// camera {
// location 10
// look_at 0
//  angle 45
// }
// light_source { 10
//  color rgb<1, 1, 1> }
// sphere { 0, 1 color rgb<1,0,0> }

#include "colors.inc"

background { color White }

camera {
  location <0, 2, -3>
  look_at <0, 1, 2>
}

sphere {
  <0, 1, 2>, 2
  texture {
    pigment { color rgbf 1 }
  }
  hollow
  interior{
       media{ emission Red intervals 30 samples 100,100 }
  }
}

light_source { <2, 4, -3> color White}

-------------

even though it does work without the "media". What I'd really like to do is add
a red laser to the following scene, but all I get is a hollow tube. I've tried
both emitting and scattering media with no success. See especially the cylinder
that I've marked with a [+].  Please help me,

-------------
// This work is licensed under the Creative Commons Attribution 3.0 Unported
License.
// To view a copy of this license, visit
http://creativecommons.org/licenses/by/3.0/
// or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain
View,
// California, 94041, USA.

// Persistence Of Vision raytracer sample file.
// Utah Teapot w/ Bezier patches
// adapted by Alexander Enzmann
//
// -w320 -h240
// -w800 -h600 +a0.3

// Updated: 09Aug2008 (jh) for v3.7 distribution
// Updated: 28Sep2008 (cjc): change texture, checker color, background color.

#version 3.6;

global_settings {
  assumed_gamma 1.0
  photons {
      spacing 0.2
      autostop 1
      media 60
      max_trace_level 6
  }
}

#include "shapes.inc"
#include "shapesq.inc"
#include "colors.inc"
#include "textures.inc"
#include "metals.inc"

#declare Use_Photons = yes;

#declare Teapot_Texture = T_Chrome_5E;
#declare Teapot_Orientation = <260., 0., 0.>;

#include "teapot.inc"

camera {
   location  <0.0, 0.0, -10.0>
   angle 95 // direction <0.0, 0.0,  1.0>
   up        <0.0, 1.5,  0.0>
   right x*image_width/image_height
}

light_source { 0.25*<10.0, 40.0, -30.0> colour White media_interaction on}
//light_source { <-5.0, -5.0, -5.0> colour White media_interaction on}

object{teapot translate -7.95*y-4*x}

/* Floor */
plane {
   y, -8

   texture {
      pigment {
          color red 0.9822 green 0.9015 blue 0.7695
         scale 5
      }
   }
}

/* Back wall */
 plane {
    z, 100
    hollow on
    texture { pigment { color red 0.9903 green 0.9618 blue 0.9584 } }
}

/* Scattering media */
#declare M1 = <-0.5, -5.25, 0.5>;
light_source { M1+5*y
               color rgb <1.,0.,0.> // ,0.3>
               cylinder
               // spotlight
               point_at M1
               radius 0.5
               falloff 0.5
               tightness 0 }
//box{
//    M1 - 2*(x+y+z), M1 + 2*(x+y+z)
//    pigment {rgbt <0.,0.4,0.4,0.9> } hollow
//    interior
//    { media
//        { scattering { 1, rgb <0.1,0.1,0.1> extinction 0.9 }
//            samples 300, 1000
//        }
//    }
//}
[+] cylinder{ M1+5*y, M1, 0.1 pigment {rgbf 1} hollow // texture { pigment {
color red 1.0 green 0.0 blue 0.0 } finish { ambient 1.0 } }
    interior
    { media { emission <1.0,0.0,0.0>*72000 samples 5000,5000 } }
    //{ media { scattering {1, rgb <1,0,0> extinction 0.01 } } }
}

/* Molecule */
//#declare M1 = <13., 11., -2.>;
object {molecule
           scale 0.25 translate M1}


// light_source { <0,0,0> color rgb <1.,0.,0.> cylinder point_at <5,5,5> radius
10 falloff 10 tightness 0 photons {reflection on} }

#declare TRAN = <1., 1., 3.>*0.5;
#declare RS = seed(1069);
//sphere {<0,0,0>, 1. texture{ pigment{ color Yellow }} translate M1} //rgb
<51.,28.,88.>/256.}}}
//sphere {<0,0,0>, 1. texture{ pigment{ color Yellow }} translate M1+TRAN} //rgb
<51.,28.,88.>/256.}}}
union{
#for (cntr, 0, 2)
     #declare randv = (<rand(RS), rand(RS), rand(RS)>-0.5)*8;
     #declare randrot = <rand(RS), rand(RS), rand(RS)>*360.;
     object {molecule rotate randrot translate randv}
#end
    scale 0.15 translate M1 + <1., 1., -1.>*2
}

#declare TRAN = M1*10-z*2;
#declare RS = seed(1069);
//sphere {<0,0,0>, 1. texture{ pigment{ color Yellow }} translate M1} //rgb
<51.,28.,88.>/256.}}}
//sphere {<0,0,0>, 1. texture{ pigment{ color Yellow }} translate M1+TRAN} //rgb
<51.,28.,88.>/256.}}}
union{
#for (cntr, 0, 9)
     #declare randv = (<rand(RS), rand(RS), rand(RS)>-0.5)*8.;
     #declare randrot = <rand(RS), rand(RS), rand(RS)>*360.;
     object {molecule rotate randrot translate randv}
#end
    scale 0.10 translate M1 + <1., 1., -1.>*3.5
}

#declare debugin = false;

#declare My_Water = material {
  texture {
    pigment{ rgbf <0.9, 0.95, 1.0, 0.7> }
    normal {
      ripples 0.5
      frequency 5
    }
    finish {
        reflection {0.5, 1 fresnel}
        conserve_energy
    }
  }
  interior { ior 1.33 }
}

//make close drops
// #declare r1=seed(19873445);
// #declare  i = 200;
// #while (i < 550)
//   sphere{
//     <-500*rand(r1)+250,-300*rand(r1)+300+10,450*rand(r1)+20>,4.5*rand(r1)+1
//     #if (debugin = false)
//       material{My_Water scale 4*rand(r1)+3 rotate<360*rand(r1),
// 360*rand(r1), 360*rand(r1)>}
//     #else
//       //must use random numbers so sequency will stay same as when not
// debugin
//       #declare dummy1=rand(r1);
//       #declare dummy2=rand(r1);
//       #declare dummy3=rand(r1);
//       #declare dummy4=rand(r1);
//       pigment{Blue}
//     #end
//     translate z-30
//     rotate x*40
//   }
//   #declare i = i + 1;
// #end

#declare drop = quartic{ <
      0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0,
          -1, 2, 0, -2, 1> }

object{ drop material{My_Water scale 1.0 rotate 22.0} scale 0.25 rotate -90*x
translate M1 + <1., 1., -1.>*5}

-------------------------


Post a reply to this message

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