Announcement

Collapse
No announcement yet.

Requesting improvements about planar reflections (4.12)

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

    #61
    Originally posted by Tuxmask75 View Post
    I miss the UDK version of reflect actor , any plans to bring back the render to texture feature for the planner reflect like in udk?! It feels very limiting as it is now, without being able to have a way to access the reflection inside the material. I would like to be able to have the flexability of render to texture.
    I'm planning to share a custom planar reflections plugin which will give you full render target access but I need this clip plane support pr to be accepted in order for it to work properly.

    Is there any chance this gets accepted for 4.13? pretty please? with sugar on top? ([MENTION=404]DanielW[/MENTION] ? )

    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


      #62
      Originally posted by TK-Master View Post
      I'm planning to share a custom planar reflections plugin which will give you full render target access but I need this clip plane support pr to be accepted in order for it to work properly.

      Is there any chance this gets accepted for 4.13? pretty please? with sugar on top? ([MENTION=404]DanielW[/MENTION] ? )
      The clip plane support Pr link is 404 error.

      Comment


        #63
        Originally posted by Tuxmask75 View Post
        The clip plane support Pr link is 404 error.
        The link works, you just need to have your Epic account linked to your GitHub account. Follow the steps here, then try again:
        https://www.unrealengine.com/ue4-on-github
        Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap

        Comment


          #64
          I got some real issues of performance with planar reflections. Is it possible to make the entire Folliage not to affect the planar reflections? Something like actor hidden in game but only for planar reflection?

          Comment


            #65
            This is what planar reflection has to involve into.. Image Proxies.

            This was done in unreal engine 3.
            https://www.youtube.com/watch?v=Hda_GJEN7WM

            Make Reflections Great Again

            Comment


              #66
              Is there any way to adjust the roughness of the reflection? It looks awesome but for me the problem is that it is making the wood floor look too polished/wet.

              Click image for larger version

