Realtime non-raytraced curved mirrors

Started by
8 comments, last by Ben Bowen 11 years, 2 months ago

I'm talking about surfaces too large to be environment-mapped (eg mirrors that span the length of an entire corridor wall).

Right off the bat it seems handling concave surfaces with minor curvature might be accomplished by the simple case of using flat mirroring + rendering to an FBO and manipulating texture coordinates to distort the mirrored image (the mirror edges would still not line up - which in turn wouldn't be too big of an issue if the mirror edges didn't touch any of the mirrored surfaces). Concave and uneven surfaces get far more complex pretty quickly, though.

An alternative would be to curve the geometry when rendering the mirrored image, but I would assume the actual implementation would be far more complex than theory in this case.

Has anyone done research into this?

Advertisement

An alternative would be to curve the geometry when rendering the mirrored image

Have you considered a technique similar to paraboloid shadowmapping.

Paraboloid shadow/environment maps are essentially light probes that are rendered from the view of the light source or the object. Make the object (in this case the mirror) large enough and sadly no amount of projection is going to help you as the projection becomes invalid the further you go from the center of the paraboloid.

I'm in particular talking about mirrors that span across an entire room - eg making a curved wall partially reflective the same way you'd make a floor or a ceiling (which is usually accomplished by reflecting the scene across the mirror's plane).

if the curvy object is not facing straight at you (e.g. if it's a bumpy floor), you could try screenspace reflections, those should work decent most of the time for those cases.

I guess you could do it by rendering from the mirrors perspective, but using a vertex shader to apply some custom math to transform the scene so that the mirror is flat (but the scene itself becomes "curved"/distorted)

Pretty sure you cant do that with a matrix though xD

Im not sure if that will be ugly (id imagine long edges would look wrong, but if you have small enough triangles and not too much curvature...)

o3o

The screen space reflections approach looks like it would do for a vast majority of cases that have to do with reflectivity, but not direct mirroring. I'll definitely do some reading into it!

You could try Billboard reflections, such as those from the Unreal Engine Samarithan Demo. You simply approximate the environment using textured planes and perform texture fetches at the ray-plane-intersections. Maybe not only texture fetches, but actual "pixel shading" of this geometry too. Do this for all the planes and output the color of the nearest sample. This should work pretty well if done correctly. If you combine it with screen space reflections and cube mapping, you can get almost perfect reflections. Billboard reflections as first fallback and cube mapping as second fallback. You simply fade in the billboard reflections, where no sufficient screen space information is available, and also fade in cube mapping, where no ray-plane-intersections are found. You might also want to use a signed distance field of the geometry to check whether the billboards are occluded. They did that in the Samarithan Demo to prevent bright billboards from leaking through buildings in the reflections.

Update: I have an even more crazy idea. You could also apply not only bump mapping to these billboards, but also parallax occlusion mapping. This way, you would have reflections that are not completely flat. But this would probably immensely reduce your performance.

The screen space reflections approach looks like it would do for a vast majority of cases that have to do with reflectivity, but not direct mirroring. I'll definitely do some reading into it!

Screenspace reflections are awful, in their own way. If you are really, REALLY careful and clever and spend an inordinate amount of time you can get a neat hacky effect out of them, but the amount of time you have to spend to get it working is, to me, not worth the results. And of course its going to be utterly worthless for any highly reflective materials like a mirror, because constantly shifting missing reflections are going to ruin the effect.

I would avoid trying to find a solution that works for massive mirrors in one fell swoop, and split up large mirrors into smaller, simpler surfaces that can get away with texture coordinate distortion for curvature.

Rasterization based non-linear beam tracing. Unfortunately the first bone-head to have implemented it has filed a patent at Microsoft...

https://duckduckgo.com/?q=nonlinear+beam+tracing

Their implementation isn't that great anyway. Microsoft blows.

This topic is closed to new replies.

Advertisement