- Mar 24, 2008
- 106
- 13
Ever wanted realtime reflections in your map, like a polished floor, or a mirrored wall? I know the HL2 engine is archaic, and doesnt really support reflections (other than the cheesy env_cubemaps). So here is an old trick I used from a map I made for Shadow Warrior (read your history kiddies)
The illusion is simple really. Lets say I had a scene like this (which it just so happens I do in the map I'm currently working on)
And lets say you want the river to be reflective. Just select any of the brushes and models you want to reflect, click into the front or side view and press Ctrl+I. This will flip them upside down. Make sure your texture lock button (the TL one at the top) is clicked on when you flip the objects. Otherwise the textures wont flip with the brushes. Then just move them down to align at the reflective surface. You'll end up with something like this:
Then just put a brush with a transluscent texture at the reflection plane, and the illusion is complete. You could use a glass texture for a mirror surface for instance, or make your own, like I had to for the icy river.
Now, here's the most important part:
This can be an absolute framerate killer if its not done right!!!
You'll need to go through and delete any surface that wouldn't reflect. In my example, for instance, all the contents of the cabin's interior would get deleted, as well as the back walls. The top of the roof would get a nodraw texture, since only the underside of the eaves would reflect. All floor surfaces get deleted, since they dont reflect. You get the idea.
Also, this can be an absolute Vis killer. Make sure everything in your bizarro world is either a func_detail, displacement, model, or anything else that doesnt get processed in vis.
Some other caveats. If you're reflecting models that are very asymmetrical, then the illusion doesnt work, since you can't flip models (unless you actually make a custom model). In my example, I lucked out since the 2fort bridge model is symmetrical.
Another caveat is that player models obviously wont reflect. So everyones a vampire in your mirror.
If its an outdoor scene, there are some other considerations. Obviously the sun is going to keep shining down into your bizarro world. That means the underside of things will get lit instead of the top. If you have a very transparent surface, this may become an issue. It wasnt really noticeable with my ice texture. Here's the end result:
And if you plan to reflect the sky, you'll probably want to make a custom sky texture thats mirrored at the horizon, like this:
Well, its sucks that in todays day and age that we need to use these old tricks to get around engine limitations, but there ya go.
The illusion is simple really. Lets say I had a scene like this (which it just so happens I do in the map I'm currently working on)
And lets say you want the river to be reflective. Just select any of the brushes and models you want to reflect, click into the front or side view and press Ctrl+I. This will flip them upside down. Make sure your texture lock button (the TL one at the top) is clicked on when you flip the objects. Otherwise the textures wont flip with the brushes. Then just move them down to align at the reflective surface. You'll end up with something like this:
Then just put a brush with a transluscent texture at the reflection plane, and the illusion is complete. You could use a glass texture for a mirror surface for instance, or make your own, like I had to for the icy river.
Now, here's the most important part:
This can be an absolute framerate killer if its not done right!!!
You'll need to go through and delete any surface that wouldn't reflect. In my example, for instance, all the contents of the cabin's interior would get deleted, as well as the back walls. The top of the roof would get a nodraw texture, since only the underside of the eaves would reflect. All floor surfaces get deleted, since they dont reflect. You get the idea.
Also, this can be an absolute Vis killer. Make sure everything in your bizarro world is either a func_detail, displacement, model, or anything else that doesnt get processed in vis.
Some other caveats. If you're reflecting models that are very asymmetrical, then the illusion doesnt work, since you can't flip models (unless you actually make a custom model). In my example, I lucked out since the 2fort bridge model is symmetrical.
Another caveat is that player models obviously wont reflect. So everyones a vampire in your mirror.
If its an outdoor scene, there are some other considerations. Obviously the sun is going to keep shining down into your bizarro world. That means the underside of things will get lit instead of the top. If you have a very transparent surface, this may become an issue. It wasnt really noticeable with my ice texture. Here's the end result:
And if you plan to reflect the sky, you'll probably want to make a custom sky texture thats mirrored at the horizon, like this:
Well, its sucks that in todays day and age that we need to use these old tricks to get around engine limitations, but there ya go.