PDA

View Full Version : reflection accuracy



V-man
09-21-2002, 10:25 AM
If there are reflective objects in the scene, I imagine the typical solution is to use cube mapping for these objects and do a render to texture type of trick to get snap shots of the environment.

How accurate would you say cubemapping is as opposed to something like raytracing a scene.
(I asked this cause I;ve seen examples with raytracing vs some hardware method using cubemaps and they did not match. )


Also, if the reflective object is complex (ei. having concave areas), how to deal with that? Secondary cubemapping perhaps?

Peace!
V-man

Zeno
09-21-2002, 05:19 PM
Cubemapping is an accurate solution in the limit where either the environment around the object is infinitely far away and/or the object being cubemapped is infinitely small. Any violation of these criteria will cause a difference between a cube map reflection and a perfect raytrace.

However, people are notoriously bad at figuring out what reflections on irregular objects should look like, so you can really get away with a lot. I'd be willing to bet that you only knew the cubemap was wrong because you saw it next to a "correct" ray-trace of the same scene.

To do a shiny object with concave areas, my advice would be to split it up into convex areas and do at least one cubemap for each.

Also, any non convex shiny object will exhibit interreflection from some viewing angles, so you'll have to do some recursion (with a specified stopping depth) to get that effect.

-- Zeno

[This message has been edited by Zeno (edited 09-21-2002).]

jwatte
09-21-2002, 06:45 PM
Zeno,

I believe you ALSO need to add that the object is everywhere locally convex, which means that in no way can the object mirror itself to the viewer. If your object is not locally convex, then there are self-mirroring phenomena that won't show up in the environment map.

Korval
09-21-2002, 08:17 PM
jwatte - He covered that when he mentioned interreflection.

Really, the question comes down to this: is speed important? If render time isn't an issue, write a ray tracer. If it is an issue, however, then you'll have to make due with scan conversion techniques like environment mapping.

V-man
09-23-2002, 12:49 PM
Heh, been a long time since I visited opengl.org (1 day?)

I would like to apply hardware methods for this so I guess cubemaps is god's gift for better env maps. Unfortunatly multipass will be needed.Maybe render to texture...

The concave problem (self-reflections) is hard to deal with, since I guess recursion will be necessary + I need algorithms to figure out when and where this is necessary.

I remember someone having interreflections wth spheres, but that is awfully easy to do.

V-man

davepermen
09-23-2002, 09:36 PM
there are about two ways to get that right..

one: precalculating that stuff that was presented at the siggraph and then encode the envmap perpixel. its lowres but realtime perfect correct shading of the mesh itself. dunno how its called again.

two: raytracing. dunno how good you can combine it with standart rendering at all, but its, for accurate reflections, the only way to go..
hint: ever asked why there are no reflecting "columns" in the entryrooms of rich hotels in games? those reflections are nearly impossible to get right with todays methods.. "columns" sounds wrong, but google told this as english word for "säulen"

V-man
09-24-2002, 10:49 AM
>>>hint: ever asked why there are no reflecting "columns" in the entryrooms of rich hotels in games? those reflections are nearly impossible to get right with todays methods.. "columns" sounds wrong, but google told this as english word for "säulen"<<<

if by columns, you mean cylinder shaped tall beams for supporting the ceiling, then I dont see why that would be difficult to do. That would be like the shiny spheres case. Needs processing power, but it doesn't require model analysis so no need to spend days writing algorithms.

V-man

davepermen
09-24-2002, 12:43 PM
Originally posted by V-man:
>>>hint: ever asked why there are no reflecting "columns" in the entryrooms of rich hotels in games? those reflections are nearly impossible to get right with todays methods.. "columns" sounds wrong, but google told this as english word for "säulen"<<<

if by columns, you mean cylinder shaped tall beams for supporting the ceiling, then I dont see why that would be difficult to do. That would be like the shiny spheres case. Needs processing power, but it doesn't require model analysis so no need to spend days writing algorithms.

V-man


hm yeah, zylinders is a good word..

well, if you want an accurate reflection at the floor and at the top, then you can't use cubemaps at all..

Zeno
09-24-2002, 03:23 PM
That would be like the shiny spheres case

