POV-Ray : Newsgroups : povray.newusers : Slicing a media object : Slicing a media object Server Time
14 May 2024 15:56:04 EDT (-0400)
  Slicing a media object  
From: IanDean
Date: 22 Sep 2013 15:20:01
Message: <web.523f41c6f5157c2664ac7e00@news.povray.org>
Greetings everyone,

I'm trying to draw a 2D array of light beams (currently implemented as
cylindrical emitting media). I plan on creating several of them in different
directions, then I want to intersect this multi-array with a box, so that I
render only a small portion of it.

My issue is that when intersecting my current single array with a box, the
cylinder ends become black, they don't retain the color of the cylinders if the
box wasn't there. I've tried all combinations of intersection and difference

1) How do I slice the beams, but retain the color at their ends?
2) How can I do this rendering, but with a white background? I don't see
anything when I make it so.
3) Is there a better way  to implement the beams? I really like the "emitting"
look of the cylinders. I might be able to do that solid objects, but I'm not
sure how.

Code is below. Cylinders are in the y direction, 10 units long from 0 to 10. The
box is cutting the beams so they are from 1 to 9 in the y direction.

Appreciate anyone's help,

Ian


//--------------------------------------------------
#include "colors.inc"
#include "functions.inc"

camera {
   location <0,10,10>*3
   rotate y*-45
   rotate z*0
   rotate x*0
   look_at  <0,0,0>
}

light_source {
   <0,50,0>
    rgb <1,1,1>
}


//background{color rgb<1,1,1>}

#declare boxtexture = texture {
   pigment {
      rgbf 1
   }
}


  #declare r_violet1 = color rgbf<1.0, 0.5, 1.0, 1.0>;
  #declare r_violet2 = color rgbf<1.0, 0.5, 1.0, 0.8>;
  #declare r_indigo  = color rgbf<0.5, 0.5, 1.0, 0.8>;
  #declare r_blue    = color rgbf<0.2, 0.2, 1.0, 0.8>;
  #declare r_cyan    = color rgbf<0.2, 1.0, 1.0, 0.8>;
  #declare r_green   = color rgbf<0.2, 1.0, 0.2, 0.8>;
  #declare r_yellow  = color rgbf<1.0, 1.0, 0.2, 0.8>;
  #declare r_orange  = color rgbf<1.0, 0.5, 0.2, 0.8>;
  #declare r_red1    = color rgbf<1.0, 0.2, 0.2, 0.8>;
  #declare r_red2    = color rgbf<1.0, 0.2, 0.2, 1.0>;

#declare boxinterior = interior {
   media {
      intervals 10
      samples 1,20
      emission <1,1,1>
      absorption <0,0,0>
      scattering { 1,<0,0,0> }
      confidence 0.9999
      variance 1/1000
        density { cylindrical
      color_map {
      [0.000  color r_violet1 transmit 0.98]
      [0.100  color r_violet2 transmit 0.96]
      [0.214  color r_indigo  transmit 0.94]
      [0.328  color r_blue    transmit 0.92]
      [0.442  color r_cyan    transmit 0.90]
      [0.556  color r_green   transmit 0.92]
      [0.670  color r_yellow  transmit 0.94]
      [0.784  color r_orange  transmit 0.96]
      [0.900  color r_red1    transmit 0.98]

      }
    }
   }
}


declare length=15;
declare r=1;
declare a=r*4.5;


// CREATE LIGHT BEAM
#declare wg = union {

        cylinder {
        <0,0,0>, <0,10,0>    r
        texture { boxtexture }
        interior { boxinterior }
        hollow
        //rotate<0,0,30>
        }

}

#declare n   = 1;
#declare m   = 1;

// REPEAT BEAM IN THE X DIRECTION
#declare waveguide2D = union
{
        #local j = -n/2;
        #while (j <= n/2)
                object{wg translate<j*a,0,0>}
                #local j = j + 1;
        #end
}

// REPEAT IN THE Z DIRECTION
#declare waveguide3D = union
{
        #local j = -m/2;
        #while (j <= m/2)
                object{waveguide2D translate<0,0,j*a>}
                #local j = j + 1;
        #end
}




// SLICE THE BEAMS USING INTERSECTION WITH A BOX
intersection{
object{waveguide3D rotate<0,0,0>}
box{<-10,1,-10> <10,9,10>}
}

//--------------------------------------------------


Post a reply to this message

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