DFAO and Static lighting

Hi !

I’m wondering if this kind of thing could be possible ?

(On this image, only the trees are dynamic and have a distance field).

Seconding this question; I’ve been thinking about the possibility of this for a bit too.

Being able to have the high quality static lighting for static meshes, but then being able to ground movable objects when they’re in ambient lighting using DFAO seems like a really powerful combination. I’m imagining it would look visually similar to the Last of Us indirect shadows tech.

where are the images came from? The second one is awesome !

Maybe the first one could be better if combined with DFGI.

HA…I also wanted to ask about this! :smiley: Sadly…DFAO only work when you set the skylight to movable, but then interiors arent lightmass occluded anymore :frowning:

I am joining the new UE4 archviz contest that heavily relies on indoor/outdoor mix and my idea was to use Lightmass for highquality interio lighting with nice shadowing and color bleeding and the whole outdoor area should be lit dynamically with DFAO + Skylight. It would be the perfect marriage for archviz since lightmass gets issues pretty fast with loads of foliage.

Cant we decouple the DFAO features completely from the skylight? Like put it into world settings for example? Just some checkboxes like “enable DFAO” and “enable DFGI” or something like this. It doesnt really make sense in my had why I have to use a movable skylight for it.

Hey Daedalus51,

Just a thought, I’ve not tried this with distance fields AO and lightmass, but you may have some luck setting up two maps separately, one interior and one exterior and then use the levels window to load in these two maps that can be in the same scene but have different lighting.

One thing that will happen though is the persistent will continually show the “lighting needs to be rebuilt” warning, but lighting will have already been built properly for the interior level with lightmass. Then it would simply be using the DISABLESCREENMESSAGES console command to execute in the level BP to remove the message. I’ve seen this post for a few days and wanted to play around with some tests, but unfortunately I’ve not had the time. :frowning:

I’ll see if I can do something this week and if I get decent results I can post back here.

Second thing, You can also disable DFAO via console command with r.distancefieldAO 0 to disable 1 to enable. That can likely be triggered by an execute node when entering or exiting an interior. Just a thought.

If you end up getting some good results, I’m definitely interested in seeing what you get. :slight_smile:

Hey Tim, thanks for the suggestions, but I doubt this would work for my case. To get a better understanding of what I need, please check this:

The main problem is that lightmass data seems to get invisible as soon as I turn on the skylight as movable. Thats the reason why it would be awesome to decouple the DFAO feature from the movable skylight. Maybe I want to use a stationary skylight, but I will have foliage for example set to NOT use static lighting. Then I would still need DFAO for the foliage, even I have a stationary skylight baked on all the other geo because it would look flly lit and flat otherwise.

I am really struggling with this right now and it kinda makes me sad. I joined your new archviz contest the vineyard and I had excellent plans for the environment. But since I startet testing out foliage with lightmass, my dreams start to shatter :smiley:
I mean, it does work…but only for a small amount of objects. I have just the garden that was painted with grass…just the garden…its already 19 000 meshes! Takes ages to bake and still looks bad because of low lightmap rez. When I increase the rez to make it look good, lightmass crashes because it ran out of memory. Trees are even worse :frowning: Distance Field lighting looks gorgeous, but completely destroys the photo real lighting on the building…so yeah :smiley: Sorry…guess its just not possible to get the best of both worlds^^ Will be interesting to see how the other people joining the contest will tackle these issue :slight_smile:


push? :smiley:

Yeah sorry…just want to get more opinions on this. I am also very interested in hearing how other people tackle this issue (even if you say things like: man you shouldnt do archiviz with a computer that has less than 64gb Ram xD) That would obviously be the least preferred answer since my mainboard only supports up to 32…but still…I would know that its just impossible to bake the ligh properly with less Ram :wink:

Cheers! :slight_smile:

I’m doing archviz with 16Gb of RAM, and have no issues whatsoever for the vast majority of my projects. Some rare scenes need a little more though (max for my projects has been 24Gb), so I’m going to get 32Gb all in all. I’m not really sure how anyone would NEED more than that honestly. At least not if you know any basics of optimization.

Just a quick idea for getting some ambient shadows from trees onto the ground / surrounding static meshes without needing to bake lightmaps for the hundreds or thousands you might have in your level or without DFAO.

Tree groupings from left to right -

  1. Static meshes all with lightmaps
  2. Dynamic meshes (no baked lighting)
  3. Dynamic meshes with a invisible shadow casting mesh

And here’s the shadow casting mesh -

I laid out the trees in the editor then exported them as an fbx file into maya where I fit a plane mesh to the canopy of the tree groupings. I then added the plane mesh into the level as a static mesh, disabled the mesh visibility, and built the lighting.

Results aren’t perfect but it’s better than having zero ambient shadowing like in the second grouping of trees. If you spent a bit more time on the canopy shadowing casting mesh you could probably get a bit better results as well.

Hey man…that sounds very interesting! Thanks for the tip…definitely going to try this out :slight_smile: But just out of curiosity…you are not using instanced foliage with this right?

@Frepp73 cool…sounds promising. However…did you work with quite some foliage in your archviz as well? I have no issues with baking a nice building etc. But I do get really strong issues when trying to bake the Kite Demo Trees (which I would consider to be exactly the high quality you want for archviz)

I used HillTree_02 and had one in my level with 256 lightmap rez. That one baked fine. Then I copied it 3 times so I had 4 of them and BÄMM=out of memory :frowning:

Thanks guys and cheers! :slight_smile:

Tbh I haven’t done scenes that have loads of foliage AND baked lighting. I’ve done scenes with lots of foliage, and scenes with baked lighting, but not both at the same time. I know even Epic said that it was impossible for them to bake even small parts of their Kite Demo and that they recommend dynamic lighting if you use lots of foliage. So yeah, maybe it’s hard to get the results you want without massive amounts of memory.
I am a little surprised that you ran out of memory that fast with only 4 trees though. I’ve done scenes with baked lighting and a decent amount of foliage (something like 30x30m of instanced grass and about 10 trees with a similar polycount as the Kite demo trees.

Yea that example was actually me placing them by hand…I just tried the same thing using instanced foliage and it looks like it’s a bit busted :frowning:
Seems like the engine lights the entire foliage cluster by averaging out the lighting so everything is lit the same whether it’s in shadow or not.

Also it seems like you can’t export out instanced foliage to fbx, it only exports out 1 version of each instanced. So positioning the shadow casting mesh in maya/max would be practically impossible.

I guess were back to hoping for that DFAO + static lighting combo.

It is possible. Just use r.AOApplyToStaticIndirect=True