Commit Graph

6552 Commits

Author SHA1 Message Date
Clément Foucault
d9915b86a6 EEVEE-Next: Remove shadow softness factor parameter
This parameter was introduced to mitigate shadow tracing
artifacts. These are no longer present since #121317 and
leaving this parameter breaks PBR rules which opens other
issues with shadow disconnected from shading.
2024-05-07 15:49:49 +02:00
Aras Pranckevicius
6efa5c16ab Mesh: speedup BKE_mesh_validate
BKE_mesh_validate is called by mesh.validate() Python API, as well as optionally
when doing file imports. This PR speeds it up a bit:
- Faster face data sorting by using parallel sort instead of qsort,
- One allocation for all face vertex indices, instead of a separate allocation
  for each face,
- (more like a fix) Validation no longer adds a MDeformVert layer when there was
  none in the input mesh.
- Small cleanups (more const inputs, etc.)

On my Windows/VS2022/Ryzen5950X machine, import time in seconds (validation on
before this PR -> validation on with this PR, validation off):
- USD (Intel Moore Lane): 9.1 -> 6.7, 4.8.
- OBJ (Blender 3.0 splash): 22.7 -> 18.6, 16.5.

Pull Request: https://projects.blender.org/blender/blender/pulls/121413
2024-05-07 12:29:32 +02:00
Hans Goudey
32bfe448bc Cleanup: Remove unused data-block previews function
This was added 17 years ago, and the last uses were removed
3 and 9 years ago.
2024-05-06 21:10:00 -04:00
Richard Antalik
69472c88ee IMB: Cleanup timecode options
Remove options that are duplicate and change description of options, so
they describe bit better, how timecodes are actually used.

Timecodes in Blender have pretty much nothing in common with more widely
known term "timecode". This confused users (and developers).
There were 5 options of which 3 were exactly same. This commit leaves
user with 3 options:
 - Use timecodes for normal seeking/playback - Record Run
 - Ensure, that no frame is duplicated or skipped - "Record Run No Gaps"
 - Do not use timecodes - "None"

More verbose description was added to the definition in code.

Naming of these timecode types was kept, even if it is incorrect to not
break scripts and habits.

Pull Request: https://projects.blender.org/blender/blender/pulls/121001
2024-05-06 17:56:56 +02:00
Brecht Van Lommel
50ee7229c5 Fix #121345: View layer denoising versioning don't apply correctly
Thanks Philipp for help investiging the problem.

Ref #121389
2024-05-06 12:47:31 +02:00
Campbell Barton
c5ad937f53 Cleanup: match argument names in function & declaration 2024-05-06 09:20:05 +10:00
Julian Eisel
a6ebfb05ad UI: Option to store enabled asset shelf catalogs in preferences
Adds a new asset shelf option (`STORE_ENABLED_CATALOGS_IN_PREFERENCES`
option in RNA) to use the Preferences for storing the enabled catalogs.
This way asset shelf types can decide if for their use-case, they want
to synchronize the enabled catalogs over Blender sessions and files, or
keep the stored locally in the file.

This is important because for example on one hand, it would be annoying
if for brush assets you'd have to enable the visible catalog tabs for
every 3D View and every file, while on the other hand you need that
level of control for the pose library where the catalogs the rigger/
animator cares about varies from project to project, character to
character and shot to shot.

Conceptually this also makes some sense: The new brush assets workflow
synchronizes brush assets and their catalogs across Blender sessions
and files, basically making them globally accessible independent of
the current file/project, so treating the enabled catalogs the same
is consistent.

Previously reviewed in #120264

