Inside3D!
     

is this code refering to mirrors as reflections in quake?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Programming Tutorials
View previous topic :: View next topic  
Author Message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Sun Dec 13, 2009 1:36 am    Post subject: is this code refering to mirrors as reflections in quake? Reply with quote

i was just wondering or is it something else? if anyone would mind letting me know im sure there's plenty of people who know more about this than i do.

http://www.quake-1.com/docs/quakesrc.org/96.html
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Sun Dec 13, 2009 1:46 am    Post subject: Re: is this code refering to mirrors as reflections in quake Reply with quote

ceriux wrote:
i was just wondering or is it something else? if anyone would mind letting me know im sure there's plenty of people who know more about this than i do.

http://www.quake-1.com/docs/quakesrc.org/96.html


Load up GL ProQuake 4 or DX8 ProQuake 4 and go to the start map's easy hall. Type r_mirroralpha 0.5 in the console. There is only a single texture supported in GLQuake for the mirror effect, it's that one.



You will see the above.

IF your video card supports it. My understanding is that ATI cards don't support that at least under OpenGL.

Aside from original GLQuake, I'm not too sure what other engines support r_mirroralpha. I'm kind of sentimental about original GLQuake and was like "Wow!" at the time (1999 or so for me, maybe early 2000) and I wanted this feature in ProQuake.

/Ha! I was using DX8 ProQuake and as I was typing in the console, I didn't really know whether or not the Direct 3D 8.1 wrapper MH wrote was going to support this. Very Happy MH was thorough!
Back to top
View user's profile Send private message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Sun Dec 13, 2009 2:09 am    Post subject: Reply with quote

IF i implemented this, how would i apply the reflection to specific textures?
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Sun Dec 13, 2009 2:21 am    Post subject: Reply with quote

ceriux wrote:
IF i implemented this, how would i apply the reflection to specific textures?


The texture name is hardcoded. I don't remember the texture name, but just look for anything "r_mirroralpha" in the source and in the vicinity you'll find where it checks for the hard-coded texture name.

And then you could change it so every texture that starts with "mirror_" uses the effect. Or however you choose to do it.

Code:
if (!strncmp(texturename, "mirror_", 7)) {
          // Mirror texture
          // Do mirror stuffs!
          ....
Back to top
View user's profile Send private message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Sun Dec 13, 2009 2:24 am    Post subject: Reply with quote

i might see if i can get reflections like this on water.
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Trickle



Joined: 26 Mar 2009
Posts: 44

PostPosted: Sun Dec 13, 2009 2:29 am    Post subject: Reply with quote

this should be added to Qrack
_________________
Back to top
View user's profile Send private message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Sun Dec 13, 2009 3:12 am    Post subject: Reply with quote

does anyone know the name of the texture that works as a mirror in id's wad?
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
goldenboy



Joined: 05 Sep 2008
Posts: 310
Location: Kiel

PostPosted: Sun Dec 13, 2009 8:26 am    Post subject: Reply with quote

Is it possible to have these textures somehow reflect light, too?

If you look at the RA room in dm6rq, the ceiling has these flames and angled copper plates above them - the idea behind that was that they are "medieval spotlights".

I can probably fake the effect later on, though :-/

Dunno if that sort of stuff is even possible in newer games Smile
_________________
ReMakeQuake
The Realm of Blog Magic
Back to top
View user's profile Send private message
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Sun Dec 13, 2009 12:54 pm    Post subject: Reply with quote

ceriux wrote:
does anyone know the name of the texture that works as a mirror in id's wad?


gl_rmisc.c

Code:
   mirrortexturenum = -1;
   for (i=0 ; i<cl.worldmodel->numtextures ; i++)
   {
      if (!cl.worldmodel->textures[i])
         continue;
      if (!strncmp(cl.worldmodel->textures[i]->name,"sky",3) )
         skytexturenum = i;
      if (!strncmp(cl.worldmodel->textures[i]->name,"window02_1",10) )
         mirrortexturenum = i;
       cl.worldmodel->textures[i]->texturechain = NULL;
   }
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Sun Dec 13, 2009 2:12 pm    Post subject: Reply with quote

Be aware that Quake's mirror code is really something of a hack. Carmack himself said (in GLQuake's readme) that it's not very robust but cool to look at, and also it wasn't carried forward to Q2, so while it was a rather neat little feature for the time, it's more of a "hey, you can do this kind of thing" gimmick rather than an essential feature of the engine.

There are a lot of things you need to consider when doing any mirror support in a modern engine - the overhead of rendering everything at least twice (and from different viewpoints, so rooms the mapper has designed to be fast might suddenly become real slow), how do you resolve the problems that are going to happen when 2 (or more) mirrors are pointing at each other (try this in real life and see what I mean), properly applying the mirror texture to a heavily tesselated surface (which may have more than 1 plane) and so on.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Wazat



Joined: 15 Oct 2004
Posts: 732
Location: Middle 'o the desert, USA

PostPosted: Sun Dec 13, 2009 7:17 pm    Post subject: Reply with quote

mh wrote:
...how do you resolve the problems that are going to happen when 2 (or more) mirrors are pointing at each other (try this in real life and see what I mean)


Whenever I try that in real life, it creates an infinite loop and crashes the RLServer. I wake up the next morning and realize I've gone back in time, and have to repeat the day over again until I get it right, like in the movie Groundhog Day. Don't try it in real life!
_________________
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Back to top
View user's profile Send private message MSN Messenger
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Wed Dec 23, 2009 10:00 am    Post subject: Reply with quote

Here is some code that more or less makes the above easily to single out with specific texture names on map load:

http://forums.inside3d.com/viewtopic.php?p=20023
Back to top
View user's profile Send private message
Ranger366



Joined: 18 Mar 2010
Posts: 72
Location: Berlin (Germany)

PostPosted: Sat Jun 26, 2010 4:45 pm    Post subject: Re: is this code refering to mirrors as reflections in quake Reply with quote

Baker wrote:
ceriux wrote:
i was just wondering or is it something else? if anyone would mind letting me know im sure there's plenty of people who know more about this than i do.

http://www.quake-1.com/docs/quakesrc.org/96.html


Load up GL ProQuake 4 or DX8 ProQuake 4 and go to the start map's easy hall. Type r_mirroralpha 0.5 in the console. There is only a single texture supported in GLQuake for the mirror effect, it's that one.



You will see the above.

IF your video card supports it. My understanding is that ATI cards don't support that at least under OpenGL.

Aside from original GLQuake, I'm not too sure what other engines support r_mirroralpha. I'm kind of sentimental about original GLQuake and was like "Wow!" at the time (1999 or so for me, maybe early 2000) and I wanted this feature in ProQuake.

/Ha! I was using DX8 ProQuake and as I was typing in the console, I didn't really know whether or not the Direct 3D 8.1 wrapper MH wrote was going to support this. Very Happy MH was thorough!


These HandSkins are awesome
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Sat Jun 26, 2010 9:30 pm    Post subject: Reply with quote

can do it with any of the textures but the thing is hardcoded Wink

could be interresting using some script method for setting the mirror flag on other windows.
Back to top
View user's profile Send private message
gnounc



Joined: 06 Apr 2009
Posts: 120

PostPosted: Sat Jun 26, 2010 11:00 pm    Post subject: Reply with quote

would be nice too to have the gun model be to the right for idle animation so it matches the reflection
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Programming Tutorials All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group