arguments to function file constant

As I understand function files: lines with colons are defined once upon
loading the func file and lines with equal signs are calculated for every
intersecting ray. Is there a way to pass an argument from my material
(A1,A2 etc.) to a constant? if I try something like this:

darea : A3^2*PI;

I get this error:
rvu: internal - arg(n) called without a modifier context

but this:
darea = A3^2*PI;

runs fine.

Although perhaps my first question should be: does this make a difference
in the calculation time?

Thanks,

Stephen Wasilewski
*LOISOS *+* UBBELOHDE*
- - - - - - - - - - - - - - - - - - - - - - - - - - -
1917 Clement Avenue Building 10A
Alameda, CA 94501 USA
- - - - - - - - - - - - - - - - - - - - - - - - - - -
510 521 3800 VOICE
510 521 3820 FAX
- - - - - - - - - - - - - - - - - - - - - - - - - - -
www.coolshadow.com

Hi Stephen,

Good question. Short answer, you can't use A* variables in constant expressions as they need to call the underlying arg(i) function to update the parameter values for the particular modifier context. Since .cal files can be shared between modifiers, there really was no other way to do this.

It also doesn't make much difference in terms of performance, because values still get "cached" at each variable definition. If you have a complicated expression, just define a variable for it, then multiple uses will share the same evaluation.

Also, minor point, but "A3*A3" may be slightly faster than "A3^2", which calls pow(). There is a constant function "sq(x):x*x" defined for this reason in rayinit.cal.

While I'm on the subject, note that a constant function is not the same as a constant setting. It only means that the value of the function depends solely on its arguments, not any transient variable settings in the current evaluation context.

Most of this stuff is explained or at least alluded to in Chapter 4 of "Rendering with Radiance" and the supplemental PDF (filefmts.pdf).

Best,
-Greg

P.S. Were you one of the requestors that the "-s" option to falsecolor assign the largest value in the legend? I just checked that into the CVS head.

ยทยทยท

From: Stephen Wasilewski <[email protected]>
Date: September 5, 2017 6:22:09 PM PDT

As I understand function files: lines with colons are defined once upon loading the func file and lines with equal signs are calculated for every intersecting ray. Is there a way to pass an argument from my material (A1,A2 etc.) to a constant? if I try something like this:

darea : A3^2*PI;

I get this error:
rvu: internal - arg(n) called without a modifier context

but this:
darea = A3^2*PI;

runs fine.

Although perhaps my first question should be: does this make a difference in the calculation time?

Thanks,

Stephen Wasilewski
LOISOS + UBBELOHDE
- - - - - - - - - - - - - - - - - - - - - - - - - - -
1917 Clement Avenue Building 10A
Alameda, CA 94501 USA
- - - - - - - - - - - - - - - - - - - - - - - - - - -
510 521 3800 VOICE
510 521 3820 FAX
- - - - - - - - - - - - - - - - - - - - - - - - - - -
www.coolshadow.com