colorfunc

Hello,

I am doing rad Tutorial, there we used blue_band as a modifier for
wall_mat. I checked the primitive for blue_band and it looks like below:

void colorfunc blue_band
4 if(Pz-1.2,1,if(Pz-1,0,1)) if(Pz-1.2,1,if(Pz-1,0,1)) 1 .
0
0

my question is how can I find a description for second sentence?

Thanks,

Ehsan

Hi Ehsan,

That line uses the Radiance functional language, which is sorta documented in the filefmts.pdf file, located here:
http://www.radiance-online.org/learning/documentation/references.html

Have fun!

- Rob

ยทยทยท

From: Ehsan M.Vazifeh [mailto:[email protected]]
Sent: Monday, March 25, 2013 9:33 AM
To: [email protected]
Subject: [Radiance-general] colorfunc

Hello,
I am doing rad Tutorial, there we used blue_band as a modifier for wall_mat. I checked the primitive for blue_band and it looks like below:

void colorfunc blue_band
4 if(Pz-1.2,1,if(Pz-1,0,1)) if(Pz-1.2,1,if(Pz-1,0,1)) 1 .
0
0

my question is how can I find a description for second sentence?
Thanks,
Ehsan

Hi Ehsan,

you are not the first one having problems starting with the cal-file syntax. So let me try.

I am doing rad Tutorial, there we used blue_band as a modifier for wall_mat. I checked the primitive for blue_band and it looks like below:

void colorfunc blue_band
4 if(Pz-1.2,1,if(Pz-1,0,1)) if(Pz-1.2,1,if(Pz-1,0,1)) 1 .
0

"if (a,b,c)" in Radiance is a function returning "b" if a>0 and "c" if a<=0.

The minimal colorfunc line expects values for R, G, B and a cal-file. In the given case, the values for R and G are calculated by the given formulae, the value for B is fixed to 1 and the cal-file is not needed and set to the current path "."

The expression "if(Pz-1.2,1,if(Pz-1,0,1))" is interpreted as:
if (Pz-1.2,.....) : as the if-function decides according to the condition >0 or not, this leads to the evaluation wether Pz is greater then 1.2. If this is the case, the return value (the value for the R-channel) is 1. If Pz <= 1.2, thus Pz-1.2 becoming 0 or less, the return value (R-channel) will be set to the result of the expression "if(Pz-1,0,1)". This follows the same rules, setting the return value (R-channel) to 0 if Pz is larger then 1, and to 1 if smaller or equal 1. If you combine these two expression, you will get R=1 if Pz=<1 or

1.2, else R=0. As Pz is the z-coordinate of the point where you

calculate the pixel color, this results in a line centered at height 1.1 of 0.2 width.

Hope this helps to understand the remains of the line...

Cheers, Lars.

Dear Lars
your answer was really brief and clear, thanks a lot.

Best Regards,
Ehsan