[Radiance-general] mirror and mixfunc

giulioandrea antonutto foi geotrupes at me.com
Tue Dec 1 08:57:52 PST 2015


From my old blog….

The idea is to create a simple mirror, a ‘caustic’ effect and apply a pattern to it, to create holes without having to modify the geometry.
The geometry is a classic:
cap.rad - the cap for the ring
mix ring top
0
0
8
0 0 25
0 0 1
57.29432507 60
scene.rad - a spot light and a plane
void spotlight spot
0
0
7 50000 50000 50000 35 0 -1 -1
spot sphere source
0
0
4 0 200 200 2.5
void plastic white
0
0
5 .5 .5 .5 0 0
white polygon plan
0
0
12
-500 -500 0
-500 500 0
500 500 0
500 -500 0
single.rad - a single sector of the ring, to array
mix polygon int
0
0
12
-.5 -57.29432507 0
-.5 -57.29432507 25
.5 -57.29432507 25
.5 -57.29432507 0
mix polygon ext
0
0
12
-.5237120674 -60 0
.5237120674 -60 0
.5237120674 -60 25
-.5237120674 -60 25
And now the interesting stuff:
To activate secondary sources use -dr N  (N>0).
We will use mirror.
Unfortunately when mirror is nested into a mixfunc material is invisible to the secondary source tracer... but there is a workaround...
model.mat
#alterate the reflectance of the metal - optional
void brightfunc stripes
2  'sin(A1*Pz)' . 
0
1 .8
#metal
stripes metal metal
0
0
5 .8 .8 .8 0.001 0
#mix the metal with void to create holes
void mixfunc strip
4  metal void 'if(sin(A1*Py),0,1)' .
0
1 .2
#alterate the reflectance of mirror, reflectance is 0% for holes
void brightfunc band
2 'if(sin(A1*Py),0,1)' .
0
1 .2
#mirror attached to the metal surface, with holes
band mirror mix
1 strip
0
3 1 1 1


Now, array the single.rad file:
xform -a 360 -rz 1 -i 1 single.rad  > ring.rad


> On 1 Dec 2015, at 16:51, Greg Ward <gregoryjward at gmail.com> wrote:
> 
> 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
> 
> _______________________________________________
> Radiance-general mailing list
> Radiance-general at radiance-online.org
> http://www.radiance-online.org/mailman/listinfo/radiance-general

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.radiance-online.org/pipermail/radiance-general/attachments/20151201/cf3b7dde/attachment-0001.html>


More information about the Radiance-general mailing list