Commit Graph

32 Commits

Author SHA1 Message Date
Miguel Pozo 0c8b96d1e0 EEVEE-Next: Shadow resolution scale and adaptive filtering
Allow the user to scale shadow-map resolution per-light.
Adapt the PCF scale based on shadow-map to pixel footprint ratio,
since we can no longer assume that higher LODs don't need filtering.
This allows using much lower shadow resolutions, which can yield
quite significant performance improvements, with relatively little
perceptual quality loss (at the cost of softening shadow edges).
The per-light resolution scale is a literal scale, so for example 0.5
means half the resolution. The Scene Simplify Shadows setting has
been updated to match this behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/119436
2024-03-20 15:54:41 +01:00
Miguel Pozo 4083f8004d EEVEE-Next: Add Shadows PCF
Add percentage closer filtering to shadowmap sampling and a
`shadow_filter_radius` property to lights to control it.

Notes:
* This adds PCF to `eevee_shadow_tracing_lib`, but not to
  `eevee_shadow_lib`, which is used by volumes (not required) and
  thickness.
* PCF is computed based on the LOD0 size. This assumes that higher
  LODs are only used when the shadowmap resolution is actually good
  enough to match the render resolution.

Pull Request: https://projects.blender.org/blender/blender/pulls/118220
2024-02-29 15:47:16 +01:00
Brecht Van Lommel bd8a44e169 Lights: Option to use old point light falloff
Add new "Soft Falloff" option on point and spot light that uses
the old light behavior from Blender versions before 4.0. Blend
files saved with those older versions will use the option.

This option is enabled by default on new lights.

Fix #114241

Co-authored-by: Weizhen Huang <weizhen@blender.org>
Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/117832
2024-02-07 19:07:11 +01:00
Campbell Barton 7a4f7a1d51 Cleanup: spelling in comments, comment blocks 2024-01-11 16:46:46 +11:00
Clément Foucault 3a4fc2c94e EEVEE-Next: Shadow Map Tracing Initial Implementation
Shadow Map Ray Tracing is a technique that ray cast against the shadow
depth buffer. The technique is described in "Soft Shadows by
Ray Tracing Multilayer Transparent Shadow Maps".
Note that we only implement the single layer approach since storing
multiple depth is prohibitively expensive.

Pull Request: https://projects.blender.org/blender/blender/pulls/111809
2023-09-26 23:42:40 +02:00
Campbell Barton b7f3e0d84e Cleanup: spelling & punctuation in comments
Also remove some unhelpful/redundant comments.
2023-09-14 13:25:24 +10:00
Julian Eisel 4c8847ec4f Cleanup: Remove `extern "C"` from DNA headers
`extern "C"` did not actually have an effect here since it only impacts
name mangling of functions, not structs (or other class types). Now this
can get in the way when we add C++ blocks with functions , e.g.
templates are not allowed in code with C-linkage.

Most of these were added in ad4b7741db, even though it was known that
this doesn't have any impact. Reason was because developers thought they
would have to add that to all direct and indirect includes to be able to
use a header in C++ (a common misconception). Now with most files
compiled in C++, it's obvious that this isn't the case.

Pull Request: https://projects.blender.org/blender/blender/pulls/111926
2023-09-04 15:59:40 +02:00
Weizhen Huang 482211b7e0 Fix wrong conversion from power to radiance of area lights
The correct conversion factor should be 1 / (pi * area), see #108505

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/109153
2023-07-07 17:03:02 +02:00
Brecht Van Lommel c4ddf16950 Cleanup: remove unused light struct member 2023-07-05 19:16:39 +02:00
Brecht Van Lommel 57d85b32a9 Lights: remove unused Blender Internal properties
For falloff, attenuation and shadow buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/109738
2023-07-05 18:54:36 +02:00
Campbell Barton 0222876a34 Cleanup: replace defines with enum in DNA
- Group ambiguous flags Object::flag & Base::legacy_flag.
- Replace ambiguous hints (e.g. `paf->flag` with doxygen types).
- Remove unused flag PAF_MAXMULT.
2023-06-27 14:45:00 +10:00
Sergey Sharybin c1bc70b711 Cleanup: Add a copyright notice to files and use SPDX format
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.

This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.

Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.

Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:

    https://reuse.software/faq/
2023-05-31 16:19:06 +02:00
Germano Cavalcante fbc2c4c331 Fix T102853: radius of spot and point lamps shares same value with area lamp size
If we change the radius of a point or spot lamp, we also change the area lamp size.

As shown in T102853, this is bad for animating the lamp type.

The solution is to make the property point to another member of the DNA
struct `Light`.

Differential Revision: https://developer.blender.org/D16669
2023-01-04 12:57:33 -03:00
Germano Cavalcante 22fec7b1a4 Remove deprecated and long unused members of struct Light
The members `soft`, `bleedbias`, `bleedexp` and `contact_spread` were
deprecated in rBd8aaf25c23fa, and are no longer really used.

