Commit Graph

102090 Commits

Author SHA1 Message Date
Campbell Barton
eee33ce2df Cleanup: replace strcpy with BLI_strncpy 2023-08-21 11:09:18 +10:00
Campbell Barton
1c7adc61ae Cleanup: de-duplicate comments & expand on why UV's are clipped 2023-08-21 10:36:41 +10:00
Campbell Barton
33a05725be Cleanup: spelling in comments 2023-08-21 10:05:45 +10:00
Clément Foucault
65f91bd53a Fix: DRW: Broken debug decimal display
This is a temporary fix. A better fix
that display the non-scientific notation
would be better.
2023-08-20 17:52:48 +02:00
Clément Foucault
b4b5977aed DRW: Guard debug lib using defines
This allows adding debug calls to library
sources and not trigger an error for
all shaders that reference the lib.
The particular shader that need to use
it can set `drw_debug_print_enable` and
`drw_debug_draw_enable` in their main file
and it will trigger the injection of the
debug functions.
2023-08-20 17:52:48 +02:00
Hans Goudey
39a40d6f84 Cleanup: Subdiv: Replace "stack or buffer" storage with C++ classes
Blender's C++ data structures have configurable inline buffers used to
avoid allocation when the needed size is small. Use them in multires
code instead of an uglier C solution.

Pull Request: https://projects.blender.org/blender/blender/pulls/111070
2023-08-20 00:25:45 +02:00
Harley Acheson
b25b13a90b Fix #111278: UI Text Extension of Selection
Recent refactors could cause movement of selection endpoints when
extending (holding shift). This ensures that only the cursor side moves
during selection extension.

Pull Request: https://projects.blender.org/blender/blender/pulls/111288
2023-08-19 19:19:57 +02:00
Campbell Barton
5a8cb665e0 Cleanup: various non-functional C++ changes 2023-08-19 23:52:47 +10:00
Campbell Barton
faa3ef6ad5 Cleanup: format 2023-08-19 23:52:47 +10:00
Campbell Barton
4f72240c1d Cleanup: spelling (correct correction), update dictionary 2023-08-19 20:19:13 +10:00
Campbell Barton
20b4a77872 datatoc: exclude the initial C-style comment from GLSL/MSL/Cuda files
Add optional argument `STRIP_LEADING_C_COMMENTS` to CMake macros:
data_to_c_simple & data_to_c.

Strip leading C-style comments that don't bloat binary size.
Comments are replaced with blank lines so line numbers in error messages
match. Reduces Blender's binary size by ~70kb.
2023-08-19 17:57:12 +10:00
Campbell Barton
63c1a26069 Cleanup: move GLSL comments to the file start
This has the benefit that leading comments may be stripped,
reducing the binary size (not yet supported).
2023-08-19 17:56:48 +10:00
Campbell Barton
04bf0f3eb6 License headers: add SPDX copyright entries for '*.msl' files 2023-08-19 17:41:14 +10:00
Campbell Barton
add2a656da Cleanup: spelling, use C-style in GLSL 2023-08-19 17:13:05 +10:00
Harley Acheson
1ce9c2b1f8 Fix #111086: Ignore Scroller Zones in Invisible Regions
If a region is hidden then there is no reason to detect or
consider its (also hidden) scroller action zones.

Pull Request: https://projects.blender.org/blender/blender/pulls/111126
2023-08-18 21:31:35 +02:00
Ray Molenkamp
e2af12d368 Cleanup: Update copyright to the new format
Had put my name here since the choice was between the foundation
and me personally, with the blender authors file now being in
place this can be cleaned up.
2023-08-18 11:58:37 -06:00
Harley Acheson
9e71b84f1d UI: Error Logging for Some Screen Operations
WM_report on the unlikely event when an area (smaller than minimums) is
within the combined operation bounds (close or join) and interferes.

Pull Request: https://projects.blender.org/blender/blender/pulls/111280
2023-08-18 19:53:18 +02:00
Ray Molenkamp
0df3aedfa8 CMake/MSVC: Only generate/install stripped PDB for release builds
This renames the WITH_WINDOWS_PDB and WITH_WINDOWS_STRIPPED_PDB cmake
options to WITH_WINDOWS_RELEASE_PDB WITH_WINDOWS_RELEASE_STRIPPED_PDB

The Stripped PDB isn't cost free to generate, and is only needed for
builds that are distributed to end users. There is no benefit in making
one for a debug build as the debugger locally will prefer to use the
bigger un-stripped PDB anyhow.

This also stops the copy/install of the PDB for anything but a release
build, this file is about 1.6G for a debug build, and there is really
no need to do this for local development, as the debugger will find/use
the PDB from its original location.

