Download

Best Lighting Practices For Foliage and Landscape? [HELP]

I have been getting great interior lighting results for ArchViz like projects, but am currently failing in achieving even decent lighting on landscapes with foliage.
Hopefully someone can point me into the right direction or help me out if you maybe already have experience.

I have a big landscape (8kmx8km), it has materials on it and is full textured etc.
With dynamic lighting my landscape and grass with the grass layer looks really great.
However rendering all that takes up a huge amount of my GPU, so ofcourse performance isn’t all great on my GTX1080.
So I tried baking my scene instead, which meant I had to switch from the Grass Layer to the Foliage Tool, since Grass Layer doesn’t support static meshes/lighting.

I have a small patch of foliage to test out the lighting on my 8x8km landscape.
However the results are not at all what I want when I bake on medium quality.

I tried increasing the Landscape Static Lighting Resolution from 1 to 3 and even 16, but it seems to stop at 2. Increasing it beyond 2 does not make the tiles smaller in the Lightmap Density Debug View.

Can someone help me out with how to setup foliage in combination with static lighting on big landscapes?
Because I am trying to make this to be a massive map for multiplayer with mostly only foliage as assets that fill up the map.

Here are some screenshots of my results when baking, and an image of how it looked like with dynamic lighting of which is the result i wish to replicate.

As you can see in the Density Lightmap View, the terrain resolution is pretty small.
This is why I think my shadows are very blotchy.

So my question regarding “best practices” is;
Is it smart to increase the Landscape Static Lightmap Resolution?
Should I bake the lighting for all of my foliage, or does dynamic lighting only provide crips and clean shadows?
Having leaf shaders that make the foliage look wavy/windy, will this badly affect the static lighting in any way?

I am very new to landscapes and foliage, so any help is appreciated!

When using static shadows for foliage most people will set it to shadow only indirect because as you can see the lightmap resolution isn’t good enough to capture meaningful detail from direct light shadowing. You might be able to improve that by using virtual texture lightmaps (won’t work in 4.25 because VTLM is broken), but it probably isn’t worth it because your bake times will be insane.

If you want to improve the performance from dynamic shadows your best options are to start turning shadows off on everything that doesn’t absolutely need it (normally grass shadows are the first thing to get disabled) and using DF shadows for distant shadows instead of cascaded shadow maps

Thanks for the reply!

I am already using distance field shadows, so i’ll see if turning off the shadows of the grass will really improve performance (probably will).

And with that first sentence, do you mean that setting the grass to static indirect and then baking it is an alternative?
If so should I set my directional light to static or stationary, same goes for the skylight?

Yes, set grass to shadow indirect only and bake. With a stationary/static skylight this will result in a bit of an AO like effect, which may not be desirable, you’ll have to do some test bakes with different settings and decide what you like.

This all assumes you want to use static lighting though, to be perfectly honest, I would suggest you just don’t use static shadows at all for terrain or foliage. Static shadows don’t work at all for grass (as you have discovered) but they also don’t work great for tree self-shadowing either because they’re a worst case scenario: Tons of UV islands so most of the lightmap UV space gets wasted on padding.

For a small scene using static shadows on foliage can work okay (and if you’re targeting low end hardware you may not have a choice), but in a scene like yours with an 8km landscape it’s just a waste of time imo. Dynamic shadows can be a challenge to optimize but the result will be better in the end.

Distance field shadows are cheaper than cascaded shadow maps in general, sometimes significantly so. So you’ll get more performance benefit from them the nearer to the camera you start switching to them.

.26 it’s unfortunately not quite there for production, but I am liking the changes to the light they made so far. (Converted project side by side, looks slightly different for the better).
Possibly this is simply because of the real time recaptured skylight…

As far as shadows on vegetation goes, the rule of thumb - as stated- is go dynamic.

for grass, if you use vertex paint to power wind (dispalcement) you can save on a texture sample by also using it to darken the albedo, thus faking the shadow (darker roots, lighter tips).

When you are looking directly at the grass this isn’t the same as having shadow enabled, but it helps.

Possibly turning EarlyZ Pass on will help your performance - depends on the meshes, but its something I never see mentioned…

Thanks for all the replies, it really helps!

I have writen down the things you guys mentioned, so that I can google them a bit more in terms of how to control distance field shadows range and earlyzpass etc.

I have also made a smaller terrain, to test the lighting in on to see results with bakes faster.

Just as an FYI.
I enabled EarlyZ pass but it didn’t have any effect on my scene.
Probably because I don’t have much overdraw like an actual thick forest, where as my scene is very much open.

Final update on this thread;

Started to dig deeper into the setup of my scene and switched everything to realtime lighting.
I noticed my grass was set to a couple of KM in terms of distance, which is overkill.
By reducing the draw distance of the grass I gained a lot of FPS.
I also noticed that my Shadow Cascades were set from 3 to 10, so I reduced that back to 3 which let me gain about 20FPS.

I quickly placed some placeholder trees and rocks, and must say that I like the performance in my package in 1920x1080.
I get between 45-70FPS, depending on how many trees and rocks i’m looking at.

At 4K resolution I get about 35-50 FPS.

The FPS for my tastes is still too varied for games, but atleast it’s playable now!

@PotatoShield

Have you encountered an issue with lighting in the project where it appears that the camera is surrounded by shadowing of the terrain? I have it in at least two projects, and wherever I go, a shadowing of the terrain is following within a certain radius of the camera. It looks like it’s from the directional light. I tried disabling show flags of distance field shadows, Cascaded SM, DFAO in skylight, and AO in the post process and project settings. None worked except disabling dynamic shadowing in the show flags. But I’m using dynamic shadowing via movable directional and skylight, so I don’t understand where it is coming from.

most likely it’s just the distance of your shadow and your distance field shadow.

first thing to disable. Post process stuff.
second thing, volumetric fog.
third thing, camera.

Uaually its not a shadow, it’s an artifact that is brighter up to a certain distance, then darker with a visible/defined starting zone.
Calling it a shadow would imply that it is darker around you and brighter outward. If thats the case, then the post process may be doing something it should not.
If instead it is as I described. Then its usually the volumetric fog.

@OP
60fps at 4k is barely possible on a 1080ti but it is possible. You have to live with shadow artifacts from cascade unfortunately. Ray traced shadows only would be nice, but just enabling ray trace you loose performance.

If your card is better then a 1080ti and you only get 30fps, then something is most definitely wrong.

  1. amount of tris on screen. This could be up due to tessellation on landscape. If you breach 30k tris you start getting issues.

  2. drawcalls - if the amount is too high, the grass is probably doing something it should not.

  3. amount of meshes with dynamic shadows.
    the grass for instance can work fine without casting shadows. Each mesh casting a shadow impacts performance by a small amount. Having the grass cast a shadow everywhere would therefore cripple performance.
    To lessen the cost DFAO at a distance really helps. Even more when you set it to 8bit. Still, grass shouldn’t be generating distance fields either.

  4. amount of co-existing lights. Each light that casts a shadow has a cost. Putting too many near each other will eventually cripple performance.
    also, on that note. Point light and other lights default setting do not disable at a distance. If you take care of setting up the distance at which to transition them off, you gain a lot of performance back.

I’m running this project on a 1080, not a TI so the performance here isn’t too bad i’d say.
It’s been some time since I continued work on this project, so I don’t know anymore how it ran in 1080p.

In some other thread I already posted what bottlenecked my performance;
Shadows of the grass have a high impact, disabling this for me is not a solution as it makes the gras really ugly on the terrain.
To solve that I drastically reduced the dynamic shadow distance, this only means that mountains in the far distance are not receiving proper shadows (only distance field shadows).
But this is for a game acceptable.

Another thing is, that my trees had overdraw.
I bought an asset on the store that build billboard LODs from assets, this improved performance a lot.
Only problem is that this same asset changed the colour of my trees and there are some bugs that make my trees absolute white.

EDIT;
I forgot to mention that this is on max settings, and my GPU obviously shouldn’t be able to handle that.

Here are some screens of the project how it is now both in package and editor;

Just found my old/latest thread back, [HELP] Understanding Performance and How To Improve Performance - Content Creation - Unreal Engine Forums
Apperantly the last package I did make was in 1080p not 4K.