POV-Ray : Newsgroups : povray.newusers : adding 2 pigments : Re: adding 2 pigments Server Time
4 Nov 2024 19:18:03 EST (-0500)
  Re: adding 2 pigments  
From: Elias Pschernig
Date: 12 Oct 2001 09:57:37
Message: <3bc6f6d1$1@news.povray.org>
> You can add, subtract, divide and multiply pigment vectors the same as any
> other vector:
> 
> rgb <1,1,1>*5
> rgb <1,0,0>+<1,1,0>
> rgb <1,1,1>*<1,2,1>
> ....etc.

Yes, vectors, but not pigments. Not even pigment functions. By now I think I
already have the simplest solution for what I want to do, but it is very
complicated:

(All it does is adding two pigments)

#declare PigmentFunction1 = function { pigment { InputPigment1 } }
#declare PigmentFunction2 = function { pigment { InputPigment2 } }

#declare PatternRed1 =  function { pattern { function { PigmentFunction1(x, y, z).x }
} }  
#declare PatternGreen1 =  function { pattern { function { PigmentFunction1(x, y, z).y
} } }
#declare PatternBlue1 = function { pattern { function { PigmentFunction1(x, y, z).z }
} }
#declare PatternAlpha1 = function { pattern { function { PigmentFunction1(x, y, z).t }
} }

#declare PatternRed2 = function { pattern { function { PigmentFunction2(x, y, z).x } }
}
#declare PatternGreen2 = function { pattern { function { PigmentFunction2(x, y, z).y }
} }
#declare PatternBlue2 = function { pattern { function { PigmentFunction2(x, y, z).z }
} }
#declare PatternAlpha2 = function { pattern { function { PigmentFunction2(x, y, z).t }
} }
              
#declare PatternRed = function {
   PatternRed1(x, y, z) + PatternRed2(x, y, z)
}   

#declare PatternGreen = function {
   PatternGreen1(x, y, z) + PatternGreen2(x, y, z)
}   

#declare PatternBlue = function {
   PatternBlue1(x, y, z) + PatternBlue2(x, y, z)
}                   

#declare PatternAlpha = function {
   PatternAlpha1(x, y, z) + PatternAlpha2(x, y, z)
}   
              
#declare OutputPigment = pigment {
   average
   pigment_map {
      [function { PatternRed(x, y, z) } color_map {[0 rgb 0][1 rgb x * 4]}]
      [function { PatternGreen(x, y, z) } color_map {[0 rgb 0][1 rgb y * 4]}]
      [function { PatternBlue(x, y, z) } color_map {[0 rgb 0][1 rgb z * 4]}]  
      [function { PatternAlpha(x, y, z) } color_map {[0 rgb 0][1 rgbt t * 4]}]
   }       
} 

Now it is understandable why I thought there's a simpler solution I guess :)
I still hope someone can simplify it..

-- 
#macro C(X,Y)cylinder{X*x<X,0,-Y/2>.1}#end#macro U(R,X,Y)intersection{torus{.9
.1}box{-1 0rotate y*R*90}translate<X,0,Y>scale 1-z*.5}#end union{U(0,0,0)U(1,0
,0)U(2,-1,-1)U(1,1,0)U(1,1.5,-3)U(1,2,0)U(3,1,0)U(2,2,0)U(0,3,0)U(3,2,.5)C(.1,
2)C(.8,1)C(.8,-1)C(1.1,1)C(1.9,-1)pigment{rgb 10}rotate x*90translate<-1,0,4>}


Post a reply to this message

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