Transparent mirror?


(ALMighty) #1

I’ve been trying to create a transparent mirror, to make my water look cool. So far with no luck. I wonder, is it possible?

My current script:


textures/alm3dm5/watermirror
{
	qer_editorimage textures/common/qer_mirror.tga
	surfaceparm nolightmap
	surfaceparm water
	surfaceparm trans
	q3map_surfacelight 50

	portal
	{
		map textures/common/mirror1.tga
		blendfunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
		depthWrite
	}
        {
		map textures/alm3dm5/pool2.tga
		blendFunc GL_ZERO GL_ONE_MINUS_SRC_COLOR
		tcMod turb .2 .1 .1 .2
		tcMod scale .05 .05
		tcMod scroll .001 .001
        }
}



(ydnar) #2

Mirrors can’t be transparent in the Q3 engine. They’re rendered as special-case portals using an extra clipping plane, fully opaque.


(obsidian) #3

You’ll end up with a HOM effect if you do. However, you can add an environment map stage to your shader to fake the reflection. The results can be quite nice, ever play American McGee’s Alice? The Pool of Tears level uses this very effectively.


(ALMighty) #4

Ah, I thought so. Thanks ydnar! Just out of curiosity, can they be transparent in Doom 3?

I’ll try that environment map thing obsidian, as I remember Pool of Tears looking very nice :slight_smile:


(obsidian) #5

Doom3: No, same story. Although, Doom 3 can make use of cube maps (a form of environment mapping) to simulate reflections whereas Q3 environment maps were limited to sphere maps. Cube maps make use of 6 pre-rendered images (ie. skybox textures) to create more realistic relections based on surface normals. The main advantage of this is that as the water deforms and ripples, the rendered reflection will deform along with the water.

I’m pretty sure D3 water also makes use of some fragment program to simulate refraction, but that’s something else altogether.

Here’s a nice link with some useful info:
http://developer.nvidia.com/object/cube_map_ogl_tutorial.html