Skip any normals calculations for faceless mesh so no zero division
happens later. This may also improve performance since before
we visited all mesh vertices for no reason.
Pull Request: https://projects.blender.org/blender/blender/pulls/145237
The line workaround is no longer necessary since the
shader now uses SSBO and is less likely to have
issues (more tested path).
The source patching is now always done in the GL and VK
backend before compilation.
Pull Request: https://projects.blender.org/blender/blender/pulls/145240
The OpenGL specs require that the storage image qualifier in shaders
(e.g., "rgba32f") needs to be compatible with the format of a bound image
(see https://registry.khronos.org/OpenGL/specs/gl/glspec46.core.pdf#page=318).
We know that Blender currently does not handle this correctly in
multiple places. AMD and NVIDIA seem to silently ignore a mismatch and
just seem to use the format of the bound image. However, for the
Intel Windows drivers, this seems to lead to visual corruptions
(#141436, #141173). While a more graceful handling of a mismatch may
be nice, this is in line with the OpenGL specs.
This PR adds code for validating image formats for bindings.
Pull Request: https://projects.blender.org/blender/blender/pulls/143791
Use SSBO loads instead.
Contains a cleanup pass to bring this shader to current shader
standards.
This removes the non-instance version of the shader as it is
not necessary anymore.
The motivation for this is to remove the instance buffer from
the batch API.
Pull Request: https://projects.blender.org/blender/blender/pulls/145238
Use SSBO loads instead.
Add a new `GlyphQuad` interface.
Note that this reduces the size of glyph batch since the
buffer is always fully uploaded.
Can be improved with partial update later on if that causes
significant performance regression.
The motivation for this is to remove the instance buffer from
the batch API.
Pull Request: https://projects.blender.org/blender/blender/pulls/145225
When the `Join` operator was added to Grease Pencil v3 the behavior when
joining points was changed. The selected point would now be split from the
existing strokes and put into a new one.
This behavior is often undesirable, leading to multiple user reporting it as a
bug #130293, #141368, #131036, #132201, #136144 and #144300.
This PR adds a new mode, `Join Strokes` that behaves the same as legacy
grease pencil, and sets it as default. This PR also renames the existing modes
to `SplitAndCopy`, `SplitPoints` to better indicate the expected behavior.
Pull Request: https://projects.blender.org/blender/blender/pulls/144666
Sometimes when joining two or more strokes ends that were not close would be merge.
This was caused by using `dst_drawing` instead of `tmp_drawing`. The function
`compute_closest_range_to` would try to the the first and last point by using the drawing
that the `PointsRange` would have a pointer to.
But the `working_range` would point to `dst_drawing` with would have the `CurveGeometry`
of `dst_curves` instead of `tmp_curves`
This would lead to the wrong first and last points being used for deciding which end
to connect.
This problem could also lead to a crash by trying to get a curve that does not exist.
Pull Request: https://projects.blender.org/blender/blender/pulls/144668
Make sure brush property is never null. Flag will avoid setting brush
to null inside `RNA_property_pointer_set`. Flag also prevents
`UI_BUT_VALUE_CLEAR/PREDEFINED_EXTRA_OP_ICON_CLEAR` from being set which
are responsible for the `X` button (`UI_OT_button_string_clear`).
Pull Request: https://projects.blender.org/blender/blender/pulls/144531
Implementation of the design task #142969.
This adds the following:
- Exact GPU interpolation of curves of all types.
- Radius attribute support.
- Cyclic curve support.
- Resolution attribute support.
- New Cylinder hair shape type.

What changed:
- EEVEE doesn't compute random normals for strand hairs anymore. These are considered legacy now.
- EEVEE now have an internal shadow bias to avoid self shadowing on hair.
- Workbench Curves Strip display option is no longer flat and has better shading.
- Legacy Hair particle system evaluates radius at control points before applying additional subdivision. This now matches Cycles.
- Color Attribute Node without a name do not fetch the active color attribute anymore. This now matches Cycles.
Notes:
- This is not 100% matching the CPU implementation for interpolation (see the epsilons in the tests).
- Legacy Hair Particle points is now stored in local space after interpolation.
The new cylinder shape allows for more correct hair shading in workbench and better intersection in EEVEE.
| | Strand | Strip | Cylinder |
| ---- | --- | --- | --- |
| Main |  |  | N/A |
| PR |  |  |  |
| | Strand | Strip | Cylinder |
| ---- | --- | --- | --- |
| Main |  | | N/A |
| PR | ||  |
Cyclic Curve, Mixed curve type, and proper radius support:

Test file for attribute lookup: [test_attribute_lookup.blend](/attachments/1d54dd06-379b-4480-a1c5-96adc1953f77)
Follow Up Tasks:
- Correct full tube segments orientation based on tangent and normal attributes
- Correct V resolution property per object
- More attribute type support (currently only color)
TODO:
- [x] Attribute Loading Changes
- [x] Generic Attributes
- [x] Length Attribute
- [x] Intercept Attribute
- [x] Original Coordinate Attribute
- [x] Cyclic Curves
- [x] Legacy Hair Particle conversion
- [x] Attribute Loading
- [x] Additional Subdivision
- [x] Move some function to generic headers (VertBuf, OffsetIndices)
- [x] Fix default UV/Color attribute assignment
Pull Request: https://projects.blender.org/blender/blender/pulls/143180
Introduced in ba29593a17
This commit effectively reverts the above commit with a few extra
changes:
* We no longer recalculate a different `plane_normal` for the plane
check, as that check is performed by the brush local matrix.
* Fixes the incorrect usage of `plane_center` and `plane_normal` in the
degenerate usecase, though this practically had no effect as the brush
would not execute.
Pull Request: https://projects.blender.org/blender/blender/pulls/145151
This commit modifies the `OBJECT_OT_multires_base_apply` operator to
take in a new parameter which determines whether the final heuristic of
adjusting for a subdivision surface modifier applies.
Resolves#124553
Pull Request: https://projects.blender.org/blender/blender/pulls/145055
This argument is always passed as null. Removing it simplifies the
transition to `AttributeStorage`. Nowadays it seems that most more
complicated interpolation needs are not handled directly by the
CustomData system.
Pull Request: https://projects.blender.org/blender/blender/pulls/145197
Don't rely on the contexts window to ensure windows have their
scene updated when removing, since the window may be cleared and
there may be multiple windows.
When resizing areas there is a line shown along the edge to help
indicate that you have pressed the correct location. This PR just
quickly animates this line into place, rather than immediately.
Pull Request: https://projects.blender.org/blender/blender/pulls/140616
This BLF adds a public function that returns the maximum extext of a
font's glyphs. BLF_bounds_max returns a rctf of the minimum rect that
can contain any of the font's glyphs. Can be useful to know when sizing
a bitmap without knowing the final string contents.
Pull Request: https://projects.blender.org/blender/blender/pulls/145016
When creating a directory recursively (via
`BLI_file_ensure_parent_dir_exists()` or `BLI_dir_create_recursive()`,
filter out errors that indicate that the directory already exists.
This is now also covered by a unit test.
I've also removed `BLI_assert(BLI_exists(dirname) == 0);` from
`dir_create_recursive()` (the workhorse for the above-mentioned
functions), for two reasons:
- The function is only used in an "ensure this directory exist"
context, so the directory existing should be fine, and
- the assertion doesn't guarantee that the subsequent call to
`mkdir()` actually succeeds. Race conditions between Blender and
other processes (potentially on other computers, when using
networked filesystems) will make such a precondition test
unreliable.
This is a followup of 00abaa571a.
Pull Request: https://projects.blender.org/blender/blender/pulls/145173
For historical reasons these were stored in sRGB space, which caused all
kinds of complexity.
* For image painting, it now properly uses the byte buffer colorspace
instead of assuming sRGB or display colorspace. This can be more expensive,
so there is a fast path for sRGB buffers (and for fixed brush colors).
* Lots of code was changed to remove conversion when painting float images
or vertex colors, and added when painting byte images.
* For non-color data, there is now no colorspace conversion between the brush
color and image pixels, and #143642 was basically reverted because of that.
Compatibility notes:
* Backwards compatibility is not perfect, as we can not determine if the
brush has non-color data in isolation. We always convert sRGB to linear,
and existing brushes configured with non-color data need to be manually
fixed.
* There is forward compatibility, the old sRGB value is still stored next
to the scene linear value.
Pull Request: https://projects.blender.org/blender/blender/pulls/144400
Optimize instancing performance by syncing all instances at once.
Part of #130291
At the moment, it only works for certain Object types in Workbench and
Overlay.
Everything else follows a path similar to the previous one.
Performance on instancing heavy scenes can range from 1.5x to 3x faster
depending on hardware and platform.
Pull Request: https://projects.blender.org/blender/blender/pulls/140378
Recently 1ebefb8252 changed ffmpeg related logs to go through
CLOG. However, previously things coming from ffmpeg innards
via ffmpeg_log_callback were not logged at all, unless user
has explicitly asked for --debug-ffmpeg.
Many ffmpeg internal logs are not actionable and are missing
any context, thus now producing logs like:
"Could not update timestamps for discarded samples"
"Estimating duration from bitrate, this may be inaccurate"
"Could not find codec parameters for stream 2 (Audio: none (apac / 0x63617061), 48000 Hz, 2 channels, 396 kb/s): unknown codec"
"SCAN: Frame belongs to an unexpected GOP!"
"st: 2 edit list: 1 Missing key frame while searching for timestamp: 0"
Which is not very useful. Make it so that that errors/warnings coming
from ffmpeg_log_callback are treated as "info" CLOG level.
Pull Request: https://projects.blender.org/blender/blender/pulls/145172
When using multiple planar probes only the last one would
be visible. The other probes would use the world probe.
Reason is that the data of planar probes are stored in
layered textures. When updating planar probes framebuffers
are created with the correct layer attached.
Vulkan backend missed some code paths to clear a single layer
when clearing a framebuffer where the previous action had depth
write disabled. This PR adds the missing code path.
Pull Request: https://projects.blender.org/blender/blender/pulls/145170
A node would not show the "Collapse/Expand" arrows (caused by
87c011f8bb which moved the drawing code for the input nodes a new
`custom_draw_fn` callback on the socket declaration).
Related fix: 7f07124d30
So in order to resolve, make sure we have correct conditions to show the
expander and also make sure we draw the custo buttons in appropriate
places.
NOTE: not sure if there are better ways to achieve the correct UI split
alignment, since we draw with empty labels, I had to flag with
`UI_ITEM_R_SPLIT_EMPTY_NAME` in the new `custom_draw_fn` callbacks.
Pull Request: https://projects.blender.org/blender/blender/pulls/144993
This is motivated by the latest changes to the preprocessor
which outputs a lot of line directives when code is
generated or unrolled.
In this case the reported line would be correct but not
correctly displayed.
Moreover the system of outputing hashes inside the
`#line` directive proved to be incompatible with some
compilers and tools (renderdoc).
This commit always comments the line directives before
compilation (solves the compatibility issue).
When error logging, we then scan the commented
directives to output the correct filename and source
line. The log line is kept untouched and will show
the correct final generated code that triggered the
error.
This also fixed the error line parsing for vulkan.
Pull Request: https://projects.blender.org/blender/blender/pulls/145096
This PR make it so that the Fill tool will use evaluated geometry.
Allowing for regions created by `Bézier`, `NURBS` and
`Catmull Rom` to be filled.
Note that the added geometry is still of curve type `Poly`.
Pull Request: https://projects.blender.org/blender/blender/pulls/144662
Blender grid rendering interprets voxel transforms in such a way that the voxel
values are located at the center of a voxel. This is inconsistent with OpenVDB
where the values are located at the lower corners for the purpose or sampling
and related algorithms.
While it is possible to offset grids when communicating with the OpenVDB
library, this is also error-prone and does not add any major advantage.
Every time a grid is passed to OpenVDB we currently have to take care to
transform by half a voxel to ensure correct sampling weights are used that match
the density displayed by the viewport rendering.
This patch changes volume grid generation, conversion, and rendering code so
that grid transforms match the corner-located values in OpenVDB.
- The volume primitive cube node aligns the grid transform with the location of
the first value, which is now also the same as min/max bounds input of the
node.
- Mesh<->Grid conversion does no longer require offsetting grid transform and
mesh vertices respectively by 0.5 voxels.
- Texture space for viewport rendering is offset by half a voxel, so that it
covers the same area as before and voxel centers remain at the same texture
space locations.
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/138449
Faster and better looking VSE scopes & "show overexposed". Waveform &
RGB Parade now can also show HDR color intensities. (Note: this is
only about VSE scopes; Image Space scopes are to be improved separately)
- Waveform, RGB Parade, Vectorscope scopes are done on the GPU now, by
drawing points for each input pixel, and placing them according to
scope logic. The point drawing is implemented in a compute shader,
with a fragment shader resolve pass; this is because drawing lots of
points in the same location is very slow on some GPUs (e.g. Apple).
The compute shader rasterizer is several times faster on regular
desktop GPU as well.
- If a non-default color management is needed (e.g. VSE colorspace is
not the same as display colorspace, or a custom look transform is used
etc. etc.), then transform the VSE preview texture into display space
RGBA 16F texture using OCIO GPU machinery, and calculate scopes
from that.
- The "show overexposed" (zebra) preview option is also done on the
GPU now.
- Waveform/Parade scopes unlock zoom X/Y aspect for viewing HDR scope,
similar to how it was done for HDR histograms recently.
- Added SEQ_preview_cache.hh that holds GPU textures of VSE preview,
this is so that when you have a preview and several scopes, each of
them does not have to create/upload their own GPU texture (that would
both waste memory, and be slow).
Screenshots and performance details in the PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/144867
Most of these crashes happen because it is assumed that the scene will
always be present even if we have an uninitialized `Editing`, which is
no longer the case with #140271.
- Fix crash when clicking and dragging in the scrub area by checking for
valid `sequencer_scene` in `change_frame_poll`
- Fix crashes when selecting menu items by disabling them in the UI
until a `sequencer_scene` is present
- Fix crashes running operators from the F3 menu by changing to more
restrictive polls that check for `sequencer_scene`
- For good measure, check before dereferencing in
`channels_displayed_get`, `active_seqbase_get`, and `editing_get`
Pull Request: https://projects.blender.org/blender/blender/pulls/145145
Add geometry file import nodes support to the for-each-path logic.
This will make `bpy.data.file_path_map()` report the input files for
OBJ, PLY, etc. import nodes (and any other node that has a string
property of subtype `PROP_FILEPATH`).
Currently this only supports static file paths, so where the file path
is set as the input socket's default value. When the path is
determined via any noodle, this is ignored and the default value is
reported anyway.
This is necessary for the new version of Blender Asset Tracer, which
in turn is needed to resolvestudio/flamenco#104423.
Pull Request: https://projects.blender.org/blender/blender/pulls/144874
This does a few things:
- Add support for templated struct.
- Change parsing of template scope.
Now all template scope `<..>` are parsed properly.
- Rework to support better match syntax.
- Avoid warning from scope guard processing. Now initialize
the return value to zero.
Pull Request: https://projects.blender.org/blender/blender/pulls/145132
Workbench transparency outlines where not working. The cause was that
the incorrect texture was bound in the pipeline due to unused
attachments being removed from the pipeline.
It seems to be an error since we added render pass support. This support
has already been removed.
Pull Request: https://projects.blender.org/blender/blender/pulls/145120
Make rasterization consistently work in local tile coordinates.
Also avoid memory leak when baking multiple tiles: high resolution bake
mesh has been created for every tile.
Pull Request: https://projects.blender.org/blender/blender/pulls/145163