POV-Ray : Newsgroups : povray.general : Insignia in POV-ray : Re: Insignia in POV-ray Server Time
26 Apr 2024 03:51:27 EDT (-0400)
  Re: Insignia in POV-ray  
From: Jeff Lee
Date: 27 Apr 1998 13:52:46
Message: <6i2fnh$34j$1@oz.aussie.org>
Chris Jeppesen <chr### [at] digiquillcom> wrote:
>
> I'm working on a Saturn 5 model, and I'm trying to paint the insignia on
> it. USA, Flags, etc. 
>
> I was wondring if there is a way to model these markings in CSG, instead
> of using an image_map. 
>
> What I was thinking is a "texture intersection." Imagine a cylinder and
> a box overlapping in space. Only show the cylinder, but color it white
> on points outside the box, and red inside.

That is possible to do, but it takes a bit of work.

For example, say I have a 10-unit-tall white cylinder, of radius 2, and
I want to put a 1-by-1 red square about 1/4 of the way from the top end
(but only on one "side" of the cylinder):

  // CylSquar.pov
  //
  #declare C_Cyl_Square = colour rgb <1,0,0> // the red square
  #declare C_Cyl_Rest   = colour rgb <1,1,1> // the white surrounding it

  #declare P_Cyl_Y = pigment { gradient y
    colour_map {
      [0.70 C_Cyl_Rest]   // 0.00 through 0.70 (0.75 minus half the
      [0.70 C_Cyl_Square] //  square's height) is white
      [0.80 C_Cyl_Square] // 0.70 through 0.80 is red
      [0.80 C_Cyl_Rest]   // 0.80 through 1.00 is white again.
    }
  }

  #declare P_Cyl_X = pigment { gradient x
    pigment_map {
      [0.25 P_Cyl_Y]     // Taking advantage of the symmetry of the
      [0.25 C_Cyl_Rest]  //  X gradient here.
    }
  }

  #declare P_Cylinder = pigment { gradient z
    pigment_map {
      [0.50 P_Cyl_X]     // Now we ensure that the square appears on
      [0.50 C_Cyl_Rest]  //  only one side of the cylinder, rather than
    }                    //  going all the way through.
    translate <0,-0.5,-0.5>  // Centre the pigment on where the cylinder
    scale <2,10,4>           //  will be, and scale it appropriately.
  }

  cylinder { <0,-5,0>, <0,5,0>, 2 pigment { P_Cylinder }}
  camera { location <0,0,-20> look_at <0,0,0> }
  light_source { <-100,100,-200> colour rgb <1,1,1> }

That's a lot of work for a simple square, but you could easily use that
sort of thing to produce the black-and-white markings on the Saturn V
(the radial pattern will be quite helpful for that, in places).

Things like the "USA" are certainly possible to do, though it will be an
extremely laborious process.  The stars on the flag will be a headache,
too, but the stripes and field are fairly easy:

  // FlagTest.pov
  //
  #declare C_Flag_Red   = colour rgb <1,0,0>
  #declare C_Flag_White = colour rgb <1,1,1>
  #declare C_Flag_Blue  = colour rgb <0,0,0.75>

  #declare P_Flag_Stripes = pigment { gradient y
    colour_map {
      [ 0/13 C_Flag_Red]   [ 1/13 C_Flag_Red]
      [ 1/13 C_Flag_White] [ 2/13 C_Flag_White]
      [ 2/13 C_Flag_Red]   [ 3/13 C_Flag_Red]
      [ 3/13 C_Flag_White] [ 4/13 C_Flag_White]
      [ 4/13 C_Flag_Red]   [ 5/13 C_Flag_Red]
      [ 5/13 C_Flag_White] [ 6/13 C_Flag_White]
      [ 6/13 C_Flag_Red]   [ 7/13 C_Flag_Red]
      [ 7/13 C_Flag_White] [ 8/13 C_Flag_White]
      [ 8/13 C_Flag_Red]   [ 9/13 C_Flag_Red]
      [ 9/13 C_Flag_White] [10/13 C_Flag_White]
      [10/13 C_Flag_Red]   [11/13 C_Flag_Red]
      [11/13 C_Flag_White] [12/13 C_Flag_White]
      [12/13 C_Flag_Red]   [13/13 C_Flag_Red]
    }
  }

  #declare P_Flag_FieldX = pigment { gradient x
    pigment_map {
      [0.45 C_Flag_Blue]
      [0.45 P_Flag_Stripes]
    }
  }

  #declare P_Flag_FieldY = pigment { gradient y
    pigment_map {
      [6/13 P_Flag_Stripes]
      [6/13 P_Flag_FieldX]
    }
  }

  box {0,1 pigment { P_Flag_FieldY } translate -0.5 scale <1.75,1,0.01>}
  camera { location <0,0,-2> look_at <0,0,0> }
  light_source { <-100,100,-200> colour rgb <1,1,1> }

Hope this helps!


-- 
Jeff Lee         shi### [at] gatenet         http://www.gate.net/~shipbrk/


Post a reply to this message

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