transfunc with measured data (poor man's BSDF)

I'm trying to set up a transfunc material to approximate some rough
measured data I have. Assume my material is isotropic and I have a
unscaled transmission profile from 0-90 degrees.

here is my material:

void transfunc pane
2 tdis distribution.cal
0
7 .9 .9 .9 0 .8 1 12

.8 is my measured total VLT, and 12 is a magical factor that fits the
simulation with a physical model (this number is different for every
material, which is why I know I'm missing something, mostly likely math
skills)

and here is the contents of distribution.cal:

tcoef = .5*90*A7;

ang(x,y,z) = acos(x*Dx+y*Dy+z*Dz)/DEGREE;

bound2(x,y,z) = if(ang(x,y,z)-90,90,ang(x,y,z));

tdis(ix,iy,iz) = tcoef*tdat(91-floor(bound2(ix,iy,iz)));

tdat(i) : select(i,
0.000310656,
0.000312042,
0.000315021,
0.00032472,
0.000326868,
0.000330262,
0.000332341,
0.000343634,
0.00034689,
0.000354026,
0.00035749,
0.000359083,
0.000361647,
0.00036906,
0.000371554,
0.000377512,
0.000380076,
0.000389082,
0.000392061,
0.000394902,
0.000402315,
0.000408758,
0.000407857,
0.000420743,
0.000421228,
0.000429542,
0.0004346,
0.000436401,
0.000447971,
0.000449356,
0.000454414,
0.000458086,
0.000478385,
0.000477,
0.00048947,
0.000499585,
0.000507414,
0.000521339,
0.000536512,
0.000545726,
0.000556811,
0.000570598,
0.000586741,
0.000594084,
0.000607941,
0.000625399,
0.000634129,
0.000651241,
0.000673411,
0.000703202,
0.000728143,
0.000735071,
0.000774561,
0.000804352,
0.000824444,
0.000845921,
0.000895803,
0.000942914,
0.000982404,
0.001031594,
0.001085633,
0.001198561,
0.001237358,
0.00129694,
0.00136345,
0.001465293,
0.001581685,
0.001673136,
0.001792299,
0.001928783,
0.002159488,
0.002343776,
0.002594573,
0.002836364,
0.003092703,
0.00343218,
0.003813226,
0.004396572,
0.005160741,
0.006019825,
0.006495786,
0.008431496,
0.009456855,
0.011265089,
0.013821557,
0.017729005,
0.022952792,
0.052383356,
0.11064174,
0.238534447,
0.426770895)

Im getting the expected distribution for direct light sources (at least for
near normal incidence, which is all I am worried about for now), but glows
and indirect light seem to revert to a lambertian. I have no idea how to
scale these values to insure the right transmittance or as the reference
manual puts it "The function brtd should integrate to 1 over each projected
hemisphere".

Help with integration, what is going on with diffuse transmission, anything
else I may be missing and/or that I am barking up the wrong tree entirely
would be greatly appreciated.

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

Thanks Greg,

bsdf2klems is doing what I wanted perfectly but bsdf2ttree is doing
something a little weird. I used t4 just so I could view the output with
Andy's BSDF viewer and when I run it with the defaults the "front" in the
BSDF viewer (which i think is made from +backward with bsdf2ttree) looks
good, but when I include +forward the "back" transmission is too high.
This does not happen with the klems bsdf.

The hemispherical transmission for a normal ray is 75% for both klems
directions and ttree front, but ttree back is 91.6. Any idea whats going
on? I can probably get around this by paying attention to surface normals,
but I am looking at a multi layered assembly where I expect backface
reflection and transmission to matter.

Thanks,

Stephen

Hi Stephen,

This would probably be a little easier to set up using transdata, which is meant for this kind of input. However, none of the older types handle soft-specular interactions from non-sources. This is a big caveat with these material types and one of the main motivations for implementing the more general BSDF framework.

Since you already have this function implemented, you can use it to create an XML file for the BSDF primitive (see refman.pdf pp.10-11) using either bsdf2klems or bsdf2ttree, which take functional descriptions. To given an example, we can define the following wgmdiso.cal file:

{ Ward-Geisler-Moroder-Duer isotropic BRDF model }

rho_d = 0.095;
rho_s = 0.05;
a = 0.08;

exfunc(hx,hy,hz) = exp(-(hx*hx + hy*hy)/(hz*hz*a*a)) *
      (hx*hx + hy*hy + hz*hz) /
      (PI*a*a*hz*hz*hz*hz);

{ Note that we assume i and o vectors are normalized }

wgmdiso(ix,iy,iz,ox,oy,oz) = if( -iz*oz, 0,
      rho_d/PI + rho_s*exfunc(ix+ox,iy+oy,iz+oz) );

···

----------

This can then be passed to bsdf2ttree to create an XML representation:

  bsdf2ttree -t3 -f wgmdiso.cal wgmdiso > wgmdiso.xml

The "-t3" option tells bsdf2ttree that the function is isotropic. There's no such choice for the Klems representation, where you would use:

  bsdf2klems -f wgmdiso.cal wgmdiso > wgmdisok.xml

It's a homework assignment to convert your function into one that takes incident and exiting vectors (both pointing away from the surface), and remember that you need to include same-side vectors for reflection, which should return 0.2*0.9 for the diffuse portion in your case.

The reward should be a BSDF description that does proper sampling of the transmitted light!

Best of luck!
-Greg

P.S. Apropos to this discussion, Peter Apian-Bennewitz wrote an excellent review of different Radiance materials and how best to apply them a few years back, including the transfunc type. His paper is available as at <http://arxiv.org/abs/1307.4214>.

From: Stephen Wasilewski <[email protected]>
Date: May 17, 2016 10:33:44 AM PDT

I'm trying to set up a transfunc material to approximate some rough measured data I have. Assume my material is isotropic and I have a unscaled transmission profile from 0-90 degrees.

here is my material:

void transfunc pane
2 tdis distribution.cal
0
7 .9 .9 .9 0 .8 1 12

.8 is my measured total VLT, and 12 is a magical factor that fits the simulation with a physical model (this number is different for every material, which is why I know I'm missing something, mostly likely math skills)

and here is the contents of distribution.cal:

tcoef = .5*90*A7;

ang(x,y,z) = acos(x*Dx+y*Dy+z*Dz)/DEGREE;

bound2(x,y,z) = if(ang(x,y,z)-90,90,ang(x,y,z));

tdis(ix,iy,iz) = tcoef*tdat(91-floor(bound2(ix,iy,iz)));

tdat(i) : select(i,
0.000310656,
0.000312042,
...
0.238534447,
0.426770895)

Im getting the expected distribution for direct light sources (at least for near normal incidence, which is all I am worried about for now), but glows and indirect light seem to revert to a lambertian. I have no idea how to scale these values to insure the right transmittance or as the reference manual puts it "The function brtd should integrate to 1 over each projected hemisphere".

Help with integration, what is going on with diffuse transmission, anything else I may be missing and/or that I am barking up the wrong tree entirely would be greatly appreciated.

Thanks,

Stephen Wasilewski

Hi Stephen,

You got that working pretty quickly! Can you send me a private message with your .cal file and commands, so I can reproduce the issue?

Thanks,
-Greg

···

From: Stephen Wasilewski <[email protected]>
Date: May 17, 2016 2:12:18 PM PDT

Thanks Greg,

bsdf2klems is doing what I wanted perfectly but bsdf2ttree is doing something a little weird. I used t4 just so I could view the output with Andy's BSDF viewer and when I run it with the defaults the "front" in the BSDF viewer (which i think is made from +backward with bsdf2ttree) looks good, but when I include +forward the "back" transmission is too high. This does not happen with the klems bsdf.

The hemispherical transmission for a normal ray is 75% for both klems directions and ttree front, but ttree back is 91.6. Any idea whats going on? I can probably get around this by paying attention to surface normals, but I am looking at a multi layered assembly where I expect backface reflection and transmission to matter.

Thanks,

Stephen