[Radiance-general] mirror and mixfunc

Greg Ward gregoryjward at gmail.com
Tue Dec 1 08:51:08 PST 2015


Hi Jan,

As you discovered, the code isn't sophisticated enough to handle virtual source materials (mirror, prism, prism2) through the mixfunc interface.  (BTW, mixfunc also fails for light sources.)  However, you can use the "alternate material" argument to the mirror primitive to specify a different behavior for when the mirror is not directly participating in the virtual source relay calculation.  You could have a chain like this, which would work:

void metal mat1
[arguments]

void plastic mat2
[arguments]

void mixfunc mat1+2
4 mat1 mat2 mixing_var mixit.cal
0
0

void mirror mmat1+2
1 mat1+2
0
3 .5 .5 .5

------
When the mirror material is participating in the virtual source calculation, it reflects everything at 50%.  When it's participating in the interreflection calculation, or you look at it directly, then it switches to the mixfunc mat1+2's behavior.

If one of your goals is to have the mixfunc control the amount of reflected light in the virtual calculation, I'm afraid you will need to use a brightfunc modifier on the mirror material, instead.  You can do this in conjunction with an alternate material to make the behavior consistent if you like.  In the example above, let's say that mat1 is mirror-like with 80% reflectance and mat2 is diffusing.  You could use the same cal file for your brightfunc, modifying the mirror primitive like so:

void brightfunc mir_amt
2 mixing_var mixit.cal
0
0

mir_amt mirror mmat1+2
1 mat1+2
0
3 .8 .8 .8

--------
Does this make sense?

-Greg

> From: Jan Wienold <jan.wienold at epfl.ch>
> Subject: [Radiance-general] mirror and mixfunc
> Date: December 1, 2015 6:44:00 AM PST
> 
> Hi all,
> 
> I got stuck a bit applying mixfunc and mirror material. It seems that the check for secondary light sources is partly disabled when applying (at least I assume so).
> 
> A simple example:
> 
> lets assume an ideal mirror
> 
> void mirror testmat1
> 0
> 0
> 3 1 1 1
> 
> If I use just this  material on a surface and start an rtrace sending to the surface, then I get the correct result for both options - either rtrace or rtrace -I. So far so good.
> 
> In case I use a (stupid, but simple) mixfunc:
> 
> void mixfunc test_mix
> 4 testmat1 testmat1 0.5 .
> 0
> 0
> 
> I should get the same result, since I'm mixing the same material with a fixed value.
> But: rtrace -I delivers only 0, whereas rtrace delivers the correct value. So it seems that mixfunc cannot be applied with mirror, when the -I option is used. Or I did something wrong?
> I used -dr 2 and -dt 0 in both cases.
> 
> Of course my ultimate goal is not mixing that simple but mixing two different material types, also depending on the angle of incidence, but this simple example shows the principle problem.
> 
> Is there any solution using mixfunc and mirror when using rtrace -I ?
> 
> Jan



More information about the Radiance-general mailing list