Using water with Raytracing

What’s the recommended way to use water when Raytracing is enabled? It looks horrible, and I saw somewhere on Discord that Raytracing is not compatible with water.
So what’s the recommended way to combine both? Is there a way to fall back to raymarched SSR only for the water?

Hey, first, I’d like to clarify when we say, Raytracing is not compatible with water.

What’s not compatible is the rendering of the water in raytracing. Meaning that, if you have ray traced reflections enabled, and you look at the ocean using a mirror, the water won’t be rendered.

However, if you have Ray traced reflections enabled for example, water is able to receive those ray traced reflections even for total internal reflections (when you are underwater looking at the water surface).

With that being said, in HDRP, in the Screen Space Reflection (SSR) override, there’s a tracing option.

The first option, is raymarching, the one you expect when you add SSR to your volume. This is great but you can only get what’s on screen, so you will have missing pieces of informations if you don’t have relfections probes fallbacks.

The second option is raytracing, which cost hell of a lot more but the upside is that you get to have information outside your current screen (like being able to retrieve objects behind you.. etc). However, the downside is that some features (like volumetric clouds or water for example) are not supported by raytracing, so they won’t appear using this tracing mode.

The last option is what we call “Mixed”. Basically, it takes the best of both worlds we talked about before. We start by using raymarching, and when we fail to intersect geometry with screen space information, we fallback onto raytracing, meaning it will cost less than full raytracing but we will still get more information than using just raytracing. This is the recommanded way to combine both.

Don’t forget, there’s also planar reflections which are a great way to have proper reflections without using raytracing as well.

You can see what I’m talking about with this simple illustration.

  • with SSR, you are missing offscreen information (top of the rocks)
  • with Raytracing, you get the full picture but you miss the unsupported features (trees)
  • With Mixed, you get everything back, at a fraction of Raytracing cost.

Mixed Tracing Reflections

More informations on the documentation here

Hope it clears things up :slight_smile:

Hi @chap-unity , I think I understood the concept. My issue is that the water does look bad as soon as Raytracing OR Mixed is enabled; these are screenshots of mixed/raytracing/raymarching. Only raymarching looks correct. raytracing and mixed both look (same) wrong.



Here is another example where the difference is more visible; in raytracing or mixed, the water looks like pixelated (or better a pixelated reflection of the sky); first is raymarching, second is mixed:


Couple of things. When using mixed or raytracing, there’s more options to tweak given that those algorithm are more complex.

One that comes to mind is that by default ray tracing do its thing in performance mode and by default performance is in half resolution. Mixed mode to avoid performance bottleneck uses the perf mode as well.

Also, there’s a max ray length that should be about 50m by default, which mean if anything is further than this, it won’t appear in the reflections.

Texture LOD Bias is at 1 by default to avoid aliasing but it could introduce some slight blurriness if you are looking for super crisp reflections.

Last but not least, keep in mind that when using regular raymarching sky reflections is not handled well, so that might be one of the difference you see as well.

Thanks for the explanation, it makes sense! It was indeed half resolution which made the mixed / raytracing version look blurry.
Now I don’t see much difference between raytracing and mixed, both look fine now, but what I don’t get what does not work with ray tracing in combination with water then?

You should test with stable water first. Flowing water could just look very different with proper reflections, SSR should not be the standard comparison cause it’s not perspective correct.

Seeing water in a mirror using Raytraced reflections.