Announcement

Collapse
No announcement yet.

Lighting options for procedural generation

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

    Lighting options for procedural generation

    Hey guys, I'm working on a game that requires randomized levels so I'm generating them at run-time. Not surprisingly this is giving me really crappy lighting because nothing can be prebuilt. My question is what options are there if any for non-prebuilt lighting. Picture related, it's my current lighting. Click image for larger version

Name:	mqCS9ZA.png
Views:	1
Size:	386.9 KB
ID:	1138805
    Check out my weekly dev blog: The Undead Dev

    #2
    Also just for the record everything is placeholder assets for right now ha ha.
    Check out my weekly dev blog: The Undead Dev

    Comment


      #3
      You could use DFAO. Get a movable skylight and enable DFAO in the settings:

      under Rendering "AllowMeshDistanceFieldRepresentations" (Don't forget to restart the editor).

      Then simply enable "ForceNoPrecomputedLighting" in the world-settings and rebuild once. I get pretty good results with this.

      Comment


        #4
        Awesome ! I'll try that. Thanks!
        Check out my weekly dev blog: The Undead Dev

        Comment


          #5
          So I Implemented DFAO as was suggested and the lighting has definitely improved, but now I get no shadows and I get this weird moving dirt look on the edges of all of my meshes.Click image for larger version

Name:	ejVizWt.png
Views:	1
Size:	619.5 KB
ID:	1057076
          Check out my weekly dev blog: The Undead Dev

          Comment


            #6
            That sounds similar to Fortnite, which is what DFAO is designed for (procedural placement of static meshes). It has some quality improvements in 4.5. One thing you can try is to increase the distance field resolution on that mesh (under build settings).

            Skylight + DFAO shouldn't affect your directional light, did you disable it?

            Comment


              #7
              DFAO probably won't look to great on perfectly flat untextured models like that unless you tone it down (i.e. lower the skylight brightness). Might improve with 4.5 but have not tried it yet. You will probably always get a bit of moving noise with the DFAO so if you don't want that you might need to look at other options.

              Also try enabling the DFAO visualization, it's found in one of the menus in the viewport. Anything that is completely black is lacking distance fields so I guess they could potentially cause problems although I have not seen any issues with it yet.

              I currently use a skylight with intensity 0.5 mixed with a generic cubemap reflection in the post process volume. Gives me a pretty good looking resut allthough the cubemap prevents me from ever getting really dark shadows. the main problem I have right now is that metallic materials does not get reflections from anything but the cubemap. I messed around with the capture actors and enabling the diffuse capture on them as suggested in another thread but didn't get it to work well enough in a dynamically generated map where I need to also place the capture actors dynamically (works quiet well in a map were most things are static though). I'll probably revisit this after updating to 4.5.

              Anyway, I'll come back with some screenshots of what I currently have and how I have it configured once I get back home.

              Edit: As for the shadows disappearing, make sure that you directional light is either stationary or movable.

              Edit2:

              OK so I decided to just start a new project and make simple example scene.

              Starting with an empty project I built a simple scene with indoor and outdoor parts. Step by step this is what I changed to get a pretty decent dynamic solution.
              1. Enabled Distance field AO in project settings -> Rendering
                Allow Static Lighting = false
                Allow Mesh Distance Field Representations = true
              2. Restart editor to rebuild distance fields
              3. Increased Distance Field Resolution Scale to 2.0 on any mesh where I got black spots in DFAO (table and chairs)
              4. Adjusted the directional light
                Mobility = Movable
                Dynamic Shadow Distance Movable Light = 10000
                Num Dynamic Shadow Cascades = 4
              5. Added a skylight
                Mobility = Movable
                Intensity = 0.25
                Lower Hemisphere is Black = false
              6. Added ambient cube map to the Global Post Process Volume
                Cubemap Texture = DaylightAmbientCubemap (from engine assets)
                Intensity (0.25)
              7. Tweaked auto exposure in Global Post Process
                Min Brightness = 0.5
                Max Brightness = 1.5
              8. Tweaked screenspace reflections
                Quality = 100%
                Intensity = 75
              9. Added post process volume to inside part
                Cubemap Texture = T_Cubemap_01 (aslo from engine assets)
                Intensity = 0.25
                Priority = 1.0
                Blend Weight = 0.75
              Attached Files
              Last edited by Parkar; 09-26-2014, 03:08 PM.

              Comment


                #8
                Parkar: Thank you so much! This is exactly what I was looking for. I'll try this out and post the results tomorrow.
                Check out my weekly dev blog: The Undead Dev

                Comment


                  #9
                  Sorry it took me so long to post my results, but here they are. Parkar - I tried to follow each one of your steps and it Definitely improved my lighting. Thank you so much. I've still got some really wonky lighting issues though. Is it because I'm using flat un-textured models for my prototyping? My shadows seem way more jagged than yours. Is there something I missed?Click image for larger version

Name:	UyB5p2p.png
Views:	1
Size:	558.9 KB
ID:	1057316Click image for larger version

Name:	Cyj2OaM.png
Views:	1
Size:	506.5 KB
ID:	1057317
                  Check out my weekly dev blog: The Undead Dev

                  Comment


                    #10
                    Looks like it's a problem with the resolution of the shadow map.

                    What settings are you suing on the directional light?

                    The bigger area it needs to cover the worse it will look. You can counter this by increasing the max shadow resolution.

                    You can try different resolutions using the following console command r.Shadow.MaxResolution.

                    Default when using the epic setting is 1024 which works well as long as you can fade to static light maps after a fairly short distance but once you need shadows to cover 100 of meters you probably need to increase it.

                    I haven't done a whole lot of tweaking but seems to me it should be possible to get pretty good results using 2 cascades at 2048 once you get the transition distance right for an area that's a few hundred meters.

                    I have found that in many cases the shadow bias can also be lowered from it's default to get less light bleeding without getting a lot of shadow artifacts. If you take it to far you will start to have shadowing artifacts at steep angles though.

                    Comment


                      #11
                      Originally posted by Parkar View Post
                      1. Enabled Distance field AO in project settings -> Rendering
                        Allow Static Lighting = false
                        Allow Mesh Distance Field Representations = true
                      2. Restart editor to rebuild distance fields
                      3. Increased Distance Field Resolution Scale to 2.0 on any mesh where I got black spots in DFAO (table and chairs)
                      4. Adjusted the directional light
                        Mobility = Movable
                        Dynamic Shadow Distance Movable Light = 10000
                        Num Dynamic Shadow Cascades = 4
                      5. Added a skylight
                        Mobility = Movable
                        Intensity = 0.25
                        Lower Hemisphere is Black = false
                      6. Added ambient cube map to the Global Post Process Volume
                        Cubemap Texture = DaylightAmbientCubemap (from engine assets)
                        Intensity (0.25)
                      7. Tweaked auto exposure in Global Post Process
                        Min Brightness = 0.5
                        Max Brightness = 1.5
                      8. Tweaked screenspace reflections
                        Quality = 100%
                        Intensity = 75
                      9. Added post process volume to inside part
                        Cubemap Texture = T_Cubemap_01 (aslo from engine assets)
                        Intensity = 0.25
                        Priority = 1.0
                        Blend Weight = 0.75
                      I know it is an old thread but I just wanted to state, that these settings helped me a lot while building a procedural random dungeon level.

                      Be aware that step 2 'Restart editor to rebuild distance fields' can take some time if you already got some progress in your project.
                      The project loader just keeps standing at a fixed percent with no feedback. After some minutes I thought it had crashed but luckily I gave it some more (coffee) time!

                      A little preview picture, random dungeon on beginPlay

                      Attached Files
                      Blog: My GameDev Journey nerd-time.com - Twitter: @GamedevCala

                      Comment


                        #12
                        Wow, it looks awesome!

                        I'm working now in a procedural dungeon project, and I also had some problems with the lighting. I would like to try these settings that you suggest, but I just don't know how you did those pointlights (at least, it looks like your scene has some pointlights) work fine. Are they dynamic? Did you pre bake those lights in some way?

                        I just can't use dynamic point lights because the performance loss. Does anyone have some advice? (I would be very thankful! )

                        Comment

                        Working...
                        X