Name:	0247d70e67.jpg
Views:	1
Size:	375.3 KB
ID:	1114184
              Portfolio

              Comment


                #67
                Code:
                void SetPlanarReflectionSettings(UPlanarReflectionComponent* p, bool t)
                {
                	p->ShowFlags.SetLightFunctions(t);
                	p->ShowFlags.SetSkyLighting(t);
                	p->ShowFlags.SetMotionBlur(t);
                	p->ShowFlags.SetScreenSpaceAO(t);
                	p->ShowFlags.SetRefraction(t);
                	p->ShowFlags.SetSubsurfaceScattering(t);
                	p->ShowFlags.SetPostProcessing(t);
                	p->ShowFlags.SetBloom(t);
                	p->ShowFlags.SetInstancedGrass(t);
                	p->ShowFlags.SetInstancedFoliage(t);
                	p->ShowFlags.SetAntiAliasing(t);
                	p->ShowFlags.SetAtmosphericFog(t);
                	p->ShowFlags.SetDynamicShadows(t);
                	p->ShowFlags.SetLensFlares(t);
                	p->ShowFlags.SetOnScreenDebug(t);
                	p->ShowFlags.SetEyeAdaptation(t);
                	p->ShowFlags.SetColorGrading(t);
                	p->ShowFlags.SetCameraImperfections(t);
                	p->ShowFlags.SetDepthOfField(t);
                	p->ShowFlags.SetVignette(t);
                	p->ShowFlags.SetGrain(t);
                	p->ShowFlags.SetSeparateTranslucency(t);
                	p->ShowFlags.SetScreenPercentage(t);
                	p->ShowFlags.SetScreenSpaceReflections(t);
                	p->ShowFlags.SetTemporalAA(t);
                	p->ShowFlags.SetLightShafts(t);
                	p->ShowFlags.SetPostProcessMaterial(t);
                	p->ShowFlags.SetHighResScreenshotMask(t);
                	p->ShowFlags.SetHMDDistortion(t);
                	p->ShowFlags.SetStereoRendering(t);
                	p->ShowFlags.SetDistanceFieldAO(t);
                	p->ShowFlags.SetDistanceFieldGI(t);
                	p->ShowFlags.SetSkinCache(t);
                
                	p->ShowFlags.SetAmbientOcclusion(t);
                }
                I figured out that I can manually disable most of the expensive settings from planar reflections. This cut reflection pass cost about 60% for me. If you find others stuff that can be safely disabled let me know.

                Edit: I noticed that these settings are visible from editor if you use planar reflection actor but hidden if you use planar reflection component.
                Last edited by Kalle-H; 09-24-2016, 05:41 AM.

                Comment


                  #68
                  I recently made big optimization for planar reflections that does not have infinite size. In our use case there are multiple reflection actors per level but those are quite small in size.(example swim pool or mirror). So I made system that construct frustum pyramid using 4 corner points of reflection actor and reflection camera position. From these 5 points I make 4 frustum planes and I make additional frustum culling check for all static objects. This is huge win for cases where planar reflection actor is not infinite. especially for mobile where occlusion culling is not helping at all. I also check object screenspace distance and cull objects that are too small. These usually cull about 70-80% of objects.
                  Code:
                  struct FStaticObjectActor
                  {
                      FVector pos;
                      float   radius;
                      AActor* actor;
                  };
                   
                  void DynamicPlanarReflectionCulling(const TArray<FStaticObjectActor> objects, UPlanarReflectionComponent* p, FVector reflectionCamPos)
                  {
                      p->HiddenActors.Reset();
                   
                      // Planar reflection is rectangle at z plane. Construct portal from reflection camera and 4 corner points.
                      FVector min = p->Bounds.GetBox().Min;
                      FVector max = p->Bounds.GetBox().Max;
                      FVector corners[4] = { FVector(min.X, min.Y, max.Z), FVector(min.X, max.Y, max.Z), FVector(max.X, max.Y, max.Z), FVector(max.X, min.Y, max.Z) };
                      FPlane planes[4] = { FPlane(corners[0], corners[1], reflectionCamPos), FPlane(corners[1], corners[2], reflectionCamPos), FPlane(corners[2], corners[3], reflectionCamPos), FPlane(corners[3], corners[0], reflectionCamPos)};
                   
                      for (const FStaticObjectActor& obj : objects)
                      {
                          // Hide objects that are outside of fitted frustum.
                          if ((planes[0].PlaneDot(obj.pos) > obj.radius) || (planes[1].PlaneDot(obj.pos) > obj.radius) || (planes[2].PlaneDot(obj.pos) > obj.radius) || (planes[3].PlaneDot(obj.pos) > obj.radius))
                          {
                              p->HiddenActors.Add(obj.actor);
                          }
                          else
                          {
                              // Hide objects that are too small from reflection camera perspective.
                              float d2 = FVector::DistSquared(reflectionCamPos, obj.pos);
                              //if (obj.radius / sqrt(d2) < 0.05)) // unoptimized
                              if (400.f * obj.radius * obj.radius < d2)
                              {
                                  p->HiddenActors.Add(obj.actor);
                              }
                          }
                      }
                  }
                  http://pastebin.com/21YZnCT3

                  This is quite simple and fast method for making planar reflections usable for us. It would be nice to see this kind of system to be integrated to actual engine code because this is bit duplicate checking and could be do much more efficient and general way withing engine. I also noticed that engine does not cull objects behind planar reflection. This also should be done always. Maybe frustum near plane could be swapped to culling plane without any additional cost with bit more efficient culling.

                  Comment


                    #69
                    Nice one

                    There is a performance hit even with no objects in the scene but culling should definitely help at least a little bit in heavy scenes.
                    But keep in mind that iterating over all the objects in the scene in order to cull them out could sometimes be bad for performance (if you are cpu-bound I guess).

                    Originally posted by Jenny Gore View Post
                    I also noticed that engine does not cull objects behind planar reflection. This also should be done always.
                    Isn't the clip plane supposed to take care of that?

                    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


                      #70
                      Originally posted by TK-Master View Post
                      Nice one

                      There is a performance hit even with no objects in the scene but culling should definitely help at least a little bit in heavy scenes.
                      But keep in mind that iterating over all the objects in the scene in order to cull them out could sometimes be bad for performance (if you are cpu-bound I guess).



                      Isn't the clip plane supposed to take care of that?
                      Iterating all static objects in compact array is super fast. Around 1000 objects in our scene cost less than 0.1ms. Renderer always do normal frustum culling, so if engine would use this optimization then it wouldn't cost anything extra.

                      Clip plane will cull objects but this culling happen after vertex shader. So all objects that are rendered that are behind clip plane will still cost extra draw calls and vertex shader performance. This could be fixed by easily by replacing frustum near plane with clipping plane.

                      Comment


                        #71
                        Planar reflections could use some additional occlusion culling from main camera perspective. So after opaque pass render occlusion queries of bounding boxes projected to planar reflection plane using main camera depth buffer. So this would test if object reflection is even possible to see. These queries would be ready for next frame.

                        Comment


                          #72
                          Am I the only one with massive performance problems with this in 4.14 and 4.15? (https://answers.unrealengine.com/que...ection-co.html)
                          S. Hein, CEO, IT-Consulting Hein - IT-Service and 3D Visualisation

                          Comment


                            #73
                            Originally posted by TK-Master View Post

                            I'm planning to share a custom planar reflections plugin which will give you full render target access but I need this clip plane support pr to be accepted in order for it to work properly.

                            Is there any chance this gets accepted for 4.13? pretty please? with sugar on top? ([MENTION=404]DanielW[/MENTION] ? )

                            Any updates on this?

                            Comment


                              #74
                              Oh come on man this PR was made almost 2 years ago. Is it a big deal to accept such a minor change?
                              George Rolfe.
                              Technical Coordinator at Orbit Solutions Pty Ltd.

                              Comment


                                #75
                                Originally posted by duke22 View Post
                                Oh come on man this PR was made almost 2 years ago. Is it a big deal to accept such a minor change?
                                CaptureComponent2D already has option for clip plane usage.

                                Comment

                                Working...
                                X