This brings down the time needed for an incremental link on a debug
build by about 30% (10->7 seconds on my local system)
2023-08-18 10:20:36 -06:00
Bastien Montagne
99e78f1c7a Cleanup: Move Object' FluidModifier internal data handling from 'lib_link' into 'read_data' code.
The only acceptable case to handle internal data in 'lib_link' code is
when it depends on other IDs info. Otherwise, it should be done in
'read_data' code (and versioning if relevant).
2023-08-18 17:31:06 +02:00
Christoph Lendenfeld
0c26d4cc3e Fix: Number input on slider
When using a slider it is possible to enter numbers for an exact value
However that input was capped between 0 and 1,
which is no longer correct since the range can be arbitrary.

Additionally it was divided by 100 because the slider
operator system assumed we'd be working with percentages.

This fixes both of these issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/111269
2023-08-18 17:29:41 +02:00
Weizhen Huang
8367167626 Render: default roughness distribution to Multiscatter GGX
for glass, glossy and principled BSDF. It is more energy-preserving than
GGX, and with the albedo scaling instead of random walk (888bdc1419) the
render time stays reasonable.

Task: #99447

Pull Request: https://projects.blender.org/blender/blender/pulls/111267
2023-08-18 15:51:30 +02:00
Falk David
24082ceecc Cleanup: GPv3: Constructors and destructors
The `TreeNode`, `Layer` and `LayerGroup` constructors and destructors
had some inconsistencies. Now the code is a bit more clean and shared.
2023-08-18 15:06:18 +02:00
Bastien Montagne
f954329376 Cleanup: Move FCurve's internal data hanlding from 'lib_lkink' to 'read_data' code.
Deciding to forcefully set an ID pointer to null is not ID lib_linking
process, but internal data management.
2023-08-18 14:58:44 +02:00
Bastien Montagne
77eb7898e9 Cleanup: Comment in liboverride hierarchy handling code. 2023-08-18 14:23:41 +02:00
Bastien Montagne
dfb002bac6 Cleanup: Move Workspace's internal data handling from 'lib_link' to 'read_data' code.
Decision to clear the pinned scene ID in case of linked data _is_
internal data handling, and not related to updating relationships to
other IDs.
2023-08-18 14:23:18 +02:00
RedMser
baeeff9a84 Fix: crash in liboverride hierarchy ensure
Add null checks to logging and fix typo in if-check.

