POV-Ray : Newsgroups : povray.newusers : tartan pattern : tartan pattern Server Time
13 May 2024 18:42:06 EDT (-0400)
  tartan pattern  
From: John Greenwood
Date: 7 Mar 2014 06:40:01
Message: <web.5319ae9c1ab50c86a7cafab50@news.povray.org>
The macro below is intended to generate a tartan-type pattern. to start with I
am trying to superimpose two sets of transparent stripes at right angles.

The second set of stripes is superimposed on the background colour as expected
but the first pigment, defining the first set of stripes, seems to have been
overwritten by the second pigment. How do I get them to both superimpose?


#version 3.7 ;
background {color rgb 1/2}
  #include "colors.inc"

global_settings {
    assumed_gamma 1
 max_trace_level 100 }

camera{location <0,0,-10> angle 5 look_at <0,0,0> }
light_source{<0,200,-200> colour White parallel point_at <0,0,0> }

#macro Tartan(Direction,ColourX,ColourY,Width,Pitch)
  texture {
    pigment  {           // first set of stripes
        gradient x
    frequency 100/Pitch
        color_map {
      [0.00 color rgbt ColourX]
      [Width color rgbt ColourX]
      [Width color Clear]
      [1 color Clear]
                  }
             }
    pigment  {          // second set of stripes
        gradient y
    frequency 100/Pitch
        color_map {
      [0.00 color rgbt ColourY]
      [Width color rgbt ColourY]
      [Width color Clear]
      [1 color Clear]
                  }
             }
      normal { bumps 1 scale .001 }
      finish { specular .5 roughness .1}
      rotate Direction*z
          }
#end

#declare Sample  =
#union   {
  sphere {<0,0,0>, .1}
  sphere {<.03,.03,0>, .1}
  pigment {rgb <1,1,1>}  // this sets the background colour
  Tartan(45,<1,0,0,0>,<0,1,0,.5>,.5,2)
         }

object {Sample translate <.13,-.13,0>}
object {Sample translate <0,0,10>}
object {Sample translate <-.25,.25,30>}
object {Sample translate <-.80,.80,70>}


Post a reply to this message

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