⇠ Luna’s Blog

Refraction in Super Mario Odyssey

2018-11-05 · Luna

Note: This was originally a Twitter thread, and has been lightly edited for presentation here.

Super Mario Odyssey has this really neat feature where, if you ground-pound near a hidden item, it’ll briefly show the hidden item with a refractive material. It’ll then reduce the refractive index until it’s invisible again.

Let’s look at that in some detail.

Refraction in games is usually implemented by rendering all of the non-refractive objects in the scene, taking a copy of the screen, and then rendering the refractive objects, textured by displacing that copy of the screen. This can look odd with opaque objects in front:

This can also look odd when further effects are rendered afterwards. For example, it seems fog is rendered after refractive objects, as these coins in a New Donk City sub-area appear to show a more vibrant, un-fogged world:

I first spotted this behavior with these coins in the Lost Kingdom. They show a much more vibrant poison sea, suggesting that the sea’s color is altered somehow later in the frame, perhaps with some alpha-blended geometry on top of the sea?

A similar thing happens in the Sand Kingdom. This wall with the 2D platforming segment is originally the same color as the other walls in the area, but is somehow darkened later in the frame.

And in the Seaside Kingdom, it’s possible to see that even the water’s surface is rendered after the refractive coins. I’ve not been able to prove it conclusively, but at this point I believe all alpha-blended geometry is rendered after the refractive materials.