Age | Commit message (Collapse) | Author |
|
Motivation is to disambiguate on the naming level what the matrix
actually means. It is very easy to understand the meaning backwards,
especially since in Python the name goes the opposite way (it is
called `world_matrix` in the Python API).
It is important to disambiguate the naming without making developers
to look into the comment in the header file (which is also not super
clear either). Additionally, more clear naming facilitates the unit
verification (or, in this case, space validation) when reading an
expression.
This patch calls the matrix `object_to_world` which makes it clear
from the local code what is it exactly going on. This is only done
on DNA level, and a lot of local variables still follow the old
naming.
A DNA rename is setup in a way that there is no change on the file
level, so there should be no regressions at all.
The possibility is to add `_matrix` or `_mat` suffix to the name
to make it explicit that it is a matrix. Although, not sure if it
really helps the readability, or is it something redundant.
Differential Revision: https://developer.blender.org/D16328
|
|
This commit replaces the `Mesh_Runtime` struct embedded in `Mesh`
with `blender::bke::MeshRuntime`. This has quite a few benefits:
- It's possible to use C++ types like `std::mutex`, `Array`,
`BitVector`, etc. more easily
- Meshes saved in files are slightly smaller
- Copying and writing meshes is a bit more obvious without
clearing of runtime data, etc.
The first is by far the most important. It will allows us to avoid a
bunch of manual memory management boilerplate that is error-prone and
annoying. It should also simplify future CoW improvements for runtime
data.
This patch doesn't change anything besides changing `mesh.runtime.data`
to `mesh.runtime->data`. The cleanups above will happen separately.
Differential Revision: https://developer.blender.org/D16180
|
|
|
|
The flicker was caused by the failure for checking both triangles for
flags. Now fixed.
|
|
|
|
|
|
|
|
This makes it easier to pass more parameters to the iterator in the future.
Differential Revision: https://developer.blender.org/D16047
|
|
|
|
While both are supported, 'arg' is in more common use so prefer it.
|
|
This option allows easier setup of intersection overrides on more
complex scene structures. Setting force intersection would allow objects
to always produce intersection lines even against no-intersection ones.
Reviewed By: Aleš Jelovčan (frogstomp) Antonio Vazquez (antoniov)
Differential Revision: https://developer.blender.org/D15978
|
|
Use `verts` instead of `vertices` and `polys` instead of `polygons`
in the API added in 05952aa94d33eeb50. This aligns better with
existing naming where the shorter names are much more common.
|
|
|
|
For copy-on-write, we want to share attribute arrays between meshes
where possible. Mutable pointers like `Mesh.mvert` make that difficult
by making ownership vague. They also make code more complex by adding
redundancy.
The simplest solution is just removing them and retrieving layers from
`CustomData` as needed. Similar changes have already been applied to
curves and point clouds (e9f82d3dc7ee, 410a6efb747f). Removing use of
the pointers generally makes code more obvious and more reusable.
Mesh data is now accessed with a C++ API (`Mesh::edges()` or
`Mesh::edges_for_write()`), and a C API (`BKE_mesh_edges(mesh)`).
The CoW changes this commit makes possible are described in T95845
and T95842, and started in D14139 and D14140. The change also simplifies
the ongoing mesh struct-of-array refactors from T95965.
**RNA/Python Access Performance**
Theoretically, accessing mesh elements with the RNA API may become
slower, since the layer needs to be found on every random access.
However, overhead is already high enough that this doesn't make a
noticible differenc, and performance is actually improved in some
cases. Random access can be up to 10% faster, but other situations
might be a bit slower. Generally using `foreach_get/set` are the best
way to improve performance. See the differential revision for more
discussion about Python performance.
Cycles has been updated to use raw pointers and the internal Blender
mesh types, mostly because there is no sense in having this overhead
when it's already compiled with Blender. In my tests this roughly
halves the Cycles mesh creation time (0.19s to 0.10s for a 1 million
face grid).
Differential Revision: https://developer.blender.org/D15488
|
|
|
|
This patch moves material indices from the mesh `MPoly` struct to a
generic integer attribute. The builtin material index was already
exposed in geometry nodes, but this makes it a "proper" attribute
accessible with Python and visible in the "Attributes" panel.
The goals of the refactor are code simplification and memory and
performance improvements, mainly because the attribute doesn't have
to be stored and processed if there are no materials. However, until
4.0, material indices will still be read and written in the old
format, meaning there may be a temporary increase in memory usage.
Further notes:
* Completely removing the `MPoly.mat_nr` after 4.0 may require
changes to DNA or introducing a new `MPoly` type.
* Geometry nodes regression tests didn't look at material indices,
so the change reveals a bug in the realize instances node that I fixed.
* Access to material indices from the RNA `MeshPolygon` type is slower
with this patch. The `material_index` attribute can be used instead.
* Cycles is changed to read from the attribute instead.
* BMesh isn't changed in this patch. Theoretically it could be though,
to save 2 bytes per face when less than two materials are used.
* Eventually we could use a 16 bit integer attribute type instead.
Ref T95967
Differential Revision: https://developer.blender.org/D15675
|
|
|
|
Line art now uses global index for vertices but needs to have
local index in order to do correct weight transfer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Materials can be changed by other evaluations like geometry nodes,
now handles that kind of situation.
|
|
|
|
In this case the array allocation would allocate an array of size zero.
This would then later lead to out of bounds memory reads.
Now the code will skip zero length allocations.
|
|
Conflicts:
source/blender/blenkernel/BKE_lib_override.h
|
|
The use of `float` for intermediate intersection record led to some
inaccuracy which caused flickering in intersection lines. Now fixed.
|
|
|
|
This patch removes the [rather confusing] separate checkbox for enclosed
shapes in favour of integrating that option into illumination filtering,
with the benefit of not limiting the selection to cached result.
Reviewed By: Sebastian Parborg (zeddb)
Differential Revision: https://developer.blender.org/D15327
|
|
Two main fixes:
- Split tiles only when we are more sure that it will improve distribution.
- Discard edges and chains that are not gonna be used afterwards before chaining.
This speeds up the whole process and also eliminates unnecessary tile splitting.
Reviewed By: Sebastian Parborg (zeddb)
Differential Revision: https://developer.blender.org/D15335
|
|
|
|
This patch includes the full shadow functionality for LineArt:
- Light contour and cast shadow lines.
- Lit/shaded region selection.
- Enclosed light/shadow shape calculation.
- Silhouette/anti-silhouette selection.
- Intersection priority based on shadow edge identifier.
Reviewed By: Sebastian Parborg (zeddb)
Differential Revision: https://developer.blender.org/D15109
|
|
|
|
|
|
Use more descriptive names for some of the two character variables.
Reviewed By: Sebastian Parborg (zeddb)
Differential Revision: https://developer.blender.org/D15192
|
|
- Use uintxx_t for all 8/16/64 bit integer types.
- Removed prepend_edge_direct thingy which is no longer needed in current edge iterator model.
- Minor code path adjustments like only copies view vector when necessary etc.
- Correctly handle ies==NULL in edge cutting function.
- White spaces and comments etc.
Reviewed By: Sebastian Parborg (zeddb)
Differential Revision: https://developer.blender.org/D15181
|
|
This patch does code clean ups in `LineartRenderBuffer` because it's
grown kinda big and we need better way to organize those variables inside.
Reviewed By: Sebastian Parborg (zeddb)
Differential Revision: https://developer.blender.org/D15172
|
|
|
|
|
|
Using multithread for `add_triangles` to speed up quad tree building.
Each thread would lock its respective tile to work on triangle insertion,
intersection calculation, tile splitting and triangle array extension.
Reviewed By: Sebastian Parborg (zeddb), Sergey Sharybin (sergey)
Ref D14953
|
|
This is for conveinence of perfomance comparison.
|
|
Use `DEG_OBJECT_ITER_BEGIN`for loading objects, this iterator is
technially unsafe to use *during* depsgraph evaluation,
see https://developer.blender.org/D14997 for detailed explainations.
|
|
This fix will ensure not to load any meshes that's being edited, thus
avoiding crashes.
Ref D15022
|
|
In case of line art "occlusion only" or contour not enabled, it's possible for an object
to not produce any feature lines.
This patch checks that to prevent freeing a NULL pointer.
|
|
This reverts commit 14a5a91e0e033d712134c112a4778b495bd73ba1.
This caused build errors on x64+arm mac builds and some versions
of MSVC, reverting for now till a better solution is found.
|
|
Using the atomic "compare and swap" method in add_triangles stage
dramatically speeds up the add_triangles call and significantly reduced
the overall calculation time. This is currently the fastest method we
have experimented with so far.
Reviewed By: Sebastian Parborg (zeddb)
Differential Revision: https://developer.blender.org/D14953
|
|
It turns out there's no practical use for separating different edge types
before final occlusion stage, also using an array should be faster overall.
So changed those lists into one pending array, it also made the
iteration and occlusion task scheduling simpler.
Reviewed By: Sebastian Parborg (zeddb)
Differential Revision: https://developer.blender.org/D14951
|
|
After changing the duplicated edge removal method in D14903,
these two obindex variables are no longer needed.
Reviewed By: Sebastian Parborg (zeddb)
Differential Revision: https://developer.blender.org/D14949
|