Pull Request: https://projects.blender.org/blender/blender/pulls/111055
2023-08-18 14:20:34 +02:00
Weizhen Huang
6f8011edf7 Cycles: new Principled Hair BSDF variant with elliptical cross-section support
Implements the paper [A Microfacet-based Hair Scattering
Model](https://onlinelibrary.wiley.com/doi/full/10.1111/cgf.14588) by
Weizhen Huang, Matthias B. Hullin and Johannes Hanika.

### Features:
- This is a far-field model, as opposed to the previous near-field
Principled Hair BSDF model. The hair is expected to be less noisy, but
lower roughness values takes longer to render due to numerical
integration along the hair width. The hair also appears to be flat when
viewed up-close.
- The longitudinal width of the scattering lobe differs along the
azimuth, providing a higher contrast compared to the evenly spread
scattering in the near-field Principled Hair BSDF model. For a more
detailed comparison, please refer to the original paper.
- Supports elliptical cross-sections, adding more realism as human hairs
are usually elliptical. The orientation of the cross-section is aligned
with the curve normal, which can be adjusted using geometry nodes.
Default is minimal twist. During sampling, light rays that hit outside
the hair width will continue propogating as if the material is
transparent.
- There is non-physical modulation factors for the first three
lobes (Reflection, Transmission, Secondary Reflection).

### Missing:
- A good default for cross-section orientation. There was an
attempt (9039f76928) to default the orientation to align with the curve
normal in the mathematical sense, but the stability (when animated) is
unclear and it would be a hassle to generalise to all curve types. After
the model is in main, we could experiment with the geometry nodes team
to see what works the best as a default.

Co-authored-by: Lukas Stockner <lukas.stockner@freenet.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/105600
2023-08-18 12:46:13 +02:00
Falk David
d06a6105a7 Fix: GPv3: TreeNode::is_locked() function
The function returned `true` for the root node, which it shouldn't.
2023-08-18 12:44:11 +02:00
Falk David
725f1dbf2d Revert: GPv3: DNA rename of name
Partially reverts b14a0ee57e.

Instead of renaming the DNA field, use namespaces in C++ to resolve
name collisions (which is the reason this change was done
in the first place).
2023-08-18 12:44:11 +02:00
Hannes Loeschke
eda58d6419 Fix #110635: VSE: strip color multiplication affecting alpha channel
Factor of Color>Multiply should not have an effect on the alpha channel.
Alpha values can be adjusted separately by the factor associated to blend mode.
Factors below 1.0 reducing alpha would reduce color twice, while factors
above 1.0 would be clamped to 1.0.

- Removed ops on alpha channel in multiBuf()
- Removed adjustement of ibuf-planes since alpha channel is no longer
  modified

Pull Request: https://projects.blender.org/blender/blender/pulls/110984
2023-08-18 12:36:03 +02:00
Bastien Montagne
591c778b33 Fix (unreported) memleak in Particle lib_link code.
The potential data already read in `instance_weights` listbase needs to
be freed, instead of just clearing the listbase.

Also move some (very old!) versioning code out of Particle's 'lib_link'
code into proper versioning code.
2023-08-18 11:22:50 +02:00
Omar Emara
726ba534fc Realtime Compositor: Support realization of transformations
This patch adds support for the realization of transformations of
operation inputs in the Realtime Compositor. Input socket declarations
can now include a preference to what sort of realization needs to
happen.

All inputs specify realization on the operation domain by default
because that is needed for the correct operation of most operations.

Nodes may choose not to be realized on the operation domain, like the
MapUV, Plane Deform, and Bokeh Blur nodes; that's because their inputs
are treated as transform-less image objects.

Nodes may chose to realize their rotation or scale, like operations that
are not rotation or scale invariant and thus need images of identity
transformations. No nodes are declared as such so far, as this is still
being considered by developers and test builds be published for testing.

This patch coincidentally also fixes #102252 by declaring the Bokeh input
of the Bokeh Blur node to need realization of rotation. Which is the only
functional change of the patch.

Fixes #102252.

Pull Request: https://projects.blender.org/blender/blender/pulls/111179
2023-08-18 10:00:16 +02:00
Christoph Lendenfeld
e42c70fd31 Fix #110053: Crash on linked animation data with drivers
When copying (CTRL+L->Animation Data) a driver between two objects
that are linked with library overrides, `AnimData` was not created.
This did crash Blender when it tried to use the `nullptr`

The reason it crashed is because the function
`DEG_id_tag_update()`
was never called.

Fix it by restructuring the code so the function gets called

Pull Request: https://projects.blender.org/blender/blender/pulls/110795
2023-08-18 09:17:55 +02:00
Jeroen Bakker
82c1b9f684 Vulkan: Remove Unneeded Workaround for Shader Interfaces
All shaders have been patched and an error will be generated when using
incompatible shaders, no need to have workaround in the code anymore.
2023-08-18 08:57:37 +02:00
Jeroen Bakker
8477f62ba1 Vulkan: Detect Vulkan Incompatibility When Running OpenGL/MTL
Now that all shaders have been converted to be Vulkan Compatible it is
safe to test for incompatibility when running in OpenGL or MTL.

This detection is only done when blender is compiled in debug mode.
2023-08-18 08:48:22 +02:00
Campbell Barton
74b4bb7c4c Doc: correct code-comment 2023-08-18 09:16:25 +10:00
Campbell Barton
bc1ffdce5b Cleanup: spelling in comments 2023-08-18 08:56:12 +10:00
Campbell Barton
bf35eb9cbc Cleanup: format 2023-08-18 08:38:02 +10:00
Almaz-Shinbay
28f4bb2007 Outliner: Port modifier elements to new tree-element code design
No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Adds new classes for modifier elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/111114
2023-08-17 23:24:16 +02:00
Harley Acheson
d308f35896 UI: Make View3D Header Overlapped
Allow the View3D Header region to become transparent if "Region
Overlap" is enabled AND the Alpha of the Header's theme color is less
than 255. Basically its RGN_TYPE_HEADER and RGN_TYPE_TOOL_HEADER will
behave and look the same.

Pull Request: https://projects.blender.org/blender/blender/pulls/111194
2023-08-17 22:57:11 +02:00
Michael Kowalski
6f4cb9bc56 USD: Skeleton and blend shape import
Added support for UsdSkel animation import.

This addresses #110076.

Added USDSkeletonReader class which imports UsdSkelSkeleton primitives
as armatures.

Extended USDMeshReader to import UsdSkelBlendShape as shape keys.

Extended USDMeshReader to import USD skinning data as as deform groups
and an armature modifier on the mesh object.

Added USDMeshReader::get_local_usd_xform() to override the transform
computation to account for the binding transformation for skinned meshes.

Pull Request: https://projects.blender.org/blender/blender/pulls/110912
2023-08-17 20:11:51 +02:00
Bastien Montagne
1b25849ea6 Fix (unreported) missing handling of plane tracks' image ID pointer in MovieClip foreach_id code. 2023-08-17 19:58:07 +02:00
Bastien Montagne
75eb7ace73 Cleanup: move internal data handling from Mesh 'lib_link' to 'read_data' code.
No behavioral change expected from this commit.
2023-08-17 19:45:09 +02:00
Bastien Montagne
7d6e47a2b0 Fix (unreported) missing handling of Maks' spline parent ID pointer in foreach_id code. 2023-08-17 19:26:01 +02:00
Bastien Montagne
3822d8e3fc Fix (unreported) LineStyle foreach_id callback skipping some NULL ID pointers.
Not sure how bad that was in practice, was likely harmless. But
foreach_id logic should never decide to not process an ID pointer
because its value is NULL. Callback code is expected to handle NULL
pointers appropriately.
2023-08-17 19:19:05 +02:00
Bastien Montagne
a083e1cd0f Cleanup: Remove unused image Image pointer from LigthPrope data.
This pointer was fully unused, no point in keeping it around.
2023-08-17 18:57:54 +02:00
Bastien Montagne
3e0c95d1fc Cleanup: Remove unused parallax_ob Object pointer from LigthPrope data.
This pointer was fully unused, not even by 'bare metal' ID management
code (like foreach_id or lib_link areas). No point in keeping it around.
2023-08-17 18:45:19 +02:00
georgiy.m.markelov@gmail.com
37269c78d2 Hydra: saving changed to unpacking for packed images
For Hydra renderers to access packed images they need to be written to
disk. Previously it would save the image, but unpacking is much faster.

Ref: #110765

Pull Request: https://projects.blender.org/blender/blender/pulls/110933
2023-08-17 18:09:51 +02:00
Falk David
0bc755face Fix #109403: GP doesn't render selection outline
The issue was that there was a change in the shader that expected
a specific flag to be set. The current grease pencil code did not
set these flags.

This fix separates the old and new shader code so that
the old way of rendering the strokes remains untouched.

Pull Request: https://projects.blender.org/blender/blender/pulls/111227
2023-08-17 18:09:04 +02:00
Clément Foucault
672d25b02d EEVEE-Next: Shadow Rendering Refactor
Split shadow rendering per LOD per tilemap and improve
fragment shader invocation rate by using multi-viewport.

Also changes the layout of the atlas to be 4 x 4 x Layers.
This allow to grow the atlas while keeping the content
and page indirection correct, but this isn't implemented
in this patch.

# First attempt

Shadow rendering using atomic proved to be less than ideal
and performance were not quite to an acceptable level.

The previous method had issue with atomic contention when
a lot of triangle would overlap and too many fragment shader
invocations with quite complex indirection rules and biases
which made the technique costly.

The new implementation leverage multi viewport and
layered rendeing to effectively replace the need for atomic
and render directly to the shadow atlas. Using the well
supported extension these are free on modern hardware and
do not need a geometry shader.

One view per tile is needed since we use the viewport index
and the layer index as a way to index a specific tile in the
array.

# Geometric Complexity Problem

The counterpart of this is that we need to draw one geometry
instance per tile which is 32x32 time more instances (at most)
than with the previous method.

This means that we will have to find a way to mitigate this
geometry cost by either reducing the number of tiles per
tilemaps (in other words, making the system less memory efficient)
or splitting complex objects' geometry into smaller, more
cull friendly chunks (for example, like the sculpt PBVH nodes).
The later seems to be a longer term solution as it requires
way too much engineering time we have right now.

# Update Lag Problem

This also mean we can only update up to 64 tile per redraw
which is not enough even in the most basic cases. This leads
to missing or over shadowing when a light updates until there
is no updates and the shadow rendering can catch up.

One possible solution is to update a lower LODs first waiting
until there is no update to render. This would allow no artifact
during the transforms (unless there is too many light updates
even for lowest LOD, but that was an issue also for the
previous implementation). This could also help with the
geometric complexity.

# Solution

In the end, we decided to have one view per lod. This limits
the complexity of the fragment shader (improve speed),
reduces the number of views per tilemap (fix update lag),
and reduces the number of instances.
This also mean we cannot render directly to the atlas anymore
and reverted to the atomic solution. Using the smallest
possible viewport, we assure that there isn't that much fragment
shader invocations which was one of the bottleneck. And also
reduces the amount of geometry instances that pass the
clipping test.

Pull Request: https://projects.blender.org/blender/blender/pulls/110979
2023-08-17 17:35:19 +02:00