Eevee soft shadows for environment light

Since Eevee now has ability to render soft shadows from Area lights using some kind offset shadowmap accumulation technique, I was wondering of we could have the same for HDRI environments? It’s already possible for example in 3ds Max using pretty much the same technique:


It even handles small, high contrast hot spots such as sun disc very well!

Right now, in order to plausibly set up high contrast HDRI lighting in Eevee, one has to do following:
1, Add HDRI as environment.
2, Find all HDR spots on the environment map and replace them with actual lights Eevee can sample shadows from.
3, Manually match correct intensity, size and color of every single of these lights to the spots on HDRI, which is borderline impossible of the spots aren’t of primitive shapes.
4, In environment node setup, add rayswitch to use clamped version of the HDRI map for diffuse contribution only, as we do not want to wrap HDR version around diffuse, because it would cause double amount of HDR illumination, with half of it being blurred by diffuse normal wrap.

This obviously requires a lot of knowledge and precision to pull off successfully.

Whereas having an option to accumulate environment illumination shadows in the same way area lights now do it would be a bit slower (not realtime), but would greatly reduce both difficulty and room for error in Eevee’s HDRI illumination setup.

4 Likes

Totally agree with this, plus it will simplify GI lighting a lot.

Cheers!

The way to do this technically afaik is to find the sun the HDRI and place a sun lamp from there. The problem is that, while this will work well with some HDRI’s where there’s a very clear bright spot, it will probably not work well for others, such as indoor HDRIs. It would probably have to be an Eevee option.

It’s kindof a cheat/hack, albeit a useful one.

That’s the way of doing it manually. 3ds Max actually does the same thing Eevee uses for area light soft shadows, they just found a way to do it for HDRI too.

The basic way of doing it, and if I´m correct it was the way used by Nitrous in max, is to just sample multiple points in the environment and setup fake lights with the correct color and intensity of that point in the HDRI, you can increase the detail and quality hence it will be more samples, which means more fake lights with the sampled color and intensity, or lower the quality, which means less fake lights.

So in this case something similar can be done, and since they are not user-enabled lights maybe some kind of optimization can be done, also another thing could be to detect the brightest point in the HRDI and locate a directional light, or maybe have a threshold that will change the fake sampled light from point to directional one.

BTW when I say fake lights I mean internal ones, something transparent to the user.

I´m sure there could be more sophisiticated ways of doing this, but this could work and give us proper HDRI illumination in Eevee.

Cheers!

2 Likes

Sounds to me like they likely don’t do it as a sun lamp but precisely as area lights(or equivalent) for every sufficiently bright area/spot in the HDRI according to some clipping setting that can be controlled by user. Clearly this is just a guess but I reckon that makes sense.

Well what you describe is exactly what I have in mind for this.

But it is not super trivial and needs to not add a lot of overhead to the update system.
I just need time to see how we can implement it.

Doing it for 1 light can be trivial using spherical harmonic (since L1 gives you the intensity and the direction of the lighting). But for multiple bright spots in the HDRI, this can become more involved.

3 Likes

Are you talking about something like these old scripts? https://blenderartists.org/t/update-script-v1-1-image-based-lighting-in-blender/308199

Yes, I understand it won’t be easy, but I think it will be well worth it given how difficult (in regards to both skill and time requirements) it is to manually approximate the HDRI lighting otherwise. :slight_smile:

Instead of trying to identify a few bright spots it could importance sample the HDRI? Then it would light from a different location on the HDRI every sample, similar to soft shadows.

2 Likes

just a curiosity here:
in the case of “placing lights” in the bright spots of the HDRI,
are this going to be a different kind of light or are going to be inside the 128 limit for lights that Eevee has??

I don´t think this would be as actually placing lights, so I don´t think this will count against this limit, but I may be wrong :slight_smile:

If @NahuelBelich is talking of the GPU lights limit then yes, it would.

2 Likes

ouch! well… we will have to live with it :slight_smile:

Impossible to solve via multiple passes (group lamps to stay under limit, combine results)? At least for final render if not fast enough for interactive viewport.

I don’t think that is the case. For example when you enable soft shadows for Area lights, it doesn’t count as adding many more lights. It just accumulates shadows of a single light into a shadow buffer with a slight offset each render sample.

Too much broscience going on over here. Looking at it the way that Eevee will actually create some sort of invisible point lights around the scene for you based off the HDRI map is way too simplified way to look at it. It will be smarter than that, hopefully.

That was my understanding too, but since I don´t have a real clue I think we will have to wait and see what @fclem do with this :slight_smile:

Cheers!

Any news on this? This is quite old request that appears to be forgotten, yet this addition would likely significantly increase quality of the work users produce with Eevee.

To be honest, I would even settle with an “Initial implementation” which supports only one bright sport using the L1 SH sampling, with the more complex solution for multiple hotspots being revisited in future.

It would at least cover majority of HDRIs that just contain sky and a sun spot.

You can see the task here https://developer.blender.org/T68478

1 Like

Long time 3ds max and Substance Painter user and both have shadowed environment light. Come on guys, 3ds max viewport rendering suck on so many levels but they have environment shadows. Please prioritize this more. Environment schdows would help so much in EEVEE, I think for now it’s the most annoying difference in many scenarios/scenes betweet EEVEE and Cycles. At least for EEVEE final render I won’t bother for 1-5 seconds more calculation per frame for this feature.