[Radiance-general] Carsten Bauer marble cal file

Dr. Cristiano Guarnaschelli cristiano at lightonweb.com
Fri Sep 1 01:13:06 CEST 2006


Hello all
Time ago I've downloaded from RadZilla Project web pages marvellous Radiance
Materials wrote by Cartsen Bauer
(patterns and cal files).
Only now I've found the time to check and test them, and even if they are
all incredibles,
I think that marbles are...almost real.
I'm trying to study them to find the way to manage them to have different
colors etc,
and I post this 2 questions hope that someone could help me to understand:

1- changing colors in marbles.
    I've understand that the main color of the "dark brown marble" (For
example) is managed  by

    void colorfunc marble2up
    4 red grn blu c-stone3tilxy.cal
    0
    42  0.5  0.16 0.05 0.03
    0.6   0.19 0.08 0.06
    0.65   0.15 0.085 0.045
    0.9   0.155 0.043 0.025
          0.165 0.09  0.05
    0.2 0.25 0.15
    0.2   4.2 7.3 11.6
          1.0 1.0 1.0
    0.11 0.46 4
    2 1.8 0.13
    -0.1 0.12 1
    90.0 0.5 0.5 0.25

    where the 42 parameters are the 42 ones of the c-stone3tilxy.cal file:

       arg(1)  arg(2)  arg(3)  arg(4)     color at  0<  x <arg(1)
      arg(5)  arg(6)  arg(7)  arg(8)     color at  arg(1)< x <arg(5)
      arg(9)  arg(10) arg(11) arg(12)    color at  arg(5)< x <arg(9)
      arg(13) arg(14) arg(15) arg(16)    color at  arg(9)< x <arg(13)
          arg(17) arg(18) arg(19)    color at  arg(13)<x <1
      arg(20)        turbulence
      arg(21)        turb scale
      arg(22)        unsharp borders

      arg(23) arg(24) arg(25) arg(26)  crack color at arg(23)
      arg(27) arg(28) arg(29)  crack color at border

      arg(30)  crack left border  {( < arg(23) )}
      arg(31)  crack right border {( > arg(23) )}
      arg(32)  crack  period

      arg(33)  crack  noise-func selector (1- perl. 2- fract. 3- rand.
4-perl*rand)
      arg(34)  crack  turb  intensity
      arg(35)  crack scale

      arg(36)  crack occurrence threshhold (-1 < arg(36) < 1)
      arg(37)    " scale
      arg(38) -

      arg(39)  tiling rot. angle (degrees)
      arg(40)  tiling xstep
      arg(41)  tiling ystep
      arg(42)  tiling xoffset

     First 19 parmeters are related to the marble color.
     My question is: is there a way to "calculate/Define" those 19 paremters
for the desired color?
     they are not "triple values" (r g b), they are 4 values for each "row",
and what means "color at  arg(1)< x <arg(5)"


    2- marble tiles.
      Marble tiles are defined with args 39-40-41-42 or also in the marble
mat file?
      Is it possible to use the marble pattern without tiles?

      Any help is welcome

        Cristiano

      Here the dark brown marble mat file and calc files.

 ################################################################
    #################  dark brown marble, white cracks #############
################################################################

#
#  x y plane, tiles x 0.5 y 0.5 (args 40 & 41)
#

void colorfunc marble2up
4 red grn blu c-stone3tilxy.cal
0
42  0.5  0.16 0.05 0.03
    0.6   0.19 0.08 0.06
    0.65   0.15 0.085 0.045
    0.9   0.155 0.043 0.025
          0.165 0.09  0.05
    0.2 0.25 0.15
    0.2   4.2 7.3 11.6
          1.0 1.0 1.0
    0.11 0.46 4
    2 1.8 0.13
    -0.1 0.12 1
    90.0 0.5 0.5 0.25


void plastic marble2base
0
0
5  0.17 0.065 0.04 0 0.03

void colorfunc grouts2
4 red grn blu c-1c.cal
0
3 0.51 0.505 0.5


void texfunc fugen
6 xpert ypert zpert t-brickptxz.cal -rx -90
0
14 0.5 0.5 0.25 1
   0.01 0.01 1
   0.28 0.15 0.32
   1 0 1 1


fugen mixfunc marble2tex
6 marble2up grouts2 fore m-brickptxz.cal -rx -90
0
14  0.5 0.5  0.25
    1 0.006 0.006 1
    0.002 0.002 1
    1 0.0 20 20

marble2tex plastic marble2
1 marble2base
0
5  1  1  1  0.3  0.03

 ################################################################


################################################################
    #################  c-stone3tilxy.cal #############
