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.
Also just for the record everything is placeholder assets for right now ha ha.
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.
Awesome ! I’ll try that. Thanks!
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.
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?
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.
-
Enabled Distance field AO in project settings -> Rendering
Allow Static Lighting = false
Allow Mesh Distance Field Representations = true -
Restart editor to rebuild distance fields
-
Increased Distance Field Resolution Scale to 2.0 on any mesh where I got black spots in DFAO (table and chairs)
-
Adjusted the directional light
Mobility = Movable
Dynamic Shadow Distance Movable Light = 10000
Num Dynamic Shadow Cascades = 4 -
Added a skylight
Mobility = Movable
Intensity = 0.25
Lower Hemisphere is Black = false -
Added ambient cube map to the Global Post Process Volume
Cubemap Texture = DaylightAmbientCubemap (from engine assets)
Intensity (0.25) -
Tweaked auto exposure in Global Post Process
Min Brightness = 0.5
Max Brightness = 1.5 -
Tweaked screenspace reflections
Quality = 100%
Intensity = 75 -
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
Parkar: Thank you so much! This is exactly what I was looking for. I’ll try this out and post the results tomorrow.
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?
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.
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
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! :D)