`soft` is only used by Collada as an extra value for exporting and
importing Blender files in collada.

`bleedexp` and `contact_spread` are only used in versioning to
initialize a default value.

Reviewed By: brecht, fclem

Differential Revision: https://developer.blender.org/D16834
2023-01-04 11:47:33 -03:00
Campbell Barton 62346abc02 Cleanup: spelling in comments 2022-06-17 07:33:06 +10:00
Sergey Sharybin 25c357124d Cover some DNA files with C++ utility macros
Solves compilation warning with Clang, and moves manipulation with
DNA structures to the designed way for C++.

The tests and few other places are update to the new code by Jacques.

Ref T96847

Maniphest Tasks: T96847

Differential Revision: https://developer.blender.org/D14625
2022-04-13 11:48:12 +02:00
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
Campbell Barton ced94bc11c Cleanup: code comments punctuation / spacing 2021-07-23 17:03:51 +10:00
Matteo Falduto a4260ac219 Cycles: add a spread setting for area lights
This simulates the effect of a honeycomb or grid placed in front of a softbox.
In practice, it works by attenuating rays coming off-angle as a function of the
provided spread angle parameter.

Setting the parameter to 180 degrees poses no restrictions to the rays, making
the light behave the same way as before this patch.

The total light power is normalized based on the spread angle, so that the
light strength remains the same.

Differential Revision: https://developer.blender.org/D10594
2021-04-01 12:31:01 +02:00
Clément Foucault 884f934a85 EEVEE: Lights: Add Volume and diffuse light power slider
This adds 2 new sliders for light objects that modulates the diffuse
light and the volume light intensities.

This also changes the way volume light is computed using point lamp
representation. We use "Point Light Attenuation Without Singularity"
from Cem Yuksel instead of the usual inverse square law.
2021-03-19 21:11:06 +01:00
Julian Eisel ad4b7741db Build-system: Force C linkage for all DNA type headers
Some DNA headers already did this, most did not. Even though many of them would
be included in C++ files and thus compiled as C++. This would be confusing and
developers may think they have to add `extern "C"` too a whole lot of
(indirect) includes to be able to use a C header in C++.

However, this is a misconception.
`extern "C"` does not cause code to be compiled with C rather than C++! It only
causes the linker to not use C++ function name mangling. See
https://stackoverflow.com/a/1041880.
Because extern DNA headers don't have function declarations, using `extern "C"`
actually should not have any effect. On the other hand, adding it causes no
harm and avoids confusion. So let's just have it consistently in C header
files.

Differential Revision: https://developer.blender.org/D9578

Reviewed by: Bastien Montagne, Sybren Stüvel
2020-11-19 13:41:50 +01:00
Jacques Lucke 91694b9b58 Code Style: use "#pragma once" in source directory
This replaces header include guards with `#pragma once`.
A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`),
because they are used in other places.

This patch has been generated by P1561 followed by `make format`.

Differential Revision: https://developer.blender.org/D8466
2020-08-07 09:50:34 +02:00
Dalai Felinto 2d1cce8331 Cleanup: `make format` after SortedIncludes change 2020-03-19 09:33:58 +01:00
Clément Foucault d8aaf25c23 Eevee: Shadow map refactor
Reviewed By: brecht

Differential Revision: http://developer.blender.org/D5659
2019-09-05 17:37:50 +02:00
Campbell Barton 6eadd40597 Cleanup: redundant struct declarations 2019-08-25 16:45:47 +10:00
Tim Stullich 5ba1a6bee0 Lights: change sun light size to be specified as angle
This is the angular diameter as seen from earth, which is between 0.526° and
0.545° in reality. Sharing the size with other light types did not make much
sense and meant the unit was unclear.

Differential Revision: https://developer.blender.org/D4819
2019-05-15 16:07:50 +02:00
Campbell Barton 333cdbb410 Cleanup: comment blocks 2019-04-18 07:59:28 +02:00
Campbell Barton e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
Campbell Barton d1f7ae29a2 Cleanup: use "_pad" prefix for pad vars 2019-02-27 22:20:29 +11:00
Campbell Barton e097e0c833 Cleanup: header guard names
Missed in file rename.
2019-02-27 19:59:19 +11:00
Campbell Barton 6a03199b50 Cleanup: use '_pad' convention for padding in all DNA structs
Avoids mixing these in with regular variables in code-completion.

Use char for pad members except for 'void *', to make size clearer.

Removed/shrink a few redundant padding vars which were >= 8 bytes.
2019-02-27 15:09:48 +11:00
Campbell Barton 168d3fd528 Cleanup: file rename lamp -> light 2019-02-27 12:36:32 +11:00