################################################################

{ (c)-20.08.2002-C.Bauer(Berlin)

  c-stone3tilxy.cal

  5 color fractal noise (softened) crack x tiling xy

  output: red, grn, blu (names to list as colorfunc string args)


  42 parameters:

  arg(1)  arg(2)  arg(3)  arg(4)     color at  0<  x <arg(1)
  arg(5)  arg(6)  arg(7)  arg(8)     color at  arg(1)< x <arg(5)
  arg(9)  arg(10) arg(11) arg(12)    color at  arg(5)< x <arg(9)
  arg(13) arg(14) arg(15) arg(16)    color at  arg(9)< x <arg(13)
      arg(17) arg(18) arg(19)    color at  arg(13)<x <1
  arg(20)        turbulence
  arg(21)        turb scale
  arg(22)        unsharp borders

  arg(23) arg(24) arg(25) arg(26)  crack color at arg(23)
      arg(27) arg(28) arg(29)  crack color at border

  arg(30)  crack left border  {( < arg(23) )}
  arg(31)  crack right border {( > arg(23) )}
  arg(32)  crack  period

  arg(33)  crack  noise-func selector (1- perl. 2- fract. 3- rand.
4-perl*rand)
  arg(34)  crack  turb  intensity
  arg(35)  crack scale

  arg(36)  crack occurrence threshhold (-1 < arg(36) < 1)
  arg(37)    " scale
  arg(38) -

  arg(39)  tiling rot. angle (degrees)
  arg(40)  tiling xstep
  arg(41)  tiling ystep
  arg(42)  tiling xoffset

}

shifty = floor(Py/arg(41));
shiftx = floor((Px-shifty*arg(42))/arg(40));

rotang = DEGREE*arg(39)*(shiftx+shifty);

PPx = Px*cos(rotang) + Py*sin(rotang);
PPy = Py*cos(rotang) - Px*sin(rotang);
PPz = Pz;

dist = arg(20)*fnoise3(PPx,PPy,PPz);

xev = (PPx + dist)/arg(21);
yev = (PPy + dist)/arg(21);
zev = (PPz + dist)/arg(21);

selector = if(arg(22), 0.5*(1-fnoise3(xev,
yev,zev))+arg(22)*(0.5-rand((PPx+PPy+PPz)/3)),
                              0.5*(1-fnoise3(xev, yev, zev)));

delfa13 = selector-arg(13);
delfa9  = selector-arg(9);
delfa5  = selector-arg(5);
delfa1  = selector-arg(1);

fnorm = if(delfa13, delfa13/(1-arg(13)), if(delfa9, delfa9/(arg(13)-arg(9)),
       if(delfa5, delfa5/(arg(9)-arg(5)), if(delfa1, delfa1/(arg(5)-arg(1)),
selector/arg(1)))));


basenoise = select(floor(arg(33)), arg(34)*noise3(PPx,PPy,PPz),
arg(34)*fnoise3(PPx,PPy,PPz),

arg(34)*rand((PPx+PPy+PPz)/3),arg(34)*(noise3(PPx,PPy,PPz)*rand((PPx+PPy+PPz
)/3)));

xfilt = (PPx+basenoise)/arg(35);

fildec = mod(floor(xfilt), arg(32));

fdl = frac(xfilt);

filfa = if(fildec, 0, if(fdl-arg(31), 0 , if(fdl-arg(30), if(fdl-arg(23),
1 - (fdl-arg(23))/(arg(31)-arg(23)),
                                                              1-
(arg(23)-fdl)/(arg(23)-arg(30))), 0)));
filfa2 = if(noise3(PPx/arg(37),PPy/arg(37),PPz/arg(37))-arg(36), filfa, 0);

fred = arg(27) + filfa2*(arg(24)-arg(27));
fgrn = arg(28) + filfa2*(arg(25)-arg(28));
fblu = arg(29) + filfa2*(arg(26)-arg(29));


Rl = if(delfa13, arg(14), if(delfa9, arg(10), if(delfa5, arg(6), if(delfa1,
arg(2), arg(17)))));
Gl = if(delfa13, arg(15), if(delfa9, arg(11), if(delfa5, arg(7), if(delfa1,
arg(3), arg(18)))));
Bl = if(delfa13, arg(16), if(delfa9, arg(12), if(delfa5, arg(8), if(delfa1,
arg(4), arg(19)))));