Pull Request: https://projects.blender.org/blender/blender/pulls/121363
2024-05-03 10:20:01 -04:00
Bastien Montagne
24560b6016 Fix #121310: Marking or clearing 'Fake User' on ID not undoable.
Remapping of internal ID pointers in 'undo swap' case (i.e. when new ID
data had to be read from undo buffer, but current ID address is kept)
needs to also ignore 'fake user' handling, otherwise it would reverse
the undoing effect.
2024-05-03 12:54:11 +02:00
Campbell Barton
9918488bb1 Cleanup: use uppercase tags, following own style guide 2024-05-03 11:33:21 +10:00
Sebastian Parborg
221951657b VSE: Make cache overlay visible to non "Developer extras" users
This also moves the option to be a per editor space setting so you can
have different cache visualization options in different editor spaces
at the same time.

A quick toggle for the cache visualization is now available in the
overlays popover.

Pull Request: https://projects.blender.org/blender/blender/pulls/119428
2024-05-02 16:36:11 +02:00
Campbell Barton
f6b7464b4c Cleanup: spelling in comments 2024-05-02 16:44:10 +10:00
Hans Goudey
c549c1b29c Brush: Add Main argument to BKE_paint_ensure
This is used by the brush assets branch. Though it is unused currently, the
argument is added now to reduce the trivial boilerplate changes in the diff.
2024-05-01 11:49:48 -04:00
Clément Foucault
ab30784076 EEVEE-Next: Implement spherical harmonic deringing
This avoids negative color darkening caused by strong
directionnal lighting.

However, this reduce the contrast a lot since the
deringing is done on the unclampped spherical harmonics
which is itself extracted from unclamped values from
the world.

The solution to this is to add the parameter for
clamping the world light. This setting will be
reused for #68478.

Fix #116036

Pull Request: https://projects.blender.org/blender/blender/pulls/121303
2024-05-01 16:18:51 +02:00
Clément Foucault
3f1dbf2843 Fix: EEVEE-Next: Thickness versionning affecting startup.blend
This limits the thickness node addition to material using
screen space refraction.
2024-05-01 16:18:35 +02:00
Clément Foucault
826d2ed4ec EEVEE-Next: Move shadow resolution scale to the sampling panel 2024-05-01 14:45:51 +02:00
Omar Emara
f595345f52 Compositor: Match size of Fast Gaussian with Gaussian
This patch matches the size of the Fast Gaussian mode of blur with the
standard Gaussian mode. The sigma value was computed as half the radius,
while it should be third of the radius, since Blender's Gaussian
function is truncated at 3 of the standard deviation of the unit
Gaussian. The patch include versioning to adjust the size of existing
files.

Pull Request: https://projects.blender.org/blender/blender/pulls/121211
2024-05-01 09:01:53 +02:00
Clément Foucault
303f91a09c EEVEE-Next: Add slab thickness and thickness from shadow options
Implement the design discussed in #120384.

This adds two parameters. One for changing the approximation
method, and another to use the thickness from shadow map.

We pack the former in the gbuffer by dividing the 16bits
used for thickness by two and use one bit to store the
method.

