Forum

r_mirroralpha question ...

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

r_mirroralpha question ...

Postby Baker » Fri Jul 16, 2010 12:50 am

To anyone who knows and is bored ...

Image

What's r_mirroralpha doing exactly?

It is something like rendering to texture from the reverse visual angle it seen? Well, it can't be that precisely because it isn't doing a texture upload.

I suppose I can walk through it but it occurs to me that altering the r_mirroralpha code could be an awesome way to make a viewscreen in Quake by instead of rendering from it's own viewpoint, rendering from the viewpoint somewhere else in the map.

You could make a security camera so some such thing. I do wonder why some video cards (Radeons?) don't support r_mirroralpha. I could probably dig thru Google to find out what OpenGL thing it hates.

I might do some experiments and post shots here.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Downsider » Fri Jul 16, 2010 1:57 am

Biggest problem is the PVS and that you'd have to play with it to get it working in a networked game, I guess.
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby Baker » Fri Jul 16, 2010 2:48 am

Downsider wrote:Biggest problem is the PVS and that you'd have to play with it to get it working in a networked game, I guess.


Good point. I wasn't thinking about that part. I was thinking entities.

Probably would require something like sv_novis even to do a good test.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: r_mirroralpha question ...

Postby mankrip » Fri Jul 16, 2010 2:49 am

Baker wrote:It is something like rendering to texture from the reverse visual angle it seen?

Actually, GLQuake duplicates the whole scene's triangles, mirrors their positions accordingly to the mirror's position, and makes the mirror texture translucent. So, it's not a render-to-texture, it's more like the mirrors in Duke Nukem 3D.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Postby Baker » Fri Jul 16, 2010 3:03 am

Part of the reason I want to understand it is that in my dx8pro build I get this [a build of my engine that uses MH's Direct 3D 8.1 wrapper]:

Image

^^ Mirror texture appears thru wall.

Image

^^ Player gets "mirrored".

I have some cool uses for mirror alpha I'd like to experiment with.

Anyways, your explanation is helpful and maybe I can play around now.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby leileilol » Fri Jul 16, 2010 10:10 am

that's only bad alpha sorting

the way GLQuake does it is nothing special, and only breaks on very early cards (i.e. not Voodoo '96 hardware)
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: r_mirroralpha question ...

Postby Nahuel » Wed Mar 02, 2011 1:43 pm

Hello I have a question much noob
What engines do they support r_mirroralpha like glquake or proquake?
Does any equivalent exist to this effect?
Thank you!
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Re: r_mirroralpha question ...

Postby mh » Wed Mar 02, 2011 2:13 pm

John Carmack wrote:novelty features
----------------
These are some rendering tricks that were easy to do in glquake. They aren't very robust, but they are pretty cool to look at.


Kill r_mirroralpha. Kill it until it's dead.

I can tell you one engine that certainly doesn't support it... :lol:
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby Spike » Wed Mar 02, 2011 2:35 pm

mirrors work by:
draw scene, if you see a mirror, flag that you saw it but ignore it.
if you saw a mirror:
invert view matrix and reposition view and angles to mirror (based on plane).
flip culling side
(set up a clip plane so stuff in the mirror can't be seen closer to you than the mirror itself)
redraw scene using mirrored (will need to refresh pvs)
(remove clipplane)
revert to regular matrix
draw regular transparent mirror surfaces if mirroralpha!=0

I don't actually remember if quake does the clipplane thing, hence the brackets.

while drawing the mirror, you should retain the current values in the depth buffer, and not clear that - you want to draw only in the hole of the mirror.

you can make it more robust by using stencil tests allowing mirrors in areas that stand out, by using depthrange so mirrors will always be more distant, or so.
rendertotexture stuff is more robust, but also slower.

such mirrors are basically like duke3d's mirrors, except the mapper doesn't have to generate the world geometry.

Q3's portals are basically exactly the same idea, except for the viewmatrix+cullside.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest