Announcement

Collapse
No announcement yet.

Distance Field Indirect Shadows prototype

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

    Distance Field Indirect Shadows prototype

    Hi, I'm Luoshuang. Just now I have finished DFIS for UE4. This idea is derived from Capsule Shadows directly, it extracts light direction information from indirect lighting cache, and generate indirect shadows by cone-tracing against distance fields.

    GitHub: https://github.com/AlanIWBFT/UnrealE...tree/DFIS-4.14

    Note:
    1. Currently tiled-culling is not implemented, so performance may be an issue.
    2. This technique shares the same drawback with RTDF: the umbra will always larger than what it should be ("over-occlusion"), So it will not always outperform Capsule Shadows.

    Before enabling DFIS:
    Click image for larger version

Name:	9.png
Views:	1
Size:	410.0 KB
ID:	1192442

    After: (all the objects have "movable" mobility)
    Click image for larger version

Name:	8.png
Views:	1
Size:	402.9 KB
ID:	1192441
    Last edited by Luoshuang; 08-31-2016, 03:04 AM.

    #2
    Between this and your multi-lightmap solution, you've certainly got my attention, this is pretty impressive. Two questions actually, one about each project.

    For this, does this work with fully dynamic lighting by any chance, or do you need to bake it down like in your github's readme?

    Also, for your multi-lightmap project, how scalable is it exactly? If I throw the multi-lightmap build at a scene around 16km large, would it work properly or do you find that for something like that, fully dynamic is still the better option?

    Comment


      #3
      Originally posted by Daniel.Wenograd View Post
      Between this and your multi-lightmap solution, you've certainly got my attention, this is pretty impressive. Two questions actually, one about each project.

      For this, does this work with fully dynamic lighting by any chance, or do you need to bake it down like in your github's readme?

      Also, for your multi-lightmap project, how scalable is it exactly? If I throw the multi-lightmap build at a scene around 16km large, would it work properly or do you find that for something like that, fully dynamic is still the better option?
      1. DFIS needs irradiance information from indirect lighting cache to work, but I think it may also extract irradiance from other GI solutions like LPV, PRT etc., of course you have to write it yourself...

      2. Multi-Lightmap Dynamic Blending has two major problems, one is storage size, another is light building time, so in my opinion it will not work in a huge scene.

      PS: Since MLDB will also blend indirect lighting cache, so MLDB+DFIS can fake some 'real-time' GI.
      PS2: MLDB can be seen as some form of PRT, but very limited.
      Last edited by Luoshuang; 08-31-2016, 12:10 PM.

      Comment


        #4
        This is really cool, especially that you used the object distance fields instead of the global distance field, since the global distance field is very low res.

        I'm thinking the ray marching of mesh distance fields should be integrated with the capsule shadow tiled culling implementation rather than done separately with its own upsample. Conceptually a mesh distance field is just a different occluder primitive than a capsule, it sill has a bounds on its influence so it can be culled vs tile bounds in the same way.

        The main downside of using mesh distance fields for indirect shadows like this is that you eat a large memory cost from enabling 'Generate Mesh Distance Fields' for the whole project just to get a few movable objects to cast. I'd probably add an opt-in on the UStaticMesh, much like you have to setup a USkeletalMesh for capsule shadows.

        Thanks for the inspiration!

        Comment


          #5
          Originally posted by DanielW View Post
          This is really cool, especially that you used the object distance fields instead of the global distance field, since the global distance field is very low res.

          I'm thinking the ray marching of mesh distance fields should be integrated with the capsule shadow tiled culling implementation rather than done separately with its own upsample. Conceptually a mesh distance field is just a different occluder primitive than a capsule, it sill has a bounds on its influence so it can be culled vs tile bounds in the same way.

          The main downside of using mesh distance fields for indirect shadows like this is that you eat a large memory cost from enabling 'Generate Mesh Distance Fields' for the whole project just to get a few movable objects to cast. I'd probably add an opt-in on the UStaticMesh, much like you have to setup a USkeletalMesh for capsule shadows.

          Thanks for the inspiration!
          Thank you Daniel! Will it come out in 4.14?

          Comment


            #6
            Not sure, I haven't started coding it yet =)

            Comment


              #7
              ok, had to log in just to say wow! This is what we need! Having characters with indirect shadows is awesome, but it's a shame to see them interact with chairs for example that cast no shadow at all. Adding capusles for those is not pretty! This however is a very nice!
              Like DanielW said, there should be an option to opt-in to specific staticmeshes.

              Comment


                #8
                Originally posted by Norman3D View Post
                ok, had to log in just to say wow! This is what we need! Having characters with indirect shadows is awesome, but it's a shame to see them interact with chairs for example that cast no shadow at all. Adding capusles for those is not pretty! This however is a very nice!
                Like DanielW said, there should be an option to opt-in to specific staticmeshes.
                Read the README.md on GitHub you will find that only meshes with "Distance Field Indirect Shadows" checked will cast indirect shadows. Daniel is talking about memory consumption when enabling "Generate Mesh Distance Field", since current DF management is not specifically optimized for only a few objects.

                Comment


                  #9
                  Github DFIS-4.14: I added r.DistanceFieldIndirectShadowRayStartOffset to address some self-shadowing artifacts.

                  Comment


                    #10
                    Click image for larger version

Name:	QQ截图20161103205214.png
Views:	1
Size:	44.9 KB
ID:	1117910
                    Now DFIS has entered the master branch! Thanks [MENTION=404]DanielW[/MENTION] !
                    Attached Files

                    Comment


                      #11
                      This is awesome!!!

                      Comment


                        #12
                        Thanks for this! I'm gonna try it out soon.
                        Lighting Artist II @ Crystal Dynamics
                        Former Lighting Artist @ Obsidian Entertainment
                        ArtStation

                        Comment


                          #13
                          FYI this didn't make it in time for 4.14 =(

                          If you want to check it out early be sure to get cl 3186069 as well, that made the resulting shadows look a lot more believable.
                          "Using a weighted geometric mean to combine multiple Distance Field Indirect Shadows, greatly reduces over-occlusion when overlap is high"

                          Comment


                            #14
                            This looks very interesting! Looking forward to seeing this as an official feature so we can start experimenting with it.

                            Distance Fields just keep amazing me on how much you can use it for..!
                            Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-source template)

                            Comment


                              #15
                              You can simply download the official master branch, DFIS is contained in it.

                              Comment

                              Working...
                              X