Announcement

Collapse
No announcement yet.

Shadow catcher, possible ? Oo

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

    #16
    That Clip Plane was the last thought I had yesterday before leaving. And it works, so no more hiding/unhiding the highpoly object!

    But the SceneCapture is still very expensive. Is it always rendering the highpoly object and clips afterwards?

    The Base Pass of the SceneCapture has the most impact, the shadow calculation for one directional light cost only 5ms.
    The materials on the car also doesn't impact the FPS much, I tried a simple grey one for everything and gained only 1-2 fps.


    So Tick events go through the CPU and of course vertex shader instructions through GPU. I have to edit the Material of the ShadowCatcherPlane to implement those instructions? But I can't follow your instruction about the camera direction... Do you mean the SceneCapture when you say Camera? Thats a bit confusing for me, but hiding/unhiding the ShadowCatcherPlane seems not to have an impact on the FPS, so that can be as it is. Still i'm curios about your way of hiding it

    If i cant reduce the impact of the SceneCapture Base Pass, i have to dig deeper and find another way.

    For now the FPS without SceneCapture/Shadow is by 30...
    With = 12-13 FPS...
    Here some Stats:

    Click image for larger version  Name:	stats.JPG Views:	2 Size:	118.6 KB ID:	1371902
    Last edited by SebaSopp; 10-19-2017, 08:30 AM.

    Comment


      #17
      I am glad it worked, but yes using a scene capture at all in a scene with thousands of actors is going to be pretty expensive. most of that cost will show up as 'initviews' cost and actually be on the CPU. But in your case the base pass is pretty high too so the raw number of polys rendered could be an issue. When you capture for the final shadowcolor instead of the depth, it actually ends up being twice as expensive because for the view frame you are rendering the mesh plus shadows. If you switch to only depth version it will help some, and then you just have to add some nicer shadow filtering to the material itself which has a small gpu cost.

      If you do 'stat dumpframe' and search the log, you can find CaptureCommand and see the cost of the cpu side. There could be some bottlenecking going on that makes the gpu stats appear wrong.


      Sadly even if you tell the scene capture to only view 1 mesh, that cost will not change as the engine is not running an optimized path for this case, it still does all the view setup as normal then masks visibility at the end.

      I will have to think for a bit to see if there is some way to do this without the scene capture right now. Usually when we do this its on a very simple scene so the overhead is not so high.
      Last edited by RyanB; 10-19-2017, 10:25 AM.
      Ryan Brucks
      Principal Technical Artist, Epic Games

      Comment


        #18
        Excuse me, but i was a bit too fast to say that the clipping of the SceneCapture is working... It works fine, as long as I don't rotate Planes and SceneCapture (roll is ok, but not pitch and yaw). I update the Clip Plane Normal to the Forward Vector of my Capture Component before the capturing. Thats working, but I don't understand the Clip Plane Base values. My first thought was, to use the ShadowCatcherPlane location, but that's not working...

        However, independent of that problem the FPS count is still problematic by using a SceneCapture, it's a pity, that the masking of the visibility comes at the end. So the clip plane is more to understand as a masking than a real clipping?

        So maybe i should take a look back to the approach of the material from the Augmented Unreality plugin?
        It aligns the UV's of the texture, so it matches with the Image Plate. Activating this, costs only 1-2 FPS:

        Material:

        Click image for larger version  Name:	Ar2.JPG Views:	1 Size:	56.4 KB ID:	1372537

        ScreenAlignedUVsFixed:

        Click image for larger version  Name:	ar.JPG Views:	1 Size:	261.8 KB ID:	1372540


        The problem is, that the material is a normal DefaultLit one and so it's influenced by the intensity of the Directional Light. So with the "wrong" intensity the plane is visible...:

        Click image for larger version  Name:	ar3.JPG Views:	1 Size:	55.4 KB ID:	1372538Click image for larger version  Name:	ar4.JPG Views:	1 Size:	55.3 KB ID:	1372539

        Also i have to calculate the normal of the material per Tick, so the reflection intensity keeps steady in case of rotations. I subtract the directional light forward vector from the ShadowPlane up vector and normalize it. It works, but not perfect at extrem rotations...
        It would be nice, if there would be an Unlit Shading Model (or translucent blend mode), which still receives shadows (I know, it's a contradiction)...

        So i will take a deeper look into adding a custom shading model (this is the only tutorial i found about this yet).
        Sorry, if i write too detailed about all this, but maybe it helps other users as kind of a tutorial...


        Here is the line about the CaptureCommand from the Log:
        [2017.10.20-11.51.19:896][703]LogStats: 68.182ms ( 2) - CaptureCommand - STATGROUP_RenderThreadCommands - STATCAT_Advanced
        Last edited by SebaSopp; 10-20-2017, 07:59 AM.

        Comment


          #19
          A little update: The calculation of the Clip Plane Base/Normal values is now correct and the clipping is working.

          Comment


            #20
            Hmm, I have a stupid way to cal shadow catcher result(shadow only). hope this helps.
            change the all shader in to grey,no texture.
            render it out 2 times , frames with shadow and frames without shadow.
            then divide these two images, and you get a shadow only that you can multiply to other images such as the background. if you will get some zero pixel and you might get error pixel after divide. please clamp it.

            Comment


              #21
              Hey bluearc,
              thanks for your input. Well I get some results with that technique. But because I have to do the SceneCapture two times per tick for two RenderTargets, this will impact the performance for my highpoly model even more. And as far as i understand it, I have to change all Materials from my normal one to a grey one (and back) per tick. I think it is easier and faster to hide the model... Or to use the Cliplane.

              Comment


                #22
                Hey Ryan, I just wanted to check, if there are any news about a faster shadow catcher setup. Maybe the ARKit got a material/technique to create the shadows more efficient? (Also as far as i know it uses forward rendering...)

                Comment


                  #23
                  Hey SebaSopp. Shadow catchers or casters are working fine with composure pipeline.

                  Comment


                    #24
                    afaik the composure plugin only allows to create composting inside the Editor. And there you can render out videos or pics. My project has to be a stand alone application...

                    Comment

                    Working...
                    X