Announcement

Collapse
No announcement yet.

Requesting improvements about planar reflections (4.12)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    #46
    Originally posted by DanielW View Post
    There is occlusion culling on the planar reflection component - the whole reflection pass is skipped when it is invisible. It really only kicks in for localized components like a mirror. There's a limitation in the occlusion system where if the camera near plane intersects the bounds of a component, that component is always visible. That will cause the planar reflection for water to continue rendering when you are above it and you look up. That's something we could improve.
    In my test near plane didn't clip the component AABB. Does system use bounding box or spheres?

    Comment


      #47
      On iOs metal clip plane does not work. Is this known problem?

      Comment


        #48
        So I have implemented a little plugin which can resize a rendertarget at runtime and also update the SceneCapture2d component in editor to the reflected viewport camera position (so that it can be previewed in editor).

        There is no way getting around the fact that the clip plane needs to be enabled via modifying engine source though, I will be submitting a pull request soon.
        The clip plane can potentially be used for other things as well btw, like portals!.. so it's definitely something that the SceneCapture2d component needs to have.

        Initial tests show up to ~10% performance improvement compared to the regular planar reflection actor! that is with the default SceneCapture2D show flags.. a significant improvement can be achieved by disabling various features like dynamic shadows.
        The downside of course is that you have to implement the reflection in the material side manually to account for fresnel, normal distortion, roughness etc. but at least you have full control to do whatever you want with the render target.

        On that subject, do you guys have any advice in how to go about implementing roughness? I'm currently experimenting with blurring the texture but it seems expensive and not exactly "physically correct"
        Hopefully I will end up with a couple of material functions to do all those things as simple as plug and play.

        Roughness test #1 (spiral blur):

        4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
        WIP Interactive Water Shader, WIP 2D Water Sim
        WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

        Comment


          #49
          Yeah the whole "blur for roughness" thing is only going to get you relatively bad looking results unless you have enough resolution, not too mention "physically incorrect" as it were. Still, if you really must have it, you're not going to do much better (or worse) than your initial test right there.

          Comment


            #50
            To avoid leaks you should test visibility of sample and weight by that for blurring. Actually this should be done for distortion too. If ray from distorted sample towards eye is not visible from camera(depth buffer test) then it potentially cause visible leaks. This can be seen if you are in cave then distorted samples can reflect sky even that camera is fully inside the cave.

            Comment


              #51
              Clip plane pull request: https://github.com/EpicGames/UnrealEngine/pull/2491

              Originally posted by DanielW View Post
              Material quality level is a good idea. LOD controls will be important too.
              That sounds like a great optimization
              I would kindly request to keep in mind to also add these in the SceneCapture component (when and if this ever gets implemented of course).

              4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
              WIP Interactive Water Shader, WIP 2D Water Sim
              WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

              Comment


                #52
                [MENTION=1127]TK-Master[/MENTION]:

                Very cool!

                If at least Epic makes scenecapture class extendable, removing it from minimal API, you could implement this without rebuilding full source code or waiting for a pull request to be merged.
                From what Tim Lincoln says in this post (https://answers.unrealengine.com/que...captureco.html, it could be very soon.

                The clip plane can potentially be used for other things as well btw, like portals!.. so it's definitely something that the SceneCapture2d component needs to have.
                That's what I think too. That's why it could be so useful.

                Initial tests show up to ~10% performance improvement compared to the regular planar reflection actor! that is with the default SceneCapture2D show flags.. a significant improvement can be achieved by disabling various features like dynamic shadows.
                Absolutely. On my side, I found that the most significant improvement is by disabling "deffered lighting".

                What would be the workflow with a clipping plane enabled in the scenecapture actor? For example, in the screenshot you posted, do you still use a planar reflection (actor or component) or a scenecapture actor located under the floor by blueprint stuff? How does it work?

                About roughness: your screenshot looks good to me, even if not perfectly physically correct (but anyway nothing really is in real-time graphics. When you play a game, the point is only: does it look good or not?).
                By "frosting" reflections a little bit with a normal map (very small tiling voronoi cracks texture for example) and fading reflections as they go deeper "under" the ground by postprocess material stuff, it could be pretty good imo. However, frosting blurred reflections is necessary on a rough surface.
                Last edited by EdWasHere; 06-10-2016, 06:26 PM.
                GLASSES & WATER SHADERS & CUSTOM PLANAR REFLECTIONS on my Youtube Channel: https://www.youtube.com/channel/UCP2...26Y2bEV4kfl9kA

                Comment


                  #53
                  Originally posted by EdWasHere View Post
                  What would be the workflow with a clipping plane enabled in the scenecapture actor? For example, in the screenshot you posted, do you still use a planar reflection (actor or component) or a scenecapture actor located under the floor by blueprint stuff? How does it work?
                  TK gave me a copy and I've been testing it out for the past few days. Basically with the code changes adding in the clip plane you can create an actor (he's done this in a plugin) that captures a render target, which is then usedin a material. With that done, it looks and acts nearly identical to a Planar Reflection actor, but has so much more control. You don't need the PlanarReflection actor, just a blueprint based off the custom scene capture actor in the plugin, which can be as complex or simple as you want.

                  The intended use was for an ocean simulation (we're both working on the community ocean sim project), but he made sure it works great for just about anything. You can adjust the quality in multiple ways, such as reducing the resolution of the RenderTarget to improve performance. The 10% improvement is with a 1080p RenderTarget. With a 720p RenderTarget the performance gain becomes 30% or more, but the quality difference is very minor. For something like a mirror you'd want full resolution, but for something like an ocean where the reflection shouldn't be perfect in the first place due to surface distortion breaking it up, it's a huge savings.

                  The main reason this is such a big deal for us is that it only gets applied to the surface(s) you want it applied to, and you can exclude any actors you don't want reflected. It makes this much more useful than the current PlanarReflection actor for our use case.

                  Really looking forward to having this added to source. It's also very lean on code changes (+24 lines that only run if the clip plane is enabled). He did a great job, it's really impressive along with the plugin.
                  Last edited by DotCam; 06-10-2016, 06:36 PM.
                  Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

                  Comment


                    #54
                    OK, thanks for these explanations.
                    The main reason this is such a big deal for us is that it only gets applied to the surface(s) you want it applied to
                    Out of curiosity: can't you get this using a planar reflections component instead of actor?
                    GLASSES & WATER SHADERS & CUSTOM PLANAR REFLECTIONS on my Youtube Channel: https://www.youtube.com/channel/UCP2...26Y2bEV4kfl9kA

                    Comment


                      #55
                      Originally posted by EdWasHere View Post
                      OK, thanks for these explanations.

                      Out of curiosity: can't you get this using a planar reflections component instead of actor?
                      No unfortunately. I'm using it as a component currently in my project, the component is pretty much identical to the Actor. Anything like landscape or objects in the water receive the reflection if they are within the Distance From Plane start/end. Even materials that are fully rough will get reflections currently, which is being fixed, but not having the control to specify what receives the reflection makes it almost unusable in our case.
                      Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

                      Comment


                        #56
                        Anything like landscape or objects in the water receive the reflection if they are within the Distance From Plane start/end.
                        Ok. In fact, when testing, I didn't even check this. I only tested on opaque meshes and thought that, obviously, for translucents, what's in the water wouldn't receive the reflections.
                        Last edited by EdWasHere; 06-10-2016, 08:07 PM.
                        GLASSES & WATER SHADERS & CUSTOM PLANAR REFLECTIONS on my Youtube Channel: https://www.youtube.com/channel/UCP2...26Y2bEV4kfl9kA

                        Comment


                          #57
                          Planar reflection actor should have automatic culling when camera is wrong side of plane. I am doing this at blueprint when camera is underwater but I can't see reason why this would be bad idea to do in engine in general.

                          Comment


                            #58
                            Could you assist with this Answer Hub bug report. https://answers.unrealengine.com/que...-on-metal.html
                            On Metal clip plane is not working. This affect both Mac and iOS.

                            Comment


                              #59
                              I am having a similar issue that is affecting my whole scene. I am at a dead end and I cannot respect the deadline.
                              Since I have lots of mirrors I upgraded to 4.12 so that I can use planar reflections in my project. They work well on vertical surfaces. On horizontal surfaces I prefer not to use it since of the problems you mentioned.

                              However I am now stuck with weird reflections on all horizontal surfaces. Please check my attachments.
                              Skylight, Postprocessing all disabled
                              I have deleted all horizontal planar reflection actors. No result.
                              I have disabled the planar reflections from the rendering options restarted the project and rebuild all shaders. Reflections remain.


                              What is causing this problem?

                              Click image for larger version

Name:	UE_412_Reflections_Bug_A.JPG
Views:	1
Size:	250.2 KB
ID:	1108960
                              Click image for larger version

Name:	UE_412_Reflections_Bug_B.JPG
Views:	1
Size:	240.6 KB
ID:	1108961
                              Click image for larger version

Name:	UE_412_Reflections_Bug_C.JPG
Views:	1
Size:	212.6 KB
ID:	1108962
                              Click image for larger version

Name:	UE_412_Reflections_Bug_D.JPG
Views:	1
Size:	310.4 KB
ID:	1108963
                              Click image for larger version

Name:	UE_412_Reflections_Bug_F.JPG
Views:	1
Size:	250.0 KB
ID:	1108964

                              Comment


                                #60
                                [SOLVED] For future reference - I had a planar reflection in one of the door blueprints that somehow corrupted the whole scene even thought the planar reflections were disabled. Sorry for the spam but I lost all week on this one. Maybe it helps others.

                                Comment

                                Working...
                                X