Idea for mirrors


(Emon) #1

I was wondering recently, why do reflections cause so many performance problems? Many times I have seen mirrors that reflect only small amounts of geometry (I could view much more normal geometry without performance drops), and still have a significant impact on performance. I figure this is because the reflections calculate and render the stuff on the fly as opposed to reading from a precompiled file, correct?

If this is true, would it be possible to have a mirror that only reflects entities? What I’m thinking is, you could take all the brushes in an area and duplicate them and mirror them to create a real cheap mirror of the geometry. Of course, there are no reflections of entities here, although the effect of the geometry is flawless. So if it’s possible to have a mirror that reflects only entities, you could add that to the “mirrored” geometry. If my theory about why reflections are slow, this method, if possible, could provide identicle mirror effects with less of a performance drop.


(system) #2

You can make a shot of your geometry and put it into a shader. Now you have a reflection of your room, too and don’t need to build a lot of more brushes.

In unreal2 they used that stuff in some windows and doors. You can see the room reflecting (not really a reflection) but not the player.
It’s the most fps friendly stuff to do it i think.


(Emon) #3

Yes, good for reflection on a floor, glass, etc, that’s about it.


(cloudscapes) #4

For Unreal-like reflections we’d need cubic env mapping. And some script/tool that will take 6 screenshots in-game of where the reflective object will be. Current env mapping in Q3A is inacurate. Takes a lot of work to get something that might look like the reflection of a room. And of course you wouldn’t get all sides of the room.

Just a thought, would sneaking parts of a sky shader into a surface shader have potential? Because the skybox is virtually the same concept as cubic mapping. Only we’d have to map the skybox on an object with GL_ONE for a nice additive blend.

We should harass id to release a PR with this feature! :slight_smile: I can’t imagine it being too complicated to implement.


(Cardigan) #5

I did the ‘take a shot and env-map it’ thing in my new map Estatica - looks quite good, although its not really accurate of course. Took a lot of fiddling in PS to get the reflections where they needed to go on the texture (the rest of the texture was just filled with a generic ‘cloud’ texture to match the sky).

I tried the skybox idea too, but you can’t blend a sky stage so the water must be opaque for it to work. What’s more you can sometimes (depending on where the reflective shader is in relation to the rest of the map) see other geometry through the sky. :confused:


(Cardigan) #6

I did the ‘take a shot and env-map it’ thing in my new map Estatica - looks quite good, although its not really accurate of course. Took a lot of fiddling in PS to get the reflections where they needed to go on the texture (the rest of the texture was just filled with a generic ‘cloud’ texture to match the sky).

I tried the skybox idea too, but you can’t blend a sky stage so the water must be opaque for it to work. What’s more you can sometimes (depending on where the reflective shader is in relation to the rest of the map) see other geometry through the sky. :disgust:


(Cardigan) #7

I did the ‘take a shot and env-map it’ thing in my new map Estatica - looks quite good, although its not really accurate of course. Took a lot of fiddling in PS to get the reflections where they needed to go on the texture (the rest of the texture was just filled with a generic ‘cloud’ texture to match the sky).

I tried the skybox idea too, but you can’t blend a sky stage so the water must be opaque for it to work. What’s more you can sometimes (depending on where the reflective shader is in relation to the rest of the map) see other geometry through the sky. :disgust: