Mirrors and Mirroring

Avatar
jwien001
36 Posts
Posted Dec 02, 2009

Alright, so I had a new idea for a map that involves mirrors and mirroring object movement. This led me to two questions:

  1. Are there any textures that act like a mirror? Like 1:1 reflective glass? I looked in the texture browser and didn't find anything that worked, but I may have missed something.

  2. Has anyone ever used logic_mirror_movement? I know you could just parent one object to another, but I saw this entity and was curious if anyone had used it or another method of mirroring object movement.

Advertisement
Registered users don’t see ads! Register now!
Avatar
Mek
459 Posts
Posted Dec 02, 2009
Replied 5 hours later
I remember a small test map where you picked up a cube and put it on a button which was in the back side of the mirror only. However, that map was not here on this site but on myaperturelabs, if I remember correctly. I can't remember its name, though. So I would say yes, some interesting things are possible.
Avatar
WinstonSmith
940 Posts
Posted Dec 02, 2009
Replied 4 hours later

jwien001 wrote:
Alright, so I had a new idea for a map that involves mirrors and mirroring object movement. This led me to two questions:

  1. Are there any textures that act like a mirror? Like 1:1 reflective glass? I looked in the texture browser and didn't find anything that worked, but I may have missed something.

  2. Has anyone ever used logic_mirror_movement? I know you could just parent one object to another, but I saw this entity and was curious if anyone had used it or another method of mirroring object movement.

Search for "reflect" in the material browser--there are materials with 10%, 20%, 30%, 40%...etc. reflectivity. They seem to be a bit buggy, though. I made a post somewhere (not sure if it was on this forum) about fully reflective textures a while ago. Didn't get much response, so I did a little digging... I ended up making a straight white texture with the cubemap VMT property. I put it in a map and built cubemaps. The only problem was that it seemed to reflect a much larger version of the map--appearing to extend far beyond the actual map. Best of luck to you, though; the VDC will probably be a big help on this one.

Avatar
HMW
806 Posts
Posted Dec 03, 2009
Replied 15 hours later
All 'normal' reflective materials use a pre-calculated cube map for simulating reflections, creating the effect WinstonSmith describes. The cube map is a static 'screenshot' from the position of the nearest env_cubemap entity in the map. Since it doesn't move with the player, on flat surfaces the reflection looks like it's an infinitely big copy of the room.

The only materials that actually render a true reflection are various kinds of water and a few dedicated reflective glass textures. (glass/reflectiveglass001 ~ 003)

The reflective glass textures must be used with a func_reflective_glass entity. Unfortunately, this method of creating a mirror has a few serious drawbacks: the mirror image doesn't show the player, only one mirror surface can be visible at any time and portals are not rendered correctly in the mirror image.

However, there is a way to copy the movement of an object to another object: logic_measure_movement. This can be used, for example, to synchronise the movement of two boxes in two identical chambers (which I would recommend you actually build instead of trying the mirror technique above.) Using a prop_dynamic_override for the second cube seems to work best.

Avatar
jwien001
36 Posts
Posted Dec 03, 2009
Replied 34 minutes later
I did not know about logic_measure_movement, but I'll definitely try that out. Thank you!

I did create a mirror using the func_reflective_glass, and I can deal with the drawbacks you listed, but there is one other problem: the image in the mirror is fuzzy/pixelated. Is that due to the texture/entity, or is it some other visual effect?

EDIT: After playing around with the logic_measure_movement, I cannot create the "mirror" effect. The 2 boxes either both get closer to the glass but move along the glass in different directions, or move along the glass in the same direction but when one gets close to the glass the other gets farther away.

Avatar
HMW
806 Posts
Posted Dec 04, 2009
Replied 19 hours later

jwien001 wrote:
I did not know about logic_measure_movement, but I'll definitely try that out. Thank you!

Neither did I, I just stumbled upon it while looking for movement related stuff :smile:

jwien001 wrote:
I did create a mirror using the func_reflective_glass, and I can deal with the drawbacks you listed, but there is one other problem: the image in the mirror is fuzzy/pixelated. Is that due to the texture/entity, or is it some other visual effect?

You're right, one other drawback that I forgot to mention is that it looks crappy. The mirror image first gets rendered into a texture, which is then drawn on the surface of the entity. It looks fuzzy because the pixels in the texture don't match up with the pixels on your monitor.

jwien001 wrote:
EDIT: After playing around with the logic_measure_movement, I cannot create the "mirror" effect. The 2 boxes either both get closer to the glass but move along the glass in different directions, or move along the glass in the same direction but when one gets close to the glass the other gets farther away.

