revert Fix: weight and vertex paint radial symmetry wrong with mirror
Was causing #121155, will check again on Monday
Both vertexpaint and weightpaint would only apply all of radial symmetry
for the "initial stroke".
When going over the combinations of symmetry axis, some of radial
symmetry would be skipped, e.g. when mirroring from right to left with
`Mirror X` turned ON, a dab on the right would have radial symmetry from
that point, and an additional dab on the left from mirroring (but the
mirrored dab would not have radial symmetry on its own).
This does not lead to symmetric results at all, sculptmode also does not
behave that way (there, radial symmetry is performed on the mirror axis
as well).
Now do the same thing as in sculptmode to get symmetric results when
using mirror and radial symmetry together.
Also use the utility function to skip invalid symmetry iterations.
Stumbled over this when looking into #120843
Pull Request: https://projects.blender.org/blender/blender/pulls/120931
This happened, because of lazy initialization of clicked retiming keys.
When the key is moved, the speed changed in respect to strip start, not
(uninitialized, but drawn) key at left handle.
Initialize both keys when any virtual key is selected.
Remove the one-definition-rule violation due to two `Triangle` types
being used inside the same `blender::io::stl` namespace. Make a small
set of non-functional changes in the surrounding code along the way to
use `const` in more places.
STL had 4(!!) triangle types:
- A `class Triangle` : Used for import, contains indices
- A `struct Triangle` : Used for export, contains verts/normals, the ODR
violation
- A `struct ExportBinaryTriangle` : Used for export but is really the
same as the above type
- A `struct STLBinaryTriangle` : Used for import but was a duplicate
of the above type
Now STL has just 2. The `class Triangle` containing indices during
import and a `struct PackedTriangle` containing the verts/normals for
everything else. The duplicated `BINARY_HEADER_SIZE` constant is now
common as well.
Performance remains the same for both import/export and ascii/binary.
Pull Request: https://projects.blender.org/blender/blender/pulls/121179
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
The difference was that the depth slope bias was not
written to the depth buffer which could lead to situation
where the value written to the color target was greater
than it should.
Use the depth write feature to output the slope biased
depth. Output 1 depth to not discard and loose the benefit
of early depth test.
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.
Add a "Mouse Position" node that outputs the location of the mouse
cursor in region space and the overall size of the region, both in pixel
units. Both outputs are integers to help reflect their pixel units.
If there the mouse position is ever accessible in sub-pixels, they can
easily be changed to floats.
Also add a "Wait for Cursor" option similar to the one for some built-in
operators that delay's the operator's execution until there is a mouse
click in the viewport. That way the operator can be called from menus
even though it is interactive. This option is placed in the node editor
header. When there are more options, it will be part of an "Options"
popover panel similar to the existing "Modes" and "types" popovers.
Combined with the viewport transform node, and other nodes like Raycast,
these features can allow making tools that create geometry where you
click in the scene.
Pull Request: https://projects.blender.org/blender/blender/pulls/121043
Add a node that outputs the transform of the viewport relative to the
self object's transform. This node can be used to build effects like
billboarding or aligning geometry to the current view. In combination
with the mouse position node in the future it will allow tools like
generating geometry at the mouse click position.
There are two output matrices. The first is the projection matrix
that takes positions in camera space and applies the final perspective
projection. The other is the "view" matrix which contains the location
and rotation of the camera. These are separate because though their
combination is useful, it isn't used like a typical rotation/transform matrix.
Pull Request: https://projects.blender.org/blender/blender/pulls/118680
Clamp some of the inputs of the Glossy BSDF, Glass BSDF, Sheen BSDF,
and Subsurface Scattering nodes to improve consistency between render
engines and to avoid unexpected results.
* Clamp roughness to 0..1
* Clamp subsurface radius to 0..inf
* Clamp colors to 0..inf
Pull Request: https://projects.blender.org/blender/blender/pulls/120390
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
Use `FileHandlers` to handle file drag-n-drop in Node Editors. Drop-boxes
still remain since they handle Images ID drag-n-drop.
This also allows to open/drag-n-drop multiple files at once.
Also this will allow add-ons to also support drag-n-drop for images and
movies in node editors while still providing access to Blender's native
support since File Handlers let users choose which to invoke if there's
multiple configured.
Pull Request: https://projects.blender.org/blender/blender/pulls/121051
When e.g. using auto-key to draw on a new frame, the dopesheet
(and other editors) would not redraw to show the newly added keyframe.
This fix makes sure we send notifiers to those editors when a
keyframe is added.
The "uniform thickness" was still in the legacy "pixel" space. The fix
makes sure that value is always converted to the right radius space.
We also convert the potentially animated property for the thickness
and scale the fcurves to be in the right space.
Pull Request: https://projects.blender.org/blender/blender/pulls/121128
When using a version of Wayland that doesn't support trackpad direction
show an option to set the direction manually.
While this is a stop-gap measure until compositors support seat
version 9, the latest GNOME doesn't yet support this, so there will
be users for some years without this functionality.
Addresses issue raised in #107676.
Add _bpy._wm_capabilities(), needed for preferences code to check if
WM functionality is supported. This could be made into a public
function, see code comments for details.
Support detecting if the trackpad direction flag is propertly set
(currently unused).
Needed so Wayland compositors that don't support seat-version 9 or
newer (GNOME-46 & KDE5 for e.g) can have a working trackpad.
Eventually this option will be removed when the functionality is
widely supported.
No functional changes.
This PR moves the `ANIM_get_keyframing_flags` function to
animrig as `get_keyframing_flags`.
The docstring has been fixed since it was out of date.
Pull Request: https://projects.blender.org/blender/blender/pulls/121120
This adds a new `Transform` type similar to cycles that reduces
the amount of data passed for a typical affine 3D transform.
This then applies this type to the light data and cleanup
all usage of the former `object_mat`. This also changes the axes
macros into utility accessor functions.
Pull Request: https://projects.blender.org/blender/blender/pulls/121089
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.
This was because the distance function was assuming that
the radii were still in the legacy `px` space rather than in the
same space as the positions.
The function wasn't updated after the merge of
07749b389d
The division by `2000.0f` can be removed.
These are not fully supported, users who load these will not be able
to access all the faces within the TTC/OTC.
Existing uses of TTC/OTC won't be blocked, these are just not shown as
supported fonts in the file selector. Addresses #44254.
Ref !121060
Both vertexpaint and weightpaint would only apply all of radial symmetry
for the "initial stroke".
When going over the combinations of symmetry axis, some of radial
symmetry would be skipped, e.g. when mirroring from right to left with
`Mirror X` turned ON, a dab on the right would have radial symmetry from
that point, and an additional dab on the left from mirroring (but the
mirrored dab would not have radial symmetry on its own).
This does not lead to symmetric results at all, sculptmode also does not
behave that way (there, radial symmetry is performed on the mirror axis
as well).
Now do the same thing as in sculptmode to get symmetric results when
using mirror and radial symmetry together.
Also use the utility function to skip invalid symmetry iterations.
Stumbled over this when looking into #120843
Pull Request: https://projects.blender.org/blender/blender/pulls/120931
While using texture on the brush in vertex paint mode (neither generated
or imported texture), the brush texture is sampled based off of the
unmirrored coordinate.
To resolve, use the same method that sculptmode uses in
`sculpt_apply_texture` (flipping the coordinate over the mirror axis).
Pull Request: https://projects.blender.org/blender/blender/pulls/120935
Previously, the track axis would remain X on the other side. It should
be flipped to -X to give a symmetrical result.
Building upon ee43cf5722, this adds support for flipping the track
axis in certain constraints, namely:
- Track To
- Locked Track
- Damped Track
- Shrinkwrap
Pull Request: https://projects.blender.org/blender/blender/pulls/120979
Exposed by 6c774feba2
`BM_mesh_decimate_dissolve_ex` sets up `DelimitData` with layer offset
(start), size and end so that `bm_edge_is_contiguous_loop_cd_all` can
check a range of edges for being contiguous.
The way `cd_loop_offset_end` is calculated is wrong though, it does not
take the actual start into account (this has to be added to fix the
bug). When it is wrong, it can happen that start and end are the same,
so no check actually takes place and no delimiting edges are found.
It seems that prior to 6c774feba2 the customdata layer always had an
offset of zero, so never really showed in practice (at least I couldnt
make it break in 3.4), but after 6c774feba2 we can at least observe the
following:
- when creating a bmesh, an offset would to the uv layer would still be
zero in my tests
- however, as soon as we iterate loops of a face (as done in the
report), we get an additional layer `CD_BM_ELEM_PYPTR`
- this then changes the offset
- `BM_uv_map_get_offsets_from_layer` seems to do the right thing afaict
So to resolve, just add the "start" offset to the end, to get the right
range.
NOTE: there is a very similar `DelimitData` used in
`bmesh.ops.join_triangles` and the way in which `bm_edge_delimit_cdata`
sets up te range is exactly like what this PR proposes.
Pull Request: https://projects.blender.org/blender/blender/pulls/121033
While additional context is typically useful to include,
this is such a corner-case that it's not expected script authors
would run into this during regular development.
Since the flood fill callback uses FunctionRef now, there is no need to pack
the relevant arguments into a separate struct. Though there are a lot of
arguments now, there is one less indirection which hels when clicking
through the code.