Ahh, not at all! A cylinder in a hotel lobby doesn't meet either of the criteria that I mentioned for reflections being accurate.

It is not infinitely small (especially in the vertical direction) and it's environment is not infinitely far away (worse than that, it actually touches the floor and ceiling). No single cubemap is adequate for simulating the reflections in this environment.

Now, if you had a shiny cylinder floating high in the sky with nothing nearby, then you could use a cubemap to get pretty accurate reflections on it.

-- Zeno

MelvinEng
09-24-2002, 09:09 PM
one: precalculating that stuff that was presented at the siggraph and then encode the envmap perpixel. its lowres but realtime perfect correct shading of the mesh itself. dunno how its called again.
=>could you point out where to find this? seems interesting alright...

two: raytracing. dunno how good you can combine it with standart rendering at all, but its, for accurate reflections, the only way to go..
=>btw does anybody here know of anything being done in the area of realtime ray-tracing?

Zeno
09-24-2002, 10:03 PM
=>btw does anybody here know of anything being done in the area of realtime ray-tracing?


This is pretty impressive: http://www.realtimeraytrace.de/

vshader
09-24-2002, 10:49 PM
Originally posted by MelvinEng:
=>btw does anybody here know of anything being done in the area of realtime ray-tracing?


i think davepermen (who likes the green smilies http://www.opengl.org/discussion_boards/ubb/biggrin.gif) is the guy to ask about that...from his posts i gather he is doing realtime raytracing.

MelvinEng
09-24-2002, 11:15 PM
Theoretically it would seem that the "ideal" way to do accurate per-pixel reflections using environment cube maps would be to have 1 generated for every visible pixel(short of doing ray-tracing that is)...which means we should theoretically get increasingly accurate results by subdividing the reflective surface into smaller and smaller pieces each having its own cube map(granted this can get realy messy). This would seem to be the only way to do accurate(or near accurate) reflections on graphics hardware.
I wonder if something along this line is being done?
More generally, does anybody know what new/innovative approaches are being taken to implement accurate realtime reflections that run on the GPU without resorting to software CPU-driven ray-tracing?

MelvinEng
09-24-2002, 11:38 PM
What about the possibility of ray-tracing on the GPU? (mentioned somewhere here...http://www.siggraph.org/s2002/media/papers.html)
Is the HLSL in OGL 2.0 flexible enough to do ray-tracing or something like that?

Korval
09-25-2002, 09:16 AM
Ahh, not at all! A cylinder in a hotel lobby doesn't meet either of the criteria that I mentioned for reflections being accurate.

It is not infinitely small (especially in the vertical direction) and it's environment is not infinitely far away (worse than that, it actually touches the floor and ceiling). No single cubemap is adequate for simulating the reflections in this environment.

Now, if you had a shiny cylinder floating high in the sky with nothing nearby, then you could use a cubemap to get pretty accurate reflections on it.

So stop using cubemaps.

The obvious (and 100% accurate) way to do this reflection is to simply redraw the geometry under the reflected surface. Since the surface is a flat plane (and happens to be axis aligned, which makes the math easier), this is a pretty easy thing to do. You reflect the geometry, and draw the floor with blending on so that it shows through appropriately.

Zeno
09-25-2002, 09:23 AM
Korval, I think you're misunderstaning the problem. They want accurate reflections of the environment in the column, not in the floor. Planar reflections are a trivial subset of the general reflection mapping problem.

-- Zeno

davepermen
09-25-2002, 09:43 AM
dudes, i just wait for my about3.6giga p4 and the radeon9700, then i can tell you whats possible in the topic of realtime raytracing.. http://www.opengl.org/discussion_boards/ubb/biggrin.gif (for sure, i want to combine the power of both, vpu and cpu.. http://www.opengl.org/discussion_boards/ubb/biggrin.gif)

V-man
09-25-2002, 12:15 PM
OK, nearby reflections is of interest to me. How bad would it look the cylinder in room scene with cubemaps. I would try it myself, but no time right now.

I once tried the simple reflection trick (flat mirror reflection) on a per polygon basis on a sphere. It looked pretty bad. Maybe my math was wrong.

V-man