I set it up like this:
- Create two info_target entities and place them in the mirror plane. Make sure that they are both in the same position and rotated so that the yellow angle indicator line is perpendicular to the mirror.- Edit the "Pitch Yaw Roll" property of one of the targets and change the last number to 180.- In the logic_measure_movement properties, set one target as the measure reference and the other as the movement reference.- Set the movement scale to -1.

Avatar
jwien001
36 Posts
Posted Dec 04, 2009
Replied 4 hours later
Beautiful! I was trying so much more complicated setups, but that is so simple. Thank you.

Now if only it were possible to get the mirrored object to collide with other objects instead of passing through them, or interact with buttons, but that may be asking too much.

Avatar
HMW
806 Posts
Posted Dec 06, 2009
Replied 2 days later
You may be able to fake it by having the 'driver' object collide with something invisible on the player's side of the room, to mimic collision on the mirrored side. (func_clip_vphysics comes to mind.)
As for the buttons, I've no idea...

Oh and by the way: if you have made something cool, publish it in the W.I.P. thread :smile:

Avatar
WinstonSmith
940 Posts
Posted Dec 06, 2009
Replied 3 hours later

jwien001 wrote:
Beautiful! I was trying so much more complicated setups, but that is so simple. Thank you.

Now if only it were possible to get the mirrored object to collide with other objects instead of passing through them, or interact with buttons, but that may be asking too much.

Parent func_physboxes textured with nodraw/invisible to the mirror objects and shape them so that they're more or less the same (rough) shape. That way, the physboxes will trigger buttons, collisions, etc...

Avatar
jwien001
36 Posts
Posted Dec 07, 2009
Replied 15 hours later

HMW wrote:
You may be able to fake it by having the 'driver' object collide with something invisible on the player's side of the room, to mimic collision on the mirrored side. (func_clip_vphysics comes to mind.)

I had thought about that, as well as putting a trigger on the player's side to activate the button, but the player would also collide with the invisible object and the box still falls through the button, so the illusion isn't as convincing.

WinstonSmith wrote:
Parent func_physboxes textured with nodraw/invisible to the mirror objects and shape them so that they're more or less the same (rough) shape. That way, the physboxes will trigger buttons, collisions, etc...

I tried that, but the func_physbox still passes through walls and fails to activate the button. I did it both ways, with a prop_dynamic parented to the func_physbox, and the func_physbox parented to the prop_physics, and neither worked.

Avatar
jwien001
36 Posts
Posted Dec 14, 2009
Replied 7 days later
HMW, I should not have doubted you. I went back and tried out the func_clip_vphysics which worked better than I originally thought. I was also able to get the button to work as well! It was nothing personal, I was just hoping for all the work to be done on the mirror side, but this works perfectly.

This thread is resolved and can be locked. Check out my working mirror concept demo here.

Avatar
HMW
806 Posts
Posted Dec 15, 2009
Replied 23 hours later
No problem, I'm glad you got it working :smile:

I was still looking for an ending puzzle for the map I'm working on. I might use this mirror setup, so thanks for the idea!

Avatar
jwien001
36 Posts
Posted Dec 15, 2009
Replied 18 minutes later
No problem. I'd love to see different ways to implement this.
Avatar
rendermouse
34 Posts
Posted Jul 22, 2011
Replied 1 year later
This thread was VERY helpful in helping me understand how to work around the limitations of using the logic_measure_movement entity. The func_clip_vphysics brushes are the perfect solution for limiting the movement of the parent object while making it appear that it is the linked object that is colliding.
Avatar
Omnicoder
299 Posts
Posted Jul 22, 2011
Replied 1 hour later
I'm surprised no one here has heard of prop_mirror.
Avatar
ChickenMobile
2,460 Posts
Posted Jul 22, 2011
Replied 9 hours later

Omnicoder wrote:
I'm surprised no one here has heard of prop_mirror.

Have you used it? The leafs go crazy and sometimes your character disappears.

Avoid prop_mirror xD

Advertisement
Registered users don’t see ads! Register now!
Avatar
Omnicoder
299 Posts
Posted Jul 22, 2011
Replied 1 hour later

chickenmobile wrote:
Omnicoder wrote:

I'm surprised no one here has heard of prop_mirror.

Have you used it? The leafs go crazy and sometimes your character disappears.

Avoid prop_mirror xD

It appears Valve modified it since release. I tried one in a map the first day and it was solid and didn't have rendering issues. No idea what's wrong with it now.