Download

Water reflections for the noob

I have a large scene and using dynamic lighting. Using the translucent water plane from the library, I am not able to get plausible reflections. The sky seems to be reflected but not the static objects in the foreground.

6da60e30b61805eb2831fee68d27e6bc3726fd66.jpeg

By comparison, a similar scene using Unity (pretty much out-of-the-box)

WaterUnity.jpg

I added a SphereReflectionCapture actor with no effect. Is it even appropriate for this situation? And if so, do I need to do something else to make it work?
I also found that the checkbox for SSR on the translucent plane parent material was NOT checked. When I checked it, though, the editor returned two errors:
[SM5] warning x3206 and [SM5] error x4510

I read several posts about UE4 water but I am uncertain if the problem that I am seeing is my ignorance of the proper settings or something fundamental in the current state of UE4.

The Unity version must used realtime updating RT. It’s too expensive to next-gen engines, you shoudn’t use it in an actual game. Nowadays, many 3A titles don’t use this technique anymore.

This really depends on a few factors. Such as the amount of characters or objects reflected excluded or included, the complexity of the scene etc.

SSR have terrible setbacks (understandably) but this does not mean we shouldn’t have the option to choose. The issue of reflections has been going on for a long time in these forums without much of solutions. I believe there was a person who is a developing a plugin for this. Understandably the performance usage is heavy, but then again will it be really heavy if you choose to only reflect the hero object in the scene and leave everything else to SSR or static Sphere reflections? I think not perhaps. I think that kind of flexibility will be very helpful.

You should take a look at some 3A titles such as “Far Cry 4”, “Ryse: Son of Rome” … etc.

“Far Cry 4” used only static Cubemaps for water reflections.
“Ryse: Son of Rome” used SSR + static Cubemaps.

These games all look good to most players. The game graphics relays on so many other factors, not just water reflections. So, don’t bother to achieve perfect water reflection when it comes expensive. It’s not worth it at all.

I agree with you on that nothing should come at the expense of performance, but all those games you mentioned are tuned for a specific experience more or less similar to an extend.

I can think of a dozen examples of why I would love to have clean water reflections reflecting my character on screen at given moments in gameplay that none of the games you mentioned above have, and I would like no SSR artifacts ruining the moment the story unfolds on screen or not making it work at all. Then again I mentioned that it would greatly help to have the ability to “include/exclude” objects, I believe that would solve many performance issues and I wouldn’t mind hitting a few FPS lower than expected but still above the 30FPS range for given moments in time that contribute to an important part of the game.

All I’m saying is that having the option there doesn’t hurt.

Actually, I’d already implemented it in UE4. But it’s really expensive as I mentioned. Excluding objects could help little. It takes 5ms on GTX 660 @1080p rendering only the reflection part in an extremly simple scene. The overall frame rate could hardly reach 50 fps. If disabled all post process effects, it would take 3ms. Still too expensive though. I don’t even wanna use it in my project myself. I believe if it could be efficient enough, there was no reason Ubi and Crytek didn’t implement it for their games.

http://s29.postimg.org/9cw8oreyd/111.gif

I think there is something wrong with the implementation of the translucent water plane from the learning library (at least for 4.10). I was able to get a translucent material to render a foreground object using SSR though so I will make my own shader. I will also try 4.11.

I appreciate your caution about performance but realize there are other applications for the engine other than games. I am using it for a fast render-to-video project where even 0.5 FPS is a huge win over alternative (although more accurate) renderers.

The way I do reflections for flat & clear surfaces (such as mirrors or a settled lake) is to use a world-space cubemap and reflect only characters or other objects in real time (often using simplified materials and meshes for the reflected versions of those meshes.

GTA V does this for their city, they make a really low quality/resolution version of their city and use a render-texture type system then move the render-texture target in tandem with the players camera, it can give extremely realistic results. There’s no reason as to why you couldn’t include other dynamic objects in this.

Bare in mind though that you are taking on the full cost of rendering these scenes so keep material/shader complexity waaay down and shadows off/disabled for the render target.

HD, 1440p, and 4k resolutions are exasperating the problem. If you have very simple materials (EXTREMELY simple materials), few draw calls, few triangles, and a very powerful graphics card, you might be able to use proper scene reflect captures and get a good performance out of it. However, UE4’s complex renderer would not handle reflections very well at all. Just using forward per-pixel lighting on a water plane sends the rendering costs into realms that used to be reserved for parallax occlusion materials last gen. And since we’re now expecting higher resolutions than last gen, it’s much more difficult to make an accurate scene reflection possible.

Super Mario Sunshine had realtime reflections on its water. However, the water was an unlit translucent material without any normals or specularity or shading at all, just a texture with interesting mipmaps to make it “look” like it’s shaded in the distance, and the reflection. It ran 640x480 interlaced in 30 frames per second, materials were extremely simple, and there were framerate drops at certain angles. Doing the same thing nowadays with full scene GI, complex specular, and way more polygons at 4-8 times the resolution and 2 times the framerate is obviously going to be problematic.

While I would like to see Epic feature a reflection, normals, and simple specular water shader as an option for some more technically-inclined games at lower resolutions (as opposed to running the reflection, shadow, and GI environments), it’s still nigh-on impossible to expect it to run well. I made a level for a class project that used a giant bay with realtime reflections, and the rendering cost was so bad, everything else I made had to be extremely simple just to avoid dipping below 26 FPS. Even on a GTX 960 I suffer massive rate drops with scene captures. There has got to be a better way, but I don’t know it.

Here is the translucent water plane in 4.11 using SSR and the new Per-vertex translucency lighting (experimental). The reflection is distorted but at least it is there with no errors reported.

WaterUE411.jpg

nice, but what happens if you move the camera down until the real sphere is out of the view?

If you want to go down the SSR route, I’d suggest using basic shading on the water plane, and a stationary skylight to provide a generic reflection for your space wherever SSR fails. If you want per-pixel lighting in the forward shading path, it’s obviously going to be very expensive, but you need to set “r.ForwardLighting 1” in the console command, otherwise you won’t see any specular highlights on any glass materials at all.