Ru = if(delfa13, arg(17), if(delfa9, arg(14), if(delfa5, arg(10), if(delfa1,
arg(6), arg(2)))));
Gu = if(delfa13, arg(18), if(delfa9, arg(15), if(delfa5, arg(11), if(delfa1,
arg(7), arg(3)))));
Bu = if(delfa13, arg(19), if(delfa9, arg(16), if(delfa5, arg(12), if(delfa1,
arg(8), arg(4)))));


red = (Rl+(Ru-Rl)*fnorm)*fred;
grn = (Gl+(Gu-Gl)*fnorm)*fgrn;
blu = (Bl+(Bu-Bl)*fnorm)*fblu;
################################################################

################################################################
    #################  c-1c.cal #############
################################################################

{ (c)-20.08.2002-C.Bauer(Berlin)

  c-1c.cal

  1 color cal file (workaround for mixing)

  output red, grn, blu

  arg(1) = red color val
  arg(2) = green  "
  arg(3) = blue   "
}

red = arg(1);
grn = arg(2);
blu = arg(3);

################################################################


################################################################
    #################  t-brickptxz.cal #############
################################################################
{ (c)-20.08.2002-C.Bauer(Berlin)

   t-brickptxz.cal

    brick normal-pattern xz-plane, x-offset

  output: xpert, ypert, zpert (texfunc-string args)

  14 parameters

  arg(1)   zstep
  arg(2)   xstep
  arg(3)   xoffset
  arg(4)   -
  arg(5)   grout size z
  arg(6)   grout size x
  arg(7)   -
  arg(8)   grout effect ampl.
  arg(9)   -
  arg(10)  -
  arg(11)  noise-func selector (1 - perlin, 2 - fractal)
  arg(12)  turb. amplitude
  arg(13)  turb. scale x
  arg(14)  turb. scale z
}
PPz = Pz +  arg(12)*select(arg(11),
noise3(Px/arg(13),Py/arg(13),Pz/arg(14)), fnoise3(Px/arg(13), Py/arg(13),
Pz/arg(14)));

PPx = Px +  arg(12)*select(arg(11),
noise3(Px/arg(13),Py/arg(13),Pz/arg(14)), fnoise3(Px/arg(13), Py/arg(13),
Pz/arg(14)));

pr = PPz/arg(1);

evpt = frac(pr)*arg(1);               {eval points}

stp = floor(pr);
evx = arg(2)*frac((PPx-stp*arg(3))/arg(2));
delmfal = evx-arg(3);
delmfau = evx-(arg(3)+arg(6));
delmf6 = if(delmfal, if(delmfau,0,1),0);
delfa5 = evpt-arg(5);
delfa5h = evpt-(arg(5)/2);
delfa6  = evx-arg(6);
delfa6h = evx - (arg(6)/2);
xpert = if(delfa5,if(delfa6,0,if(delfa6h, -arg(8), arg(8))),0);
ypert = 0;
zpert =  if(delfa5, 0 , if(delfa5h, if(delfa6,-arg(8),0), if(delmf6, 0,
arg(8))));

################################################################


################################################################
    #################  t-brickptxz.cal #############
################################################################
{ (c)-20.08.2002-C.Bauer(Berlin)

  m-brickptxz.cal

  brick mix pattern, foreground = brick-material, background = grout
material
  output: fore

  14 parameters

  arg(1)   zstep
  arg(2)   xstep
  arg(3)   xoffset
  arg(4)   -
  arg(5)   grout size z
  arg(6)   grout size x
  arg(7)   -
  arg(8)   z-trans
  arg(9)   x-trans
  arg(10)  -
   arg(11)  noise-func selector (1 - perlin, 2 - fractal)
  arg(12)  turb. amplitude
  arg(13)  turb. scale x
  arg(14)  turb. scale z

}

Ptx = Px-arg(8);
Ptz = Pz-arg(9);

PPz = Ptz +  arg(12)*select(arg(11),
noise3(Ptx/arg(13),Py/arg(13),Ptz/arg(14)), fnoise3(Ptx/arg(13), Py/arg(13),
Ptz/arg(14)));
PPx = Ptx +  arg(12)*select(arg(11),
noise3(Ptx/arg(13),Py/arg(13),Ptz/arg(14)), fnoise3(Ptx/arg(13), Py/arg(13),
Ptz/arg(14)));

pr = PPz/arg(1);
evpt = frac(pr)*arg(1);               {eval points}
stp = floor(pr);

evx = arg(2)*frac((PPx-stp*arg(3))/arg(2));

delfa5 = evpt-arg(5);

delfa6  = evx-arg(6);

fore = if(delfa5, if(delfa6, 1,0),0);

################################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://radiance-online.org/pipermail/radiance-general/attachments/20060901/5fea5136/attachment-0001.html


More information about the Radiance-general mailing list