Avatar

Sort of. (Off-Topic)

by uberfoop @, Seattle-ish, Tuesday, November 26, 2013, 20:37 (3775 days ago) @ Beorn
edited by uberfoop, Tuesday, November 26, 2013, 20:41

I knew ray casting, but I had to look up raymarching. Sounds processor-intensive…

If by "2.5D ray marching", you're referring to screen-space reflections a la modern games such as KZ:SF, they're in the middle of a complex tradeoff.

The cheapest way to approximate a perfect specular reflection is to use a pre-baked reflection image. Obviously baked cubemaps have a ton of issues; they don't react to dynamic objects, and the environment reflected off of objects doesn't parallax completely properly as you look at the surface from different locations.

There's a rock-solid fix to this: rather than pre-baking the reflection, render it in real-time. This is obviously very expensive; there's not a lot of difference between rendering your scene and rendering a reflection. The cost of rendering a reflection also increases as the graphics become more complex, so it doesn't necessarily become easier as hardware gets more powerful; the tradeoffs you'd have to do to get the effect today are comparable to those you'd have ten years ago.
Games rendering reflection maps in real-time often use lower resolutions, lower framerates, and/or downgraded effects in the reflections.

GPUs have enough bandwidth and programmable computational power nowadays that a compromise is available. If you have reflective surfaces, cast a ray at them and see where it bounces to in screen-space. If the ray bounces onto another object visible on-screen, you can reflect that object off of the reflective surface. This method becomes more costly as resolutions increase (since you're calculating rays for more pixels), but not so much as graphics become more complex (the rays can be cast the same regardless of how snazzy the visuals are). So in an era where GPU power is increasing faster than resolution, it winds up becoming an attractive approach over time (which it's what's happening now).
The big downside is that you can only reflect things in screen-space. There are a lot of games using screen-space reflections which wind up looking like garbage when objects at the edge of the screen are being reflected; things start wiping in and out on surfaces. Usually when no object to reflect is found, the game tries to cover this up by switching to reflecting a cubemap, but this solution usually isn't very perfect (look at the water)*.

*By the way, let's put this into perspective. That that is "the most graphically impressive game evar" running on a $3000 PC, failing horribly on reflection types that games were executing beautifully over a decade ago. For a technique that's just now being popularized (for understandable reasons, admittedly), it's insane how artifacty screen-space reflections are.


Complete thread:

 RSS Feed of thread