Realtime dynamic reflection mapping?

Started by
10 comments, last by XBTC 23 years, 8 months ago
Hi! Do you remember Unreal´s intro....that awesome reflection on the floor? That´s what I want to do.I thaugt about it a little but I´m completely clueness how to do something similar without huge amounts of computation....Are there any tutes\algorithms out there to do that Unreal-effect?I need a solution which works good(fast!!!!) with a bsp\pvs world....And OpenGl.... Greets,XBTC!
Advertisement
I don''t remember unreal''s intro... but it is a portal engine so i guess the reflective surface is just a big portal with a mirror matrix attached to it.. in other words, they simply draw the scene twice. once normaly, and once mirrored.
Thanx for replying....
Ahrgg....I thougt I can avoid that portal stuff in my Q3-Viewer
....´Cause I never worked with Portals but it seems to be at least the fastest solution....Or are there others out there?

Greets,XBTC!

Or you could create a matrix for the reflections, and render it that way...

-----------------------------

1. "Diplomacy is the art of saying 'Nice doggie!'... till you can find a rock."

2. "Always remember you're unique, just like everyone else."

3. "If we don't succeed, we run the risk of failure."
-Dan Quayle
-----------------------------1. "Diplomacy is the art of saying 'Nice doggie!'... till you can find a rock." 2. "Always remember you're unique, just like everyone else." 3. "If we don't succeed, we run the risk of failure."-Dan Quayle4. If life gives you sour grapes, squash them and make wine!
I guess the draw-the-scene-twice aproach is right, but it must be some special trick involved. Unreals mirrors doesn''t slow down that much, the algorithm must be good. It is easy to do with portals, you''ll find lots of tutorials about portal engine and how to use them for mirrors and some physical impossible scenes that confuse the poor player ;-) nVidia released a good demo with some awesome looking metallic balls inside a room. This room had mirros, maybe you want to check it out. Since you code a viewer, you might maximize the performance by using static scenes. Just render the mirror image to a texture, use cubic environment mapping or similar to do the trick.

Tim

--------------------------
www.gamedev.net/hosted/glvelocity
glvelocity.gamedev.net
www.glvelocity.com
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
Thanx for all the answers....

"Since you code a viewer, you might maximize the performance by using static scenes. Just render the mirror image to a texture, use cubic environment mapping or similar to do the trick."

I code a "real" engine which enables one to run arround in Q3´s levels....Which means I have to recreate the reflection map every frame If I don´t want that fake environement mapping like for example in Q3 on all those armor-shards.....I mean one can use this approach for little objects like armor-shards where you don´t see that it is no real reflection(looks perfectly in Q3) but I think it wouldn´t look cool to cover a whole floor with that fake-mapping.....But I dunno perhaps I have to little knoweledge about cubic environement mapping(Could you give me some clues how it exactly works....)

However I´ll download Nvidias demo....But I have no GeForce to run it on .....Perhaps I have luck and it is one of those non-geforce demos....

P.s.:
Today it seems that the Radeon is the way to go....Especially if one wants to learn really new features however I think this forces one to use D3D....Or are there EXT´s available already?

Greets,XBTC!



Edited by - XBTC on August 9, 2000 9:27:55 AM
I don''t think that cube maps will solve the reflecting floor problem. The advantage of cube maps is that you can dynamically create the reflection by rendering an image for each face of the cube each frame. The hardware then maps the images onto your object. But it''s only useful for relatively small objects, not for an entire floor. Another issue is that this technique was designed for reflecting object, not for reflecting planes like mirrors.
If you decide to use to render your reflection with the reflection matrix, keep in mind that you are rendering from another point of view. So if you got a set of polys from your BSP algorithm, it''s won''t suffice to just transform this set with the matrix. There will be some polys missing in the reflection image. I guess portal rendering is the simplest solution.
Another solution may be rendering the reflected image (with your BSP) from the reflection viewpoint (the viewpoint reflected against the floor plane), and then load it into a texture and put it onto the floor. This has to be done each frame or each two frames for instance.
Lots of people use the stencil buffer. But I don''t know about software renderer
Thanx for your help guys....
Hmmmm....I´ll have to learn that portal-stuff....Everything else is just too brute force....

Intruger:I have to look into that perhaps there is some trick to use it with my app....Sofware Rendering....Who cares?

Greets,XBTC!
You have to : (algorithm)
-renter the world without the floor
-renter the world inverted without the floor (you can do one rotation and one transformation on the previous geometry or something similar )
-render the floor with alpha blending enabled.

Implementation :
(since you talk about a Quake III viewer ,I suppose you are an opengl’er. )
-Do the texture – state sorting normally but leave at the end of the vertex array the vertices of the floor (keep the position-index of the array where you start to store the floor) .
-Declare (glVertexPointer) and lock (glLockArraysEXT) the previous array ,so you are sending the geometry once
-Draw the geometry without the floor with one glDrawElements call, with number of elements the previous number.
-Do some transformations to invert the scene
-Do the same glDrawElements as above
-enable blending and render the floor.

That way you will get reflection to the entire floor. If you want partial reflection then you must use the stencil buffer in combination with the above.

This topic is closed to new replies.

Advertisement