The thickness from shadow map is now decoupled from the
light evaluation shader. This makes it more performant and
compatible with ray-tracing. This commit also uses the
same biases as shadow mapping to avoid aliasing artifacts
(fix #119339).

This refactors the light evaluation quite a bit to
remove unused bits bits and make the whole transmission
light evaluation without too much complexity.

Pull Request: https://projects.blender.org/blender/blender/pulls/121171
2024-04-30 20:32:46 +02:00
David Murmann
ee51f643b0 Cycles: Ray Portal BSDF
Transport rays that enter to another location in the scene, with
specified ray position and normal. This may be used to render portals
for visual effects, and other production rendering tricks.

This acts much like a Transparent BSDF. Render passes are passed
through, and this is affected by light path max transparent bounces.

Pull Request: https://projects.blender.org/blender/blender/pulls/114386
2024-04-29 12:37:51 +02:00
Alaska
f8c0050a25 Shaders: Add Roughness to Subsurface Scattering Node
Matching the Principled BSDF.

Pull Request: https://projects.blender.org/blender/blender/pulls/114499
2024-04-29 10:54:29 +02:00
Clément Foucault
bb44bce95c EEVEE-Next: Improve shadow bias
The goal of this PR is to remove any user facing parameter
bias that fixes issues that are caused by inherent nature of
the shadow map (aliasing or discretization).

Compute shadow bias in the normal direction to avoid
both shadow leaking at certain angles or shadow
acnee.

This bias is computed automatically based on the minimum
bias amount required to remove all errors. The render
setting is removed as of no use for now.

#### Normal bias
We do the bias in world space instead of shadow space
for speed and simplicity. This requires us to bias using
the upper bound of biases for the same location in space
(using biggest texel world radius instead of UVZ bias).
This isn't much of an issue since the bias is still less
than 2 texel. The bias is still modulated by facing
ratio to the light so surfaces facing the light have no
biase.

This fixes both self shadowing and flat occluders aliasing
artifacts at the cost of moving the shadow a bit on the
side. This is the blue arrow in the diagram.

We always bias toward the normal direction instead of the
light direction. This is alike Cycles geometric offset for
the shadow terminator fix. This is better since it does'nt
modify the shading at all.

#### Slope bias
To avoid aliasing issue on zero slope receiver, we still
have to use the slope bias with a size of 1 pixel.

#### PCF filtering
We now parametrize the filter around the normal instead of
using the shadow map local space. This requires to use
a disk filter instead of box, which is also more pleasant
for most light shapes (all except rectangle lights).

Setting the filter around normal avoid overshadowing from
zero slope occluders. This cannot be fixed by more slope bias
in light space PCF. We could fix it in light space by projecting
onto the normal plane but that gives an unbounded bias when `N.L`
is near 0 which causes either missing shadows or self shadow if
using an arbitrary max offset value.

To avoid overshadowing from any surface behind the shading
point, we reflect the offset to always face the light.
Doing so instead of using the perpendicular direction
is better for very sharp geometric angles, has less
numerical precision issue, is symetrical and is cheaper.

To avoid any self shadowing artifact on zero slope receivers
with angled neighbors (like a wall and the floor), we have
to increase the slope bias according to the filter size.
This might be overkill in most situation but I don't feel
this should become a setting and should be kept in sync
with the filter. If it has to become an option, it should
simply a factor between unbiased filter and best bias.

#### Shadow terminator

The remaining artifacts are all related to shadow terminator
one way or another. It is always caused by the shading
normal we use for biasing and visibility computation not
being aligned with the geometric normal.

This is still something we need a setting for somewhere.

Pull Request: https://projects.blender.org/blender/blender/pulls/121088
2024-04-27 14:30:52 +02:00
Clément Foucault
afe13df0b5 EEVEE-Next: UI: Change default filtering radius to 1px
The resonning is that we expect the default to be close
to realistic rendering. The filtering is only here to
hide aliasing in this case and shouldn't do more
blurring. This is specially disturbing when rendering at
low resolution since the filter is resolution dependant.

Older files are also expecting to use a 1px filter
for compatibility.
2024-04-26 21:14:24 +02:00
Hans Goudey
e3894f0a07 UV: Remove UV sculpt use of brushes
For the brush assets project (#116337) all editors with brushes are
getting an asset shelf, and the brush tools are combined, with
individual brushes accessed in the shelf. That design seems way
overkill for UV sculpting which is just three very simple tools.

In order to avoid one editor with inconsistent use of brushes, which
would significantly increase the complexity of the system after the
brush assets merge, port the three UV sculpt tools to be regular
modal operators that don't use the brush or paint system at all.

To be clear, this is a compromise that doesn't feel ideal, but no
one could think of a better solution. Theoretically this removes
some flexibility from UV edit "sculpting", in practice it probably
won't be a noticeable change.

Pull Request: https://projects.blender.org/blender/blender/pulls/120797
2024-04-26 17:10:04 +02:00
Falk David
c2504eb779 Cleanup: Use legacy radius conversion factor constant
This moves the seemingly arbitrary value of  "1 / 2000"
into a constant variable
(`bke::greasepencil::LEGACY_RADIUS_CONVERSION_FACTOR`)
so that it can be used in all the places where
legacy "thickness" values need to be converted.
This also expands the explanation of the factor a bit, so it's
clearer why it is needed.
2024-04-26 12:48:26 +02:00
Campbell Barton
d291ec37e0 Cleanup: remove null check in blo_filedata_free
All callers except for one were already checking, add ATTR_NONNULL
attribute to functions that take a FileData to make it clear that
it's not expected to be null.
2024-04-25 23:03:17 +10:00
Campbell Barton
0f93f70076 Cleanup: quiet unused variable warnings 2024-04-25 12:09:31 +10:00
Aras Pranckevicius
31e56797f0 VSE: indicate missing media in timeline/display
Sequencer timeline displays red tint & appropriate icons for strips that are
missing media file (images, movies, audio, or meta strips that contain such).

Sequencer preview and rendering displays missing media strips as magenta,
similar to missing textures elsewhere in Blender. This is on by default,
sequencer view settings have an option to turn it off.

Pull Request: https://projects.blender.org/blender/blender/pulls/116869
2024-04-24 19:54:44 +02:00
Hans Goudey
c60a1006e5 Asset Shelf: Add asset shelf region to image editor
As part of the brush assets project, the image editor needs an asset
shelf to display brush assets for texture paint mode. This commit adds
the unused asset shelf region, similar to the 3D viewport's region that
is currently just used for the pose library. For now, users will just
see an "Asset Shelf" toggle in the view menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/121034
2024-04-24 17:55:37 +02:00
Brecht Van Lommel
15b9ae5436 Refactor: Use typed functions for blend file data reading
This makes the read and write API functions match more closely, and adds
asserts to check that the data size is as expected.

There are still a few places remaining that use BLO_read_data_address
and similar generic functions, these should eventually be replaced as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/120994
2024-04-24 17:01:22 +02:00
Brecht Van Lommel
29c3997c28 Fix: Crash reading some particular old blend files 2024-04-23 19:52:20 +02:00
John Swenson
cff532e134 VSE: Implement Snapping to Markers
This patch adds the ability to snap strips to markers. Previously, there
only existed options to snap to hold offsets and the current frame.

This snap type works identically to other snapping options by checking
for the relevant bit (here `SEQ_SNAP_TO_MARKERS`) and adding the marker
frame numbers to `snap_data->target_snap_points` within
`seq_snap_target_points_build()`.

To enable `seq_get_snap_target_points_count()` to have access to marker
information, the current Scene object is now passed to the function.

Pull Request: https://projects.blender.org/blender/blender/pulls/120450
2024-04-23 01:54:14 +02:00
Clément Foucault
d44ee7bf11 EEVEE-Next: Make light clamping consistent
This adds clamping at the light combine stage for both direct
and indirect light.

This allows for clamping direct and indirect light separately.
While direct light clamping might not be very desirable in
EEVEE, it might be wanted to reduce the flickering from distant
shiny bumpy surfaces, or for artistic reason.

This happens after applying the BSDF throughput just like cycles.
This is done in order to minimize the performance impact and
allows to split the clamp for direct light and indirect light.

The indirect light clamp value is still used in the ray-tracing
pipeline to clamp the ray intensity. But this differs from cycles
as we clamp the ray without the BSDF throughput here. Sphere probe
have the same issues. Some more energy loss is expected compared
to the direct light clamp.

Note that we still clamp the indirect light after applying BSDF
in case the BSDF is scaling the energy up above the threshold.

This also corrects the clamping for volume that now clamps after
applying the scattering term.

Also adds clamping to volume indirect lighting.

Since we use light probe volumes for both surface and volume
indirect lighting, we need to clamp them at sampling time.

Pull Request: https://projects.blender.org/blender/blender/pulls/120866
2024-04-22 21:19:00 +02:00
Jacques Lucke
3bddde1b30 Cleanup: update comment regarding blend expand callback 2024-04-22 20:13:06 +02:00
Campbell Barton
fd589fdca4 Cleanup: various non functional C++ changes 2024-04-20 13:46:14 +10:00
Clément Foucault
9dd164e1ad EEVEE-Next: Rename screen trace max roughness
Remove "screen" from the name as it is not limited to
screen trace.
2024-04-19 20:27:24 +02:00
Clément Foucault
7b38873732 EEVEE-Next: Volume: Add custom integration range
This is just adding a switch for enabling custom range.

Custom range is now optional as we compute a tight bound
to integrate around volume objects by default.

The custom range is only needed for scene with really
thick world volumes.

Pull Request: https://projects.blender.org/blender/blender/pulls/120823
2024-04-19 13:51:27 +02:00
Clément Foucault
125fcc948e EEVEE-Next: Light: Add transmission factor
Now that lights are supported for refraction BSDFs,
there is no reason to not add support for it.

Versionning sets it to zero for compatibility with
legacy EEVEE.

This is also needed in order to support per object
ray visibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/120796
2024-04-18 22:08:50 +02:00
Campbell Barton
cf37424203 Cleanup: use const pointers, quiet cppcheck unreadVariable warning 2024-04-17 11:36:38 +10:00
Campbell Barton
20b0805213 Cleanup: use const pointers where possible 2024-04-16 12:27:47 +10:00
Damien Picard
abc0bf814f UI: Fix and improve a few messages
- "Log Encoding with Chroma inset and rotation": add "of primaries" in
  the description of the AgX Log color space to better explain the
  operation, based on wording in !106355.
- Remove a few double spaces.
- Make Line Art title case everywhere, to convey it's the system /
  brand / product name and not the generic concept.
- "Copy Absolute coordinates or Normal vector" -> "of Normal Vector":
typo.
- "Makes a link between selected output in input sockets" ->
  "Make...", "output and input": typo.
- "Purge Unused Data From This File" -> "from this": title case as per
  HIGs.
- GPencil -> Grease Pencil: no reason to use an abbreviation here.
- "Around Current Frame" -> "Around Frame": actual name of the
  onion-skinning method.
- "... (layer height for layer tool, i.e.)" -> "(i.e. the layer height
  for the layer tool)": put "i.e." at the start of the sentence.
- Expand description of toe-in stereo camera option.
- "Children collections their parent-collection-specific settings" ->
  "Children collections with their...": typo.
- "Generate vertex weights base on..." -> "based on" : typo, lower
  case.
- Expand description of GP modifier properties, based on their mesh
  counterparts.
- "AEnvelope" -> "Envelope": typo.
- "Falloff type the feather" -> "of the feather": typo.
- "usually make transition as long as effect strip": rephrase.
- "When disabled a users extensions directory is created" -> "a
  user's": typo.
- "successfull" -> "successful": typo.
- "Remove all attributes... a single wildcard (*).": remove trailing
  ".".
- "..., use "Save Preferences."": remove trailing ".".

Some issues reported by Marina Veselkova and Tamar Mebonia.

Pull Request: https://projects.blender.org/blender/blender/pulls/120649
2024-04-15 20:02:38 +02:00
Sybren A. Stüvel
51e1f29a68 Anim: Add new keyframe type 'GENERATED'
Add a new keyframe type named 'generated', which is meant to indicate
that the key was set by some automated tool (like an add-on), rather
than manually by an animator.

This is meant for tooling that needs to create keys in a repeatable way.
With this new key type, the tool can know which keys it generated
before, and thus those can be removed and re-generated.

Pull Request: https://projects.blender.org/blender/blender/pulls/120564
2024-04-15 10:42:54 +02:00
Hans Goudey
c91449836a Cleanup: Move BKE_workspace.h to C++ 2024-04-12 17:03:18 -04:00
Christoph Lendenfeld
883af6dd63 Anim: Add custom pre and post frame color to motion path
This PR adds an option to specify custom colors for a
motion path. One for frames before the current frame
and one frame for after. With this it is easier to see
the relation of the motion path to the current frame.
That was already the case with the default colors, but
not with custom colors.

On a technical side note, the colors pre and post the current
frame were already different.
The shader multiplied the custom color by 0.25
for anything pre current frame.

Pull Request: https://projects.blender.org/blender/blender/pulls/119375
2024-04-12 15:11:51 +02:00
Campbell Barton
78413ff4e2 Fix error resetting the theme which would add a new theme
Regression caused by [0], also correct memcpy calls that overwrite
listbase link variables and the theme name, note that this is more a
code-correctness issue as it wouldn't cause user visible bugs.

[0]: adbec9eea9
2024-04-12 16:54:57 +10:00
Sybren A. Stüvel
ded8c5d6e6 Fix #120447: Anim/Drivers on Bone Collections created in 4.0 break in 4.1
Use versioning code to change Drivers & F-Curves targeting
`armature.collections[...` to target `armature.collections_all[...`
instead. The former contains the root collections only, whereas the
latter contains all of them in a flat list. Not only does this fix the
tree view (it binds to properties via the `.collections_all` RNA path),
but also this makes the drivers & animation of the properties work even
when the hierarchy changes.

Note that both `.collections` and `.collections_all` give access to all
bone collections. The former just requires iterating hierarchically,
that is, via `some_collection.children`.

Pull Request: https://projects.blender.org/blender/blender/pulls/120514
2024-04-11 15:26:47 +02:00
Campbell Barton
793b99ca7c Theme: ensure unique theme names, increase name size to 64
Ensure unique names when setting the name and with versioning.
2024-04-11 17:44:27 +10:00
Harley Acheson
7642a5452a UI: Consistent Cursor Color
Change Console and text editor cursor color to match that of
widget_text_cursor. Console cursor is currently red which we normally
use for error conditions.

Pull Request: https://projects.blender.org/blender/blender/pulls/120491
2024-04-11 04:00:14 +02:00
Jacques Lucke
936fb7488e Cleanup: move runtime data to Library.runtime
Having a better separation between runtime and non-runtime data makes
it easier to reason about the code.

Pull Request: https://projects.blender.org/blender/blender/pulls/120271
2024-04-08 13:08:36 +02:00
Bastien Montagne
cb66cc3028 Fix #120058: Undoing a rename while in edit mode crashes Blender.
The root of the issue, as identified by Jake-Faulkner in his PR
(!120099), was that after changes in commit 195bb4f8f5,
`BKE_libblock_ensure_unique_name` would not always correctly set
`bmain->is_memfile_undo_written` to false when an ID name was actually
modified.

However, after analyzing a bit more the code in ID renaming, it appeared
that `BKE_libblock_ensure_unique_name` was not needed and only made
things more confusing. Some ID renaming code (from RNA, the Outliner,
and some do_version areas) would then do some manual ID renaming
operations and then call it, instead of simply using the existing 'all
in one' `BKE_libblock_rename` function.

This commit removes `BKE_libblock_ensure_unique_name` and all of its
usages, and simplify all code previously using it by calling
`BKE_libblock_rename` instead.

NOTE: The only non-trivial (not-so-nice) aspect of this commit is the
changes needed in the Outliner renaming code, since here the name of the
ID is directly edited, before calling the rename function, so this edit
needs to be undone to allow calling the generic ID rename API.

Pull Request: https://projects.blender.org/blender/blender/pulls/120196
2024-04-05 03:19:35 +02:00
Campbell Barton
7e9f7320e4 Cleanup: spelling in comments & comment blocks 2024-04-04 11:26:28 +11:00
Campbell Barton
b03332a055 Cleanup: use BLI_assert_msg instead of checking string literals 2024-04-03 14:27:54 +11:00