Commit Graph

31 Commits

Author SHA1 Message Date
Aras Pranckevicius
4e7acc4be8 Fix #138834: FBX import improved pivot handling
This does not fully fix the issue (pivots are still not handled
correctly when an object contains negative scale -- filed upstream
ufbx issue https://github.com/ufbx/ufbx/issues/218), but for regular
cases the pivots are in much better places now.

Pull Request: https://projects.blender.org/blender/blender/pulls/139381
2025-05-24 15:22:19 +02:00
Campbell Barton
a0e1938021 Cleanup: remove spaces from filenames, unix line endings
Also rename "blender export import test suite description.txt" to
"readme.txt" as the filename was including information available
in the leading path.
2025-05-23 14:32:45 +10:00
Brecht Van Lommel
ee619713f9 Tests: Add test files for new light features
Ref #136958, #134303
2025-05-22 16:32:44 +02:00
Eqkoss / T1NT1N
bb9d5cdaad Lights: Add normalize property
When enabled, this normalize the strength by the light area, to keep
the total output the same regardless of shape or size. This is the
existing behavior.

This is supported in Cycles, EEVEE, Hydra, USD, COLLADA.

For add-ons, an API function to compute the area is added for conversion,
in case there is no native support for normalization.

area = light.area(matrix_world=ob.matrix_world)

Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/136958
2025-05-22 16:32:44 +02:00
Jesse Yurkovich
e84c60561c Cleanup: Remove Dots Stroke material from USD's empty.blend test file
This extra material in what should be an empty file often makes some
checks and text comparisons needlessly more confusing.

Pull Request: https://projects.blender.org/blender/blender/pulls/139228
2025-05-21 20:42:11 +02:00
Habib Gahbiche
289984d868 Tests: Compositor: add test with animated input
Pull Request: https://projects.blender.org/blender/blender/pulls/139227
2025-05-21 20:21:46 +02:00
Aras Pranckevicius
8119e4baa7 Fix: FBX importer was not skipping special MotionBuilder viewport cameras
Reported on devtalk: MotionBuilder produced FBX files contain
"cameras" that are not really user visible cameras, but rather map to
MotionBuilder viewports. They are at root, have no child elements,
and have special names. There is also a "camera switcher";
ignore that too.

Pull Request: https://projects.blender.org/blender/blender/pulls/139204
2025-05-21 11:15:20 +02:00
Aras Pranckevicius
389d770bf4 Fix #122256, #123862: OBJ import Clamp Size option issues
- #122256: Clamp Size option did not work at all, due to mesh
  bounding box still not being calculated (and was firing an assert
  in Debug build).
- #123862: Clamp Size option was rounding the resulting scale to
  powers of ten, which is not what anyone would expect.

This fixes both issues, and adds test coverage.

Co-authored-by: dshot92 <dshot92@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/139145
2025-05-20 11:57:42 +02:00
Jesse Yurkovich
46ec277713 USD: Add support for UsdPrimvarReader_TYPE in materials
Add support for the UsdPrimvarReader_TYPE templates for both import and
export. These are used by several USD test assets and support here
represents the last major piece of the UsdPreviewSurface spec to be
implemented.

On import these become `Attribute` nodes and on export the `Attribute`
nodes will become `UsdPrimvarReader_TYPE`'s accordingly.

Import:
- `UsdPrimvarReader_float` and `UsdPrimvarReader_int` will use the `Fac`
  output
- `UsdPrimvarReader_float3` and `UsdPrimvarReader_float4` will use the
  `Color` output
- `UsdPrimvarReader_vector`, `UsdPrimvarReader_normal`, and
  `UsdPrimvarReader_point` will use the `Vector` output

Export (only `Geometry` Attribute types are considered):
- `Fac` will use `UsdPrimvarReader_float`
- `Color` will use `UsdPrimvarReader_float3`
- `Vector` will use `UsdPrimvarReader_vector`
- `Alpha` is not considered

MaterialX note:
Hydra-native support is a bit more involved and will have to be done
separately. Hydra w/USD sync is trivial to implement but those changes
have been left out here.

Pull Request: https://projects.blender.org/blender/blender/pulls/135143
2025-05-19 19:47:22 +02:00
Jacques Lucke
e981345a73 Fix #139055: failing implicit conversion between different subtypes
There are separate `bNodeSocketType` for each subtype. Hence, comparing
their pointers is not enough to determine whether a conversion is necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/139083
2025-05-19 15:39:09 +02:00
Brecht Van Lommel
59b4842117 Cycles: Adaptive subdivision triangular patches
There is a corner case where one side of a quad needs splitting and the other
side has only one segment. Previously this would produce either gaps or after
recent changes to stitch together geometry, uninitialized memory.

Now solve this by splitting into triangular patches, as suggested in the
DiagSplit paper. These triangular patches can be further subdivided themselves.
Dicing has special cases for 1 or 2 segments on edges. For more segments it
works the same as: quad dicing: A regular inner triangle grid stitched to the
outer edges.

Fix #136973: Inconsistent results with adaptive subdivision

Pull Request: https://projects.blender.org/blender/blender/pulls/139062
2025-05-19 12:04:11 +02:00
Lukas Stockner
a6015e1411 Cycles: Fix inconsistency in Ng handling between Microfacets and other closures
In Cycles, the convention is that reflection vs. refraction are classified
based on the hemisphere defined by the *shading* normal (N).

In general, most closure code uses the shading normal for most operations,
as is expected since using the geometric normal (Ng) would break normal maps
and smooth shading.

However, there are two places that use Ng: On the one hand, BSDF sampling
functions generally reject reflections that fall below the Ng hemisphere, since
they'd intersect the geometry when tracing the bounce. This is required, and
we can't do much about it.
On the other hand, the Microfacet evaluation code also checked that the ray
is in the same hemisphere w.r.t. both shading and geometric normal.

Theoretically, this is the right thing to do, since sampling and evaluation code
are supposed to be consistent. However, doing so breaks smooth shading, since
now direct light evaluation near the terminator will sometimes be rejected.

This didn't cause problems in practice because of another inconsistency: While
the parameter of the eval functions was named Ng, the caller actually provided
N (unclear whether by mistake or as a hacky workaround to the terminator).
When this was fixed in 063a9e89, users quickly reported issues with the shadow
terminator, so it was reverted to the hacky inconsistency in 1c50dd8b.

So, let's clean this mess up properly. If we don't want to do the Ng hemisphere
check in _eval, then instead of passing in a misleading value that ends up
making it a no-op, just remove the check. After all, the other closures don't
perform it either.

This way, we avoid the mislabeled Ng, we get rid of the special case for
microfacets, and the shadow terminator continues to be fine.

Technically, we still have the _sample vs. _eval mismatch. However, this is just
unavoidable, and is irrelevant in practice: For a strongly directional light
that makes the shadow terminator noticeable, the MIS weights will be massively
in favor of eval, to the point that it doesn't really matter what sample does.

To support this argument: You can actually reproduce a broken shadow terminator
in pretty much every Cycles version going back to 2011 by just setting up a
small intense mesh emitter, turning off MIS on it to disable _eval, and then
rendering a diffuse smooth-shaded sphere with >100000 samples so that the
fireflies resolve into somewhat consistent lighting.
If nobody has complained about this affecting all closures for 11 years,
I guess it's fine.

Pull Request: https://projects.blender.org/blender/blender/pulls/138632
2025-05-18 17:20:32 +02:00
Jacques Lucke
1816a2665e Tests: Geometry Nodes: add initial Import CSV node tests
Previously, the test files still had absolute instead of relative paths in them.

Pull Request: https://projects.blender.org/blender/blender/pulls/139020
2025-05-18 07:34:57 +02:00
Jacques Lucke
3c39c46e3d Revert "Tests: Geometry Nodes: add initial Import CSV node tests"
This reverts commit e9da1e8629.

Looks like these tests don't succeed yet, maybe WITH_IO_CSV is off?
2025-05-17 13:35:40 +02:00
Jacques Lucke
e9da1e8629 Tests: Geometry Nodes: add initial Import CSV node tests 2025-05-17 11:17:57 +02:00
Jesse Yurkovich
3b2bbad609 USD: Add support for Text objects during export
Similar to the existing meta-ball export, and the other exporters,
convert Text objects to meshes for export.

Ref #138883

Pull Request: https://projects.blender.org/blender/blender/pulls/138903
2025-05-16 22:12:48 +02:00
Aras Pranckevicius
de5d0cfdc5 Fix #138795: FBX importer was not handling armatures with non-bone nodes
File under #138795 showed several issues, which, while investigating
them, led to also fixing some other issues.

- FBX files can contain non-bone nodes in between actual bone nodes
  ("fake bones" as they used to be called in Python importer). Handling
  this case was missing in the new importer.
- Due to above, some armatures had what appeared like multiple
  "root bones" inside them, which led to crashes while importing
  animations.
- Meshes with multiple armature modifiers (multiple skin deformers
  in FBX) were not handled correctly, see
  https://projects.blender.org/blender/blender-addons/issues/45171
  for when the same issue was fixed in the Python importer.

Extended test coverage to encompass the above.

Pull Request: https://projects.blender.org/blender/blender/pulls/138992
2025-05-16 21:45:27 +02:00
Mattias Fredriksson
bc0913240f Fix: Improve Obj importers parsing and detection of NURBS knot mode
Reworks the implementation for how knots are interpreted when importing
NURBS in .obj format. It refactors each test into a separate function
and simplifies functions using a 'multiplicity sequence' which counts
repeated occurances of knot values (or their 'multiplicity'). Making
comparisons simpler, clearer, and with improved correctness.

With regard to regression tests behavior is almost the same, noticable
difference is consideration of cyclic. Allowing curves with multiplicity
at the endpoints to be cyclic (so Bezier curves can be cyclic given
one repeated point). Untested behavior may also have been 'refined'
(changed), but additional tests would be needed to identify those cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/138778
2025-05-16 15:44:38 +02:00
Michael B Johnson
af0cfcb01c MaterialX: Export Principled BSDF as OpenPBR Surface
Switch from Standard Surface to OpenPBR as the exported MaterialX surface,
since this is the new standard more renderers are adopting and it more closely
matches the Principled BSDF implementation.

Anisotropy support is improved though still not quite the same, as formulas
are different. Nodes are generated to apply anisotropic rotation to the
tangent vector, as there is no corresponding parameter in OpenPBR.

Fixes #138164

Authored by Apple: Lee Kerley

Pull Request: https://projects.blender.org/blender/blender/pulls/138165
2025-05-15 19:13:36 +02:00
Aras Pranckevicius
6a0e6f5cff Fix: New FBX importer was not handling blender specific FullWeights
- Update to latest ufbx version that adds support for FullWeights
- Handle that in the same way as the Python importer did
- Add test files from ufbx test suite

Pull Request: https://projects.blender.org/blender/blender/pulls/138811
2025-05-13 15:43:08 +02:00
Alaska
9890ad2653 Fix: Render test failure when building without ocean sim
There was one test in the volume render test folder that made use of
the ocean sim modifier to add some detail. This lead to test failures
when building Blender without ocean sim.

To fix this issue, this commit applies the ocean sim modifier. This
means it's no longer used, but the render results are the same,
meaning there is no need to update the reference images.

Pull Request: https://projects.blender.org/blender/blender/pulls/138729
2025-05-13 05:07:58 +02:00
Mattias Fredriksson
d0cf7dd8b5 Fix: Improve OBJ NURBS IO, support exporting custom knots
Corrects behavior with NURBS knot values in .obj exporter. Knot values
denoting the curve parameter range and values at the boundary region
in the span ends had hardcoded knot values. It also implemented its own
knot calculation, which is not ideal...

Importer is updated to not try to second guess the knot values.
Not entirely sure what it was trying to do but it used wrong indices
and missed writing the end of the knot vector. Combined the changes
should make it possible to import and export a simple NURBS curve with
custom knots and leaving it intact.

This replaces some of the erronous behavior using functions from [new]
Curves implementation. Mixing new and legacy curve implementation is not
ideal but exporter is exporting POLY curves as NURBS while legacy method
does not support computing the knot vector. To avoid introducing
additional branch cases nor update legacy functions, using the new
functions seems to be the correct choice. These functions should be
functionally equivalent but is not identical (e.g. legacy curve returns
knots in [0, 1] range). It should also make it easier to transition to
exporting new Curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/138732
2025-05-12 16:51:21 +02:00
Aras Pranckevicius
a96ecd2834 Fix #137768: new FBX importer does not import some animations correctly
- FBX "root bone" should become the Armature object itself, and not
  an extra bone (follow same logic as Python importer did).
- "World to armature matrix" was not correct for armatures that are
  parented under some other objects with transforms.
- Parenting imported meshes under an Armature was not taking into
  account that the mesh bind transform might not be the same as the
  current mesh node transform (i.e. was not setting "matrix parent
  inverse" to compensate like the Python importer did).
- The repro file in #137768 also exposed an issue that importing custom
  vertex normals was not working correctly in the new importer, when
  mesh is partially invalid (validation alters the mesh, custom normals
  have to be set afterwards).

Pull Request: https://projects.blender.org/blender/blender/pulls/138736
2025-05-12 10:56:07 +02:00
Ian Yoo
e0dc538854 Tests: Add non-rotation regression test for glare_simple_star filter
The current regression tests for the Glare Node cover most but not all
of the code. In this case, the simple_star test only tested for 45
degree rotation offset of the glare highlight.
This will add a simple_star_no_rotation.blend regression test and its
corresponding output_render png to cover the no offset case.

The function, line, and region coverage have improved by about ~9-10%

Pull Request: https://projects.blender.org/blender/blender/pulls/138587
2025-05-11 15:34:24 +02:00
Jesse Yurkovich
2b4eb5ccfd Fix: USD: Don't attempt to export the special sharp_face attribute
While it hasn't seemed to affect anything currently, it's unnecessarily
wasteful in the resulting file and risky to be importing back in.

Pull Request: https://projects.blender.org/blender/blender/pulls/138699
2025-05-10 08:08:16 +02:00
Jacques Lucke
18365a88bd Geometry Nodes: initial Import node regression tests
This adds some basic tests for the Import OBJ/STL/PLY nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/138700
2025-05-10 07:24:33 +02:00
Alexandre-Cardaillac
921c2b9d61 Shader: New Volume Coefficients Shader
Add a new shader node to control volume coefficients (scattering,
absorption and emission) directly, making it easier to model existing
volumes with measured data.

Pull Request: https://projects.blender.org/blender/blender/pulls/136287
2025-05-08 19:19:35 +02:00
Hans Goudey
92de7a4cbf Fix #138279: Realize instances node with depth input can crash
When not all the meshes referenced by the instances recursively
are realized because of the limit of the depth input, and those
meshes have vertex groups, a crash is possible because of an
un-checked VectorSet lookup. `all_meshes_info.order` includes
all meshes regardless of the depth and mask arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/138519
2025-05-07 02:15:04 +02:00
Weizhen Huang
64dc9cc98c Fix: Cycles: Inconsistency in transparent bounces for NEE and forward path
Note: this is a partial fix, that makes NEE and forward path consistent
only when `max_transparent_bounce > 0`. It is much more involved to make
forward path tracing support a max transparent bounce of 0, but since we
don't expect people to set up a very low number of transparent bounces,
it is less important to support that specific case.

Pull Request: https://projects.blender.org/blender/blender/pulls/138098
2025-05-05 18:38:02 +02:00
Weizhen Huang
157979167b Fix: correct path for overlay test 2025-05-05 18:34:28 +02:00
Sergey Sharybin
bbfc97ad6f Move tests/data and assets to the main repository
This change moves the tests data files and publish folder of assets
repository to the main blender.git repository as LFS files.

The goal of this change is to eliminate toil of modifying tests,
cherry-picking changes to LFS branches, adding tests as part of a
PR which brings new features or fixes.

More detailed explanation and conversation can be found in the
design task.

Ref #137215

Pull Request: https://projects.blender.org/blender/blender/pulls/137219
2025-05-05 15:10:22 +02:00