# Calculating diffuse component in a BRTDfunc

Hi all,

I am writing a BRTD material which I want to use to change the diffuse component of a surface, related to a certain direction an the surface normal.
What am I doing wrong here?

I get the impression that the rfdif, gfdif, bfdif, rbdif, gbdif and bbdif are not variables ???
If these are not variables, how can I change/calculate/define the diffuse component in a BRTDfunc?
See the bold lines of the example in my cal file.

I appreciate any suggestions !

Iebele

<--- snip ---->

{
directional.cal

arg10 red diffuse
arg11 green diffuse
arg12 blue diffuse
arg13 direction x arg14 direction y
arg15 direction z
}

{ RGB values for the reflection }
valr = arg(10);
valg = arg(11);
valb = arg(12);
xdir = arg(13);
ydir = arg(14);
zdir = arg(15);

{ dot product direction and normal }
DdN = (xdir*Nx)+(ydir*Ny)+(zdir*Nz);

{ always return a positive value }
multi = if(DdN, DdN, -DdN) ;

*reflr = CrP + (multi*valr) ;
reflg = CgP + (multi*valg) ;
reflb = CbP + (multi*valb) ;*

{
example usage:
void BRTDfunc LAYER114
10
0 0 0 / reflection
0 0 0 / specular
0 0 0 directional.cal
0
15
* reflr reflg reflb */ diffuse front*
reflr reflg reflb * / diffuse back
0 0 0 / trans
0.8 0.7 0.6 / color of surface
0.57735 0.57735 0.57735 / vector defining bright side of surface
}

--- (previous message was messed up a bit, hope this times it is better) ---

Hi all,

I am writing a BRTD material which I want to use to change the diffuse component of a surface, related to a certain direction and the surface normal. Radiance reports: "error bad arguments for BRTDfunc

I get the impression that the rfdif, gfdif, bfdif, rbdif, gbdif and bbdif are not variables ?
If these are not variables, how can I change/calculate/define the diffuse component in a BRTDfunc?
See the bold lines of the example in my cal file.

I appreciate any suggestions !

Iebele

<--- snip ---->

{

directional.cal

arg10 red diffuse
arg11 green diffuse
arg12 blue diffuse
arg13 direction x arg14 direction y
arg15 direction z

}

{ RGB values for the reflection }

valr = arg(10);
valg = arg(11);
valb = arg(12);
xdir = arg(13);
ydir = arg(14);
zdir = arg(15);

{ dot product direction and normal }
DdN = (xdir*Nx)+(ydir*Ny)+(zdir*Nz);

{ always return a positive value }
multi = if(DdN, DdN, -DdN) ;

*reflr* = CrP + (multi*valr) ;
*reflg* = CgP + (multi*valg) ;
*reflb* = CbP + (multi*valb) ;

{

example usage:

void BRTDfunc LAYER114
10
0 0 0 / reflection
0 0 0 / specular
0 0 0 directional.cal
0
15
*reflr reflg reflb* / diffuse front
*reflr reflg reflb* / diffuse back
0 0 0 / trans
0.8 0.7 0.6 / color of surface
0.57735 0.57735 0.57735 / vector defining bright side of surface

}

Hi Iebele,

You are correct that the real arguments cannot be expressions. The definition of a diffuse component is one that does not change with angle, so there should be no need to define these parameters as variables. If you have some varying portion to your BRDF, then put this in the directional-diffuse component, which are string arguments 7-9 for BRTDfunc.

-Greg

P.S. On my mailer, the first message came through better than the second.

···

From: atelier iebele abel <atelier@iebele.nl>
Date: September 30, 2005 7:10:17 AM PDT

Hi all,

I am writing a BRTD material which I want to use to change the diffuse component of a surface, related to a certain direction an the surface normal.
What am I doing wrong here?

I get the impression that the rfdif, gfdif, bfdif, rbdif, gbdif and bbdif are not variables ???
If these are not variables, how can I change/calculate/define the diffuse component in a BRTDfunc?
See the bold lines of the example in my cal file.

I appreciate any suggestions !

Iebele

<--- snip ---->

{
directional.cal

arg10 red diffuse
arg11 green diffuse
arg12 blue diffuse
arg13 direction x arg14 direction y
arg15 direction z
}

{ RGB values for the reflection }
valr = arg(10);
valg = arg(11);
valb = arg(12);
xdir = arg(13);
ydir = arg(14);
zdir = arg(15);

{ dot product direction and normal }
DdN = (xdir*Nx)+(ydir*Ny)+(zdir*Nz);

{ always return a positive value }
multi = if(DdN, DdN, -DdN) ;

*reflr = CrP + (multi*valr) ;
reflg = CgP + (multi*valg) ;
reflb = CbP + (multi*valb) ;*

{
example usage:
void BRTDfunc LAYER114
10
0 0 0 / reflection
0 0 0 / specular
0 0 0 directional.cal
0
15
* reflr reflg reflb */ diffuse front*
reflr reflg reflb * / diffuse back
0 0 0 / trans
0.8 0.7 0.6 / color of surface
0.57735 0.57735 0.57735 / vector defining bright side of surface
}

Hi Greg,

Thanks for your response. So, what I tried does not work with BRTDfunc at all... I used more or less the same cal file in combination with colorfunc and brightfunc, which works fine for the moment.
Just for understanding more of it: according to the documentation args 7-9 are functions. Are there any examples of how to use a function in BRTDfunc ?

-Iebele

Greg Ward wrote:

···

Hi Iebele,

You are correct that the real arguments cannot be expressions. The definition of a diffuse component is one that does not change with angle, so there should be no need to define these parameters as variables. If you have some varying portion to your BRDF, then put this in the directional-diffuse component, which are string arguments 7-9 for BRTDfunc.

-Greg

P.S. On my mailer, the first message came through better than the second.

From: atelier iebele abel <atelier@iebele.nl>
Date: September 30, 2005 7:10:17 AM PDT

Hi all,

I am writing a BRTD material which I want to use to change the diffuse component of a surface, related to a certain direction an the surface normal.
What am I doing wrong here?

I get the impression that the rfdif, gfdif, bfdif, rbdif, gbdif and bbdif are not variables ???
If these are not variables, how can I change/calculate/define the diffuse component in a BRTDfunc?
See the bold lines of the example in my cal file.

I appreciate any suggestions !

Iebele

<--- snip ---->

{
directional.cal

arg10 red diffuse
arg11 green diffuse
arg12 blue diffuse
arg13 direction x arg14 direction y
arg15 direction z
}

{ RGB values for the reflection }
valr = arg(10);
valg = arg(11);
valb = arg(12);
xdir = arg(13);
ydir = arg(14);
zdir = arg(15);

{ dot product direction and normal }
DdN = (xdir*Nx)+(ydir*Ny)+(zdir*Nz);

{ always return a positive value }
multi = if(DdN, DdN, -DdN) ;

*reflr = CrP + (multi*valr) ;
reflg = CgP + (multi*valg) ;
reflb = CbP + (multi*valb) ;*

{
example usage:
void BRTDfunc LAYER114
10
0 0 0 / reflection
0 0 0 / specular
0 0 0 directional.cal
0
15
* reflr reflg reflb */ diffuse front*
reflr reflg reflb * / diffuse back
0 0 0 / trans
0.8 0.7 0.6 / color of surface
0.57735 0.57735 0.57735 / vector defining bright side of surface
}

_______________________________________________

Sure, just go to where the Radiance libraries live (ray/lib in the distribution) and run "grep BRTDfunc *.cal"

There are a few different examples.

-Greg

···

From: atelier iebele abel <atelier@iebele.nl>
Date: September 30, 2005 4:16:52 PM PDT

Hi Greg,

Thanks for your response. So, what I tried does not work with BRTDfunc at all... I used more or less the same cal file in combination with colorfunc and brightfunc, which works fine for the moment.
Just for understanding more of it: according to the documentation args 7-9 are functions. Are there any examples of how to use a function in BRTDfunc ?

-Iebele