Wednesday, December 25, 2013

How to edit reflection of flat mirror

By applying ‘Flat mirror’ shader to a group, you can easily have a mirrored part (not functional) in your mesh.  But the mirrored effect is properly applied only to flat plane parallel to xy plane. You have to adjust some parameters to make a mirrored plane which is not parallel to xy plane.

I made a cube mesh for an example.

In this cube, right, top, front and left planes were assigned to group 1, 2, 3 and 4, respectively. I set each of these four groups to Flat mirror.   The bottom and back planes are group 0 and its shader was not changed (phong).

I used these material parameters for Flat mirror groups.  These are similar to those of an EA’s mirror.

In MLOD (high detail mesh), you can find MirrorPlane parameters under ChunkEntries > [00]ChunkEntries > RCOLBlock > Meshes > [#]Meshes (# =  group number).

Parameters x, y, and z define the vector of reflection direction. In default setting, x=0, y=0, and z=1.  This means that its reflection is directed to z-axis direction.  Hence only a plane parallel to xy plane shows proper reflection.
In above cube example, front plane (group 3) need not be changed in its setting.  I changed xyz parameters in group 1, 2 and 4 as follows:
  • right plane (group 1),  x 1, y 0, z 0
  • top plane   (group 2),  x 0, y 1, z 0
  • left plane   (group 4),  x -1, y 0, z 0
In game, each of four mirrored planes reflected properly. (The left plane is shown in picture below.)

You can also make tilted mirror by changing xyz parameters.  EA has some tilted floor mirrors. Or if you want to make a mirror tilted by an original angle you like, you can determine the xyz values of the intended vector using trigonometric function. (Please see this tutorial.)

The fourth parameter w seems to define the position of reflecting surface along z direction.  In default setting, this value is set to 0.  You need not change this parameter if you’re satisfied with the mirror image.

I found that some of EA’s mirror doesn’t reflect the objects located close to it.

In next example, I changed w value from 0 to 0.4.

When w = 0, the mirror image of candle was not shown on mirror surface.  After changed it to 0.4, the candle image can be seen on the mirror.

Don’t forget to change the corresponding parameters in MODL as well.

In this way, you can make so-called mirrored furniture, but please note that the the more mirrored area may require the higher graphic power of player’s PC.


  1. Where can I find the Chunk Entries In TSRW?

    1. First, you need to have s3pe plugin ( installed. As described in that thread, open MLOD in s3pe, click MLOD line, and click Grid button on the bottom. Then a window as shown above will open.

    2. Thank you so much for your reply! You're really kind!
      Can you make a tutorial of how to add multi-tile wall masks for an arched door in TSRW?

    3. I don't know how to add wall mask to an object which doesn't have wall mask originally. But I will try to post a tutorial about how to edit wall mask, probably covering multi-tile wall masks.

    4. Yes, I mean edit EA's 1-tile wallmask to 3-tile or more. Is it possible? Because if I clone with a 3-tile arch, I don't know how to change to footprint! Thanks in advance! Sorry I post it here cause I don't know how to contact you.

    5. Okay anon, I'll post a tutorial about how to edit wall mask using 1-tile arch as an example. It's possible to edit 1-tile to 3-tile. I'll mention it in the tutorial.

    6. Oh.....thanks sooooo much!!