You are here: Home / Learn / Nuggets / A Broken Mirror

A Broken Mirror

mirror.png

Goal

Create a mirror with holes by controlling the materials used, not by altering the underlying geometry. A caustic and a pattern are used.

Files and Build Commands

The geometry is a classic ring, cap, and cylinder.

# cap.rad - the cap for the ring
mix ring top
0
0
8
0 0 25
0 0 1
57.29432507 60
# 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

Now, array the single.rad file into the ring.rad file:

xform -a 360 -rz 1 -i 1 single.rad  > ring.rad

Add a plane and a spot light into the scene

# scene.rad, a spot light and a plane
void spotlight spot0
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

Unfortunately when mirror is nested into a mixfunc material is invisible to the secondary source tracer...but there is a workaround which allows carving holes in the geometry and applying a pattern...

# model.mat
# alternate 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
# alternate the reflectance of mirror, reflectance is 0% for holesvoid 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

Create the octree with:

oconv model.mat scene.rad cap.rad ring.rad  > model.oct

and run rpict. Make sure to activate secondary sources with the "-dr N" option with N > 0.

by RFritz – last modified Jun 15, 2016 11:09 PM