Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-09-07Cleanup: Tweak naming for recently added mesh accessorsHans Goudey
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.
2022-09-06Merge branch 'blender-v3.3-release'Brecht Van Lommel
2022-09-06Fix T100842: Display Texture Paint UVs option in UV editor not workingBrecht Van Lommel
In 8cf52e8226cb we assumed that the UV IBO's are only needed in edit mode, however the UV lines also need to work in texture paint mode. So prefer to use bmesh when available to fix the original bug, but don't assume the face is hidden when there is no bmesh. Differential Revision: https://developer.blender.org/D15895
2022-09-05Mesh: Remove redundant custom data pointersHans Goudey
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
2022-09-01Metal: Minimum per-vertex stride, 3D texture size + Transform feedback ↵Jason Fielder
GPUCapabilities expansion. - Adding in compatibility paths to support minimum per-vertex strides for vertex formats. OpenGL supports a minimum stride of 1 byte, in Metal, this minimum stride is 4 bytes. Meaing a vertex format must be atleast 4-bytes in size. - Replacing transform feedback compile-time check to conditional look-up, given TF is supported on macOS with Metal. - 3D texture size safety check added as a general capability, rather than being in the gl backend only. Also required for Metal. Authored by Apple: Michael Parkin-White Ref T96261 Reviewed By: fclem Maniphest Tasks: T96261 Differential Revision: https://developer.blender.org/D14510
2022-08-31Mesh: Move material indices to a generic attributeHans Goudey
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
2022-08-30Merge branch 'blender-v3.3-release'Philipp Oeser
2022-08-30Fix T93084: Area stretch overlay full red on large scale meshPhilipp Oeser
Issue arises when face areas are really large combined with small UV areas (report has a mesh ~1.5 km), then precission of shorts is insufficient. Now use floats instead. This also removes this negative signed version of the total area ratio (since with floats it is no longer used). Thx @brecht for a lot of hand-holding! NOTE: this is an alternative to D15805 (and quick tests show this does not introduce the tiny performance hit as D15805 did). Maniphest Tasks: T93084 Differential Revision: https://developer.blender.org/D15810
2022-08-16Cleanup: some refactoring in mapped mesh extractionBrecht Van Lommel
* Flip the logic to first detect if we are dealing with an unmodified mesh in editmode. And then if not, detect if we need a mapping or not. * runtime.is_original is only valid for the bmesh wrapper. Rename it to clarify that and only check it when the mesh is a bmesh wrapper. * Remove MR_EXTRACT_MAPPED and instead check only for the existence of the origindex arrays. Previously it would sometimes access those arrays without MR_EXTRACT_MAPPED set, which according to a comment means they are invalid. Differential Revision: https://developer.blender.org/D15676
2022-08-16Fix error/crash in hidden edge drawing after recent changesBrecht Van Lommel
Mistake in 2480b55 using the wrong array.
2022-08-16Merge branch 'blender-v3.3-release'Brecht Van Lommel
2022-08-16Fix T98773: GPU subdivision issues with UV editor displayBrecht Van Lommel
This fixes missing selection updates in UV editor, both with GPU subdivision and with the Modified Edges display option for modifiers in general. It also fixes the UV editor incorrectly showing the cage mesh with deformed coordinates. These are not yet supported by the UV selection system. Changes: * Always read selection state from the editmesh when building batches. The flags in the evaluated mesh can be outdated as selection bypasses depsgraph evaluation for performance, and instead may just clear the batches. * runtime.is_original is only valid for the bmesh wrapper. The check for building the UV cage should only use that if the mesh is a bmesh wrapper. * Don't create cage batches for objects whose mesh is in edit mode, but that are not themselves in edit mode, there is no need. Differential Revision: https://developer.blender.org/D15658
2022-08-12Cleanup: replace term face with polyCampbell Barton
Be consistent with naming to avoid mixing MPoly/MFace.
2022-08-11Mesh: Move hide flags to generic attributesHans Goudey
This commit moves the hide status of mesh vertices, edges, and faces from the `ME_FLAG` to optional generic boolean attributes. Storing this data as generic attributes can significantly simplify and improve code, as described in T95965. The attributes are called `.hide_vert`, `.hide_edge`, and `.hide_poly`, using the attribute name semantics discussed in T97452. The `.` prefix means they are "UI attributes", so they still contain original data edited by users, but they aren't meant to be accessed procedurally by the user in arbitrary situations. They are also be hidden in the spreadsheet and the attribute list by default, Until 4.0, the attributes are still written to and read from the mesh in the old way, so neither forward nor backward compatibility are affected. This means memory requirements will be increased by one byte per element when the hide status is used. When the flags are removed completely, requirements will decrease when hiding is unused. Further notes: * Some code can be further simplified to skip some processing when the hide attributes don't exist. * The data is still stored in flags for `BMesh`, necessitating some complexity in the conversion to and from `Mesh`. * Access to the "hide" property of mesh elements in RNA is slower. The separate boolean arrays should be used where possible. Ref T95965 Differential Revision: https://developer.blender.org/D14685
2022-08-05Cleanup: Remove outdated commentHans Goudey
2022-07-26Refactor: Extract color attributes as generic attributesHans Goudey
Previously there was a special extraction process for "vertex colors" that copied the color data to the GPU with a special format. Instead, this patch replaces this with use of the generic attribute extraction. This reduces the number of code paths, allowing easier optimization in the future. To make it possible to use the generic extraction system for attributes but also assign aliases for use by shaders, some changes are necessary. First, the GPU material attribute can now store whether it actually refers to the default color attribute, rather than a specific name. This replaces the hack to use `CD_MCOL` in the color attribute shader node. Second, the extraction code checks the names against the default and active names and assigns aliases if the request corresponds to a special active attribute. Finally, support for byte color attributes was added to the generic attribute extraction. Differential Revision: https://developer.blender.org/D15205
2022-07-04Fix T98884: Fix edge case crashes in gpu subdiv cache codeJoseph Eagar
2022-06-27Fix color attribute interpolation with GPU subdivisionKévin Dietrich
Handling of 16-bits compression was missing, which gave values that were way off.
2022-06-20Fix T98913: GPU Subdivision: "Show Wire" overlay glitchKévin Dietrich
Issue is caused by an off by one error which would map some edge loops to the loops of some the next polygon in the list of polygon, which may not be a topological neighbor.
2022-06-18Cleanup: Remove unused argument, unnecessary struct keywordHans Goudey
2022-06-18Cleanup: Always store attribute name in attribute requestHans Goudey
Previously the attribute name was only stored in the request for curves. Instead, pass it as part of the "add request" function, so that it is always used. Since the whole attribute pipeline is name-based, this can simplify code in a few places.
2022-06-15Cleanup: Miscellaneous improvements to draw attribute extractionHans Goudey
- Remove unnecessary braces in switch statements - Move `default` to the end of other switch items - Use camel case for type names - Use `BLI_assert_unreachable()`
2022-06-14Fix T98866: GPU subdiv crash in edit mode with loose geometryKévin Dietrich
The BMesh case was missing when extracting the loose edges flags used for display, so the code was crashing on unitialized `MEdge` pointer.
2022-06-10Cleanup: Clang tidyHans Goudey
2022-06-08Cleanup: Remove unnecessary namespace specificationHans Goudey
2022-06-07Cleanup: Use const pointers in attribute APIHans Goudey
2022-06-05Cleanup: Comments and formatting in mesh extract headersHans Goudey
Also remove accidentally committed WIP commented code.
2022-06-05Cleanup: Move remaining mesh draw code to C++Hans Goudey
After this commit, all mesh data extraction and drawing code is in C++, including headers, making it possible to use improved types for future performance improvements and simplifications. The only non-trivial changes are in `draw_cache_impl_mesh.cc`, where use of certain features and macros in C necessitated larger changes. Differential Revision: https://developer.blender.org/D15088
2022-06-04Cleanup: Use const for retrieved custom data layersHans Goudey
2022-06-01Cleanup: use 'e' prefix for enum typesCampbell Barton
- CustomDataType -> eCustomDataType - CustomDataMask -> eCustomDataMask - AttributeDomain -> eAttrDomain - NamedAttributeUsage -> eNamedAttrUsage
2022-06-01Merge branch 'blender-v3.2-release'Joseph Eagar
2022-06-01GPU subdiv: Fix edit mode vertex color not being uploaded properlyJoseph Eagar
Also cleaned up the code a tad bit. Note that I found two more bugs: * GPU subdivision attribute interpolation is producing visual artifacts. * "Show on cage" mode for subdivision surface just shows black colors.
2022-05-27Merge remote-tracking branch 'origin/blender-v3.2-release'Kévin Dietrich
2022-05-26Fix T98385: Color attributes not working with GPU subdivisionKévin Dietrich
Contrary to coarse extraction, GPU extraction uses the same buffer for the coarse data, only the final GPU buffer needs to be offset.
2022-05-26Fix T98392: GPU subdivision crash with knife toolsKévin Dietrich
The face dots normals may not be always requested, thus leading to a crash by null pointer dereference.
2022-05-25Merge branch 'blender-v3.2-release'Bastien Montagne
2022-05-25Fix vertex format for mesh attributes with GPU subdivisionKévin Dietrich
A global variable was mistakenly used here which would accumulate the vertex attributes (leading to an assertion failure after a while), use the wrong number of components depending on the attribute data type, among other issues.
2022-05-25Fix T96080: hiding elements does not work with GPU subdivKévin Dietrich
Faces, edges, and vertices are still shown when GPU subdivision is actived. This is because the related edit mode flags were ignored by the subdivision code. The flags are now passed to the various compute shaders mostly as part of the extra coarse data, also used for e.g. selection. For loose edges, a temporary buffer is created when extracting them. Loose vertices are already taken into account as it reuses the routines for coarse mesh extraction, although `MeshRenderData.use_hide` was not initialized, which is fixed now.
2022-05-24EEVEE: support Curves attributes renderingKévin Dietrich
This adds support to render Curves attributes in EEVEE. Each attribute is stored in a texture derived from a VBO. As the shading group needs the textures to be valid upon creation, the attributes are created and setup during its very creation, instead of doing it lazily via create_requested which we cannot rely on anyway as contrary to the mesh batch, we do cannot really tell if attributes need to be updated or else via some `DRW_batch_requested`. Since point attributes need refinement, and since attributes are all cast to vec4/float4 to account for differences in type conversions between Blender and OpenGL, the refinement shader for points is used as is. The point attributes are stored for each subdivision level in CurvesEvalFinalCache. Each subdivision level also keeps track of the attributes already in use so they are properly updated when needed. Some basic garbage collection was added similar to what is done for meshes: if the attributes used over time have been different from the currently used attributes for too long, then the buffers are freed, ensuring that stale attributesare removed. This adds `CurvesInfos` to the shader creation info, which stores the scope in which the attributes are defined. Scopes are stored as booleans, in an array indexed by attribute loading order which is also the order in which the attributes were added to the material. A mapping is necessary between the indices used for the scoping, and the ones used in the Curves cache, as this may contain stale attributes which have not been garbage collected yet. Common utilities with the mesh code for handling requested attributes were moved to a separate file. Differential Revision: https://developer.blender.org/D14916
2022-05-22GPU subdiv: smoothly interpolate orco layerKévin Dietrich
This uses the recently introduced evaluator's vertex data to smoothly interpolate original coordinates instead of using linear interpolation. The orcos are interpolated at the same time as positions and as such, the specific subdivision routine for the orco extractor has been removed. The patch evaluation shader uses a definition to enable code specific to orco evaluation. Since the orco layer may not have been requested on first render, and since orco data is now stored in the OpenSubDiv evaluator, the evaluator needs to be recreated if an orco layer is suddenly available. For this, a callback to check if the evaluator has the data was added. This is added to the evaluator as the `Subdiv` cache stored in the modifier is invalidated less often than the Mesh batch cache and so leads to fewer evaluator recreations. Differential Revision: https://developer.blender.org/D14999
2022-05-14Cleanup: Further use of const for retrieved custom data layersHans Goudey
Similar to cf69652618fefcd22b2cde9a2.
2022-05-13Cleanup: Use const when retrieving custom data layersHans Goudey
Knowing when layers are retrieved for write access will be essential when adding proper copy-on-write support. This commit makes that clearer by adding `const` where the retrieved data is not modified. Ref T95842
2022-05-13Merge branch 'blender-v3.2-release'Sergey Sharybin
2022-05-13Fix T97330: UV points missing with some modifiersKévin Dietrich
When extracting UV point indices, only the vertex points coming from the original geometry should be drawn. For this, the routines (for subdivision and coarse meshes) would only consider a vertex to be real if the extraction type is `MAPPED`, and that an origin index layer on the vertices exist with a valid origin index for the current vertex. However, if the extraction type is `MESH`, which can happen with for example an empty Geometry Node modifier, or with deferred subdivision, this would consider every vertex to not be "real" and therefore hidden from the UV editor. This reworks the condition for "realness" to also consider a vertex to be real if there is no origin layer on the vertices. The check on the extraction type is removed as it becomes redundant. This only modifies the check in the UV data extraction for point indices, however similar checks exist throughout the extraction code, these will be dealt with separately in master. Differential Revision: https://developer.blender.org/D14773
2022-05-05Cleanup: spelling in commentsCampbell Barton
2022-05-03Fix T93179: geonodes UVs and Vertex colors do not work in EEVEEKévin Dietrich
Overwriting UV map or vertex color data in Geometry nodes will move the layers to another CustomData channel, and as such, will make attribute lookup fail from the UVMap and Vertex Color nodes in EEVEE as the CustomDataType will also be modified (i.e. no longer `CD_MTFACE` or `CD_MCOL`). As discussed in T93179, the solution is to use `CD_PROP_AUTO_FROM_NAME` so that the render engine is able to find the attributes. This also makes EEVEE emulate Cycles behaviour in this regard. `attr_load_uv` and `attr_load_color` are also removed in favor of the generic attribute API in the various GLSL shaders. Although `CD_PROP_AUTO_FROM_NAME` is now used even for UV maps, the active UV map is still used in case the attribute name is empty, to preserve the old behavior. Differential Revision: https://developer.blender.org/D13730
2022-05-03Fix T96338: GPU subdiv crash switching to UV editingKévin Dietrich
The crash is caused as the data for the UV editor is requested before the data for the mesh as a separate draw update. Since building the UV stretch angle buffer requires the position buffer, the latter is not created yet in this case. To fix this, create a local position buffer from the subdivision data. An alternate fix was considered to remove the dependency on the position buffer by interpolating on the GPU the coarse stretch angle buffer but this did work. Maybe this will be revisited.
2022-04-29Fix wrong cast from uint to int (2)Germano Cavalcante
Error in rB3d877c8a0d06
2022-04-29Fix wrong cast from uint to intGermano Cavalcante
Error in rB3d877c8a0d06
2022-04-29Select Engine: port shader to use 'GPUShaderCreateInfo'Germano Cavalcante
Simple port with a few cosmetic changes: - Attribute named "color" for indices VBO is now called "index" - The indices VBO is now composed of `int`s instead of `uint`s (this simplifies the source) Differential Revision: https://developer.blender.org/D14800