4 Commits

Author SHA1 Message Date
Clément Foucault
632bd741f7 Fix #148071: EEVEE: Crash when using Sky Texture + Multi-scattering
Caused by some tricky use after-free / stack corruption.
This affect both Cycles and EEVEE.

The `sms` local variable is getting dereferenced by `get_inscattering`
inside the threaded for loop but is passed by copy to the lambda expression.
This makes its lifetime ill-defined in a multithreaded context.
I am not fully sure about the rules at play here so maybe my understanding
is wrong. But removing the call to `get_inscattering` avoids the crash.

Note that `SkyMultipleScattering` is also very big (it contains the whole LUT).
So copying it might have caused stack overflow. But that should trigger a
system interupt.

Passing everything by references fixes the issue.
This seems to be safe since all as the other local variables are `const` anyway.
Also the loop doesn't seem to modify the one that aren't.

Pull Request: https://projects.blender.org/blender/blender/pulls/148260
2025-10-17 14:39:31 +02:00
marcopavanello
8e9ccb33d0 Fix #146632: Multiple Scattering Sky has dark pixels near the horizon
Avoid sqrt of a negative number.

Pull Request: https://projects.blender.org/blender/blender/pulls/146718
2025-09-26 17:29:00 +02:00
Brecht Van Lommel
c2e5622d50 Revert "Shaders: Remove old Preetham and Hosek sky texture models"
These are causing quite a big difference in existing files, which is not
easy to address in versioning. Since the goal of removing this was to
simplify things for us and that's not the case, just revert this change.

This reverts commit ab21755aaf.

Ref #139923

Pull Request: https://projects.blender.org/blender/blender/pulls/146336
2025-09-20 16:52:23 +02:00
marcopavanello
084aefd0e0 Render: Add Multiple Scattering Sky Texture
This mode is based on the same athmospheric model as the previous one, but now
also accounts for multiple scattering and reflections from the ground.
This increases the accuracy, especially at low elevations.

Also renames some options for consistency:
- The previous "Nishita" model is now "Single Scattering"
- "Dust" is now "Aerosols"
- Default altitude is now 100m.

Co-authored-by: Lukas Stockner <lukas@lukasstockner.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/140480
2025-09-15 18:08:28 +02:00