POV-Ray : Newsgroups : povray.general : Non - rgbf 1 pigment only applied to surface. : Re: Non - rgbf 1 pigment only applied to surface. Server Time: 14 Jul 2020 04:10:42 GMT
  Re: Non - rgbf 1 pigment only applied to surface.  
From: Bald Eagle
Date: 9 May 2020 02:00:01
> > I'll also have to think about encoding a vector into a function so that the
> > pattern {function{}} thing evaluates to the same VECTOR result everywhere - thus
> > you could define a function intead of a vector and then use the dot notation in
> > a function, whereas you currently can't use Vector.x in a function expression.
>
> Interesting idea... I'll let it bang around in my head.

Kinda sorta works.
I only played around with it enough to get basic functionality.
Still some weird / awkward things about it all.




#version 3.8;
global_settings {assumed_gamma 1.0}

camera {
 location <0, 3, -10>
 //location <0, 4, -50>
 right x*image_width/image_height
 up y
 look_at <0, 3, 0>
}


light_source {<20, 50, -30> rgb 1}
sky_sphere {pigment {rgb 0.2}}

// user_defined {FnRed, FnGreen, FnBlue, FnFilter, FnTransmit}

#declare FnR  = function (x,y,z) {-1}
#declare FnG  = function (x,y,z) { 0}
#declare FnB  = function (x,y,z) { 1}
#declare FnF  = function (x,y,z) {pi}
#declare FnT  = function (x,y,z) {tau}

#declare Vector5 = pigment {
     user_defined {
         function { FnR(x,y,z)},
         function { FnG(x,y,z)},
         function { FnB(x,y,z)},
         function { FnF(x,y,z)},
         function { FnT(x,y,z)}
     }
}

#declare V5 = function {pigment{Vector5}}

#declare R = function {V5(x,y,z).x}
#declare G = function {V5(x,y,z).y}
#declare B = function {V5(x,y,z).z}
#declare F = function {V5(x,y,z).filter}
#declare T = function {V5(x,y,z).transmit}

#declare Fs = array [5] {
 function {R(x,y,z)},
 function {G(x,y,z)},
 function {B(x,y,z)},
 function {F(x,y,z)},
 function {T(x,y,z)}

}
#declare C = array [5] {
 pigment {rgb <1, 0, 0>},
 pigment {rgb <0, 1, 0>},
 pigment {rgb <0, 0, 1>},
 pigment {rgb 1},
 pigment {rgb 0}
}

#for (Func, 0, 4)
 #for (N, 0, 10)
  #local Y = Fs[Func](1,2,3);
  //#local Y = Fs[F](x,y,z);  This does NOT work.   ???
  sphere {<-1*N/5, Y, 0> 0.1 pigment {C[Func]}}
 #end
#end


Post a reply to this message

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