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-08-02Fix T96810: Invalid sculpt normals after some operationsHans Goudey
Mask and color brushes were using the existing PBVH vertex "update tag" to mark their modifications. This was mostly unnecessary, and causes unnecessary calculation of normals. It also caused errors though, because they didn't tag the corresponding PBVH node for normal recalculation, causing problems on the borders of nodes, since one node might accumulate into another's vertex normals, but the other node wouldn't also accumulate and normalize the normals. The solution is to only use the update tag for tagging deformed vertices that need recalculated normals. Everything else is handled at the PBVH node level (which was already the case, but it wasn't clear). The update tag was also used for undo to tag the nodes corresponding to changed vertices. This was wrong though, because normals and visibility would also be recalculated for just color or mask undo steps. Instead, just use local arrays to map from vertices to nodes. Differential Revision: https://developer.blender.org/D15581
2022-06-27Fix T99100: Undo/redo bugs with paint and gravityJoseph Eagar
You can now push multiple sculpt undo nodes of different types. This is necassary to handle paint tools that have gravity enabled.
2022-06-16Cleanup: differentiate region/screen relative coordinatesCampbell Barton
- Avoid ambiguity which caused these values to be confused, use `mval` for region relative mouse coordinates, otherwise `event_xy`. - Pass region relative coordinates to sample_detail_dyntopo & sample_detail_voxel as there is no reason to use screen-space values. - Rename invalid use of mval for screen-space coordinates.
2022-04-12Fix T97098: Color filter sharpening artifacts.Joseph Eagar
Color filter sharpening now clamps the output. The sharpening delta is now calculated from the difference of two levels of vertex averaging instead of one smooth iteration and the base color. TODO: Sharpen in a different color space; SRGB-linear has saturation artifacts. I tried HSL but it had value artifacts. I'd like to try LAB but we don't seem to have conversion functions for it (at least as far as I could see).
2022-04-05Refactor: Unify vertex and sculpt colors into newJoseph Eagar
color attribute system. This commit removes sculpt colors from experimental status and unifies it with vertex colors. It introduces the concept of "color attributes", which are any attributes that represents colors. Color attributes can be represented with byte or floating-point numbers and can be stored in either vertices or face corners. Color attributes share a common namespace (so you can no longer have a floating-point sculpt color attribute and a byte vertex color attribute with the same name). Note: this commit does not include vertex paint mode, which is a separate patch, see: https://developer.blender.org/D14179 Differential Revision: https://developer.blender.org/D12587 Ref D12587
2022-03-09Cleanup: rename wmEvent.prev_click_* to prev_press_*Campbell Barton
At the time of naming these members only some event types generated click events so it made some sense to differentiate a click. Now all buttons support click & drag it's more logical to use the prefix "prev_press_" as any press event will set these values. Also update doc-strings.
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-02-10Refactor: Move PBVH update tag out of MVertHans Goudey
This is part of the project of converting `MVert` into `float3`. (more details in T93602), The pbvh update flag is removed and replaced with a bitmap stored in the PBVH structure. This patch is similar to D13878. This is mainly setup for an eventual performance improvement by removing the extra data from mesh vertices, but if it's consistent with testing in the other patch doing the same thing for another "temp tag", then it may actually increase the speed of sculpt code slightly, since less memory needs to be loaded when checking/changing the flags. Differential Revision: https://developer.blender.org/D14000
2022-01-13Refactor: Move normals out of MVert, lazy calculationHans Goudey
As described in T91186, this commit moves mesh vertex normals into a contiguous array of float vectors in a custom data layer, how face normals are currently stored. The main interface is documented in `BKE_mesh.h`. Vertex and face normals are now calculated on-demand and cached, retrieved with an "ensure" function. Since the logical state of a mesh is now "has normals when necessary", they can be retrieved from a `const` mesh. The goal is to use on-demand calculation for all derived data, but leave room for eager calculation for performance purposes (modifier evaluation is threaded, but viewport data generation is not). **Benefits** This moves us closer to a SoA approach rather than the current AoS paradigm. Accessing a contiguous `float3` is much more efficient than retrieving data from a larger struct. The memory requirements for accessing only normals or vertex locations are smaller, and at the cost of more memory usage for just normals, they now don't have to be converted between float and short, which also simplifies code In the future, the remaining items can be removed from `MVert`, leaving only `float3`, which has similar benefits (see T93602). Removing the combination of derived and original data makes it conceptually simpler to only calculate normals when necessary. This is especially important now that we have more opportunities for temporary meshes in geometry nodes. **Performance** In addition to the theoretical future performance improvements by making `MVert == float3`, I've done some basic performance testing on this patch directly. The data is fairly rough, but it gives an idea about where things stand generally. - Mesh line primitive 4m Verts: 1.16x faster (36 -> 31 ms), showing that accessing just `MVert` is now more efficient. - Spring Splash Screen: 1.03-1.06 -> 1.06-1.11 FPS, a very slight change that at least shows there is no regression. - Sprite Fright Snail Smoosh: 3.30-3.40 -> 3.42-3.50 FPS, a small but observable speedup. - Set Position Node with Scaled Normal: 1.36x faster (53 -> 39 ms), shows that using normals in geometry nodes is faster. - Normal Calculation 1.6m Vert Cube: 1.19x faster (25 -> 21 ms), shows that calculating normals is slightly faster now. - File Size of 1.6m Vert Cube: 1.03x smaller (214.7 -> 208.4 MB), Normals are not saved in files, which can help with large meshes. As for memory usage, it may be slightly more in some cases, but I didn't observe any difference in the production files I tested. **Tests** Some modifiers and cycles test results need to be updated with this commit, for two reasons: - The subdivision surface modifier is not responsible for calculating normals anymore. In master, the modifier creates different normals than the result of the `Mesh` normal calculation, so this is a bug fix. - There are small differences in the results of some modifiers that use normals because they are not converted to and from `short` anymore. **Future improvements** - Remove `ModifierTypeInfo::dependsOnNormals`. Code in each modifier already retrieves normals if they are needed anyway. - Copy normals as part of a better CoW system for attributes. - Make more areas use lazy instead of eager normal calculation. - Remove `BKE_mesh_normals_tag_dirty` in more places since that is now the default state of a new mesh. - Possibly apply a similar change to derived face corner normals. Differential Revision: https://developer.blender.org/D12770
2021-12-08Cleanup: move public doc-strings into headers for 'editors'Campbell Barton
Ref T92709
2021-10-20Cleanup: use an array for wmEvent cursor position variablesAaron Carlisle
Use arrays for wmEvent coordinates, this quiets warnings with GCC11. - `x, y` -> `xy`. - `prevx, prevy` -> `prev_xy`. - `prevclickx, prevclicky` -> `prev_click_xy`. There is still some cleanup such as using `copy_v2_v2_int()`, this can be done separately. Reviewed By: campbellbarton, Severin Ref D12901
2021-10-14Cleanup: pass the sizeof(..) as the second arg for array allocationCampbell Barton
By argument naming and convention this is the intended argument order.
2021-03-13Cleanup: add BKE_pbvh_vertex_iter_begin to clang-formatPablo Dobarro
Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D10707
2021-02-05Cleanup: correct spelling in commentsCampbell Barton
2020-12-14Cleanup: Fix capitalization in various placesYevgeny Makarov
Approximately 33 changes of capitalization to conform to MLA title style. Differential Revision: https://developer.blender.org/D9796 Reviewed by Julian Eisel
2020-12-04Sculpt: Allow inverting the Erase Displacement mesh filterPablo Dobarro
When inverting erase displacement the filter can increase the displacement over the limit surface. After using apply base, this can be used as an alternative intensify details as it usually gives better results. This is the same concept as smoothing inverting to intensify details. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9679
2020-11-12Fix T82388: Sculpt mode: Unexpected undo behavior.Bastien Montagne
Issue exposed by rB4c7b1766a7f1. Main idea is that non-memfile first undo step should check into previous memfile and tag the ID it is editing as `future_changed`. That way, when we go back and undo to the memfile, said IDs are properly detected as changed and re-read from the memfile. Otherwise, undo system sees them as unchanged, and just re-use the current data instead. Note that currently only Sculpt mode seems affected (probably because it is storing the mode switch itself as a Sculpt undo step instead of a memfile one), but similar action might be needed in some other cases too. Maniphest Tasks: T82388 Differential Revision: https://developer.blender.org/D9510
2020-10-15Sculpt: Add global automasking settings support in filtersPablo Dobarro
When using the sculpt filters, global automasking settings that affect all brushes were ignored because the automasking system was not implemented for filters, making filters and brushes react differently to the global sculpt settings which creates confusion. This makes all filter tools (mesh, cloth, color) use the same general automasking settings and features as the brush tools. Filters will now use the settings in the options panel to limit their effect. This also removes the "use Face Sets" option from the Mesh filter code, as it was duplicated from the automasking code just to have that funcitonality. This is now handled by the regular automasking system. The "Use Face Sets" option is still available in the cloth filter as that option limits the action of the forces, not the displacement. After this, it is possible to initialize the automasking system independently from the StrokeCache and Brush settings, so it can also be added to more tools and features in the future. Fixes T81619 Reviewed By: dbystedt, sergey Maniphest Tasks: T81619 Differential Revision: https://developer.blender.org/D9171
2020-09-18Sculpt: Scale Cloth FilterPablo Dobarro
This filter scales the mesh as it was a softbody, producing folds in the surface. The orientation of the folds can be controlled using the filter axis and orientation. This is an example of a cloth filter that uses deform coordinates instead of forces, but probably it does not make much sense to expose it to the user in a different way and with different parameters. I'll remove FilterCache->enabled_force_axis in a later commit and use always enabled_axis in SCULPT_filter_zero_disabled_axis_components for both forces and deformation filters, so this function can also be used in the mesh filter. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8661
2020-09-02Fix T80311: Sculpt Filters not working when using vertical splitPablo Dobarro
All filters were using prevclicx, which is in screen coordinates and mval[0], which is in region coordinates to get the filter strength. This fixes the issue in all filters. Reviewed By: Severin Maniphest Tasks: T80311 Differential Revision: https://developer.blender.org/D8776
2020-08-20Cleanup: Mesh Filter invoke refactorPablo Dobarro
This moves the allocation for filter to separate functions, removes all repeated calls to RNA_enum_get an fixes some other code quality issues. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8639
2020-08-19Cleanup: compiler warningsBrecht Van Lommel
2020-08-18Sculpt: Erase Displacement Mesh FilterPablo Dobarro
Same concept as the Multires Displacement Eraser Brush but implemented as a mesh Filter. This allows to delete the displacement of an entire area uniformly. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8608
2020-08-18Sculpt: Enhance Details Mesh FilterPablo Dobarro
Exact same operation as D8509, implemented as a Mesh Filter. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8510
2020-08-18Sculpt: Sculpt Filter Orientation OptionsPablo Dobarro
Previously, the XYZ deform axis of the Mesh Filter were limited to object space (which is the default for sculpt mode). Now it is possible to limit the XYZ displacement in Local, Global or View space. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8582
2020-08-12Cleanup: Remove explicit float casts in sculpt codePablo Dobarro
Differential Revision: https://developer.blender.org/D8553
2020-08-12Clenaup: Rename random_access_init to random_access_ensurePablo Dobarro
Reviewed By: sergey Differential Revision: https://developer.blender.org/D8529
2020-08-12Cleanup: Use clamp_f instead of CLAMP in sculpt codePablo Dobarro
Reviewed By: sergey Differential Revision: https://developer.blender.org/D8528
2020-08-12Fix Sculpt Filters operator namingPablo Dobarro
Reviewed By: sergey Differential Revision: https://developer.blender.org/D8523
2020-08-08Cleanup: use array syntax for sizeof with fixed valuesCampbell Barton
Also order sizeof(..) first to promote other values to size_t.
2020-08-07Cleanup: declare arrays arrays where possibleCampbell Barton
2020-08-06Sculpt: Sharpen Mesh Filter curvature smoothing and intensify detailsPablo Dobarro
This adds a curvature smoothing and intensify details properties to control the result of the Sharpen Mesh Filter. Curvature smoothing removes high frequency details from the precalculated sharpen data, so the filter result has much smoother surfaces and cleaner sharpen lines; Intensify details displaces the vertices of creases and valleys in the direction opposite to its neighbors average, so it intensifies high frequency details in those areas, producing more noisy and sharp shapes: Both this properties can be used in combination to achieve a good balance of high and low frequency details depending on the shape and the desired result. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8447
2020-07-27Fix Sculpt Relax operation when deforming mesh boundariesPablo Dobarro
Previously, mesh boundaries were relaxed as any other vertex, which was causing artifacts and unwanted deformation. In order to prevent this, the mesh filter was using the automasking system to lock the boundary vertices, which was hacked into the tool. For the brush, the only solution was to enable boundary automasking to lock those vertices in plance. Now the relax vertex function slides the boundary vertices along the mesh boundary edges, relaxing all the topology correctly while preserving the shape of the mesh. The automasking hack in the relax mesh filter was also removed as now vertices slide correctly along the boundary. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8350
2020-07-15Fix T78747: Fix mesh boundary detection and automaskingPablo Dobarro
This issue was produced by a hack in the sculpt mode code from 2.80 when the sculpt API for connectivity info was not available. The smooth brush was the only brush that needed connectivity info, so there were 3 different smooth functions with the connectivity queries implemented for dyntopo, meshes and grids. The mesh version of smoothing was checking the number of connected faces to a vertex to mask the mesh boundaries, which was not covering all cases and was hardcoded in the smooth function itself. This patch removes all those legacy functions and unifies all smooth functions into a single one using the new API and the automasking system. In order to achieve this, there were needed some extra changes: - The smooth brush now does not automasks the boundaries by default, so its default preset needs to be updated to enable automasking - The mesh boundary info is extracted once and cached in a bitmap, similar to the disconnected elements IDs. This makes boundary detection work as expected in all cases, solving a lot of known issues with the smooth brush. In multires, this info is extracted and cached only at the base mesh level, so it is much more memory efficient than the previous automasking system. - In order to keep the brushes responsive as they were before, the automasking system can now skip creating the cache when it is not needed for the requested options. This means that for high poly meshes and simple automasking options the brushes won't lag on start. Reviewed By: sergey Maniphest Tasks: T78747 Differential Revision: https://developer.blender.org/D8260
2020-07-09Sculpt: Skip fully hidden nodes in sculpt toolsPablo Dobarro
As tools iterators skip not visible vertices, fully hidden nodes can also be skipped and considered as masked. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8244
2020-06-29Remove Threaded Sculpt optionPablo Dobarro
Threaded Sculpt is now always enabled by default. If it causes performance problems compared single threaded sculpt it should be considered a bug. Reviewed By: sergey Maniphest Tasks: T77638 Differential Revision: https://developer.blender.org/D7960
2020-06-23Sculpt Vertex Colors: Initial implementationPablo Dobarro
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time. This commit includes: - SCULPT_UNDO_COLOR for undo support in sculpt mode - SCULPT_UPDATE_COLOR and PBVH flags and rendering - Sculpt Color API functions - Sculpt capability for sculpt tools (only enabled in the Paint Brush for now) - Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint) - Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint) - Remesher reprojection in the Voxel Remehser - Paint Brush and Smear Brush with color smoothing in alt-smooth mode - Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors - Color Filter - Color picker (uses S shortcut, replaces smooth) - Color selector in the top bar Reviewed By: brecht Maniphest Tasks: T72866 Differential Revision: https://developer.blender.org/D5975
2020-06-04Fix Sharpen mesh filter in MultiresPablo Dobarro
Instead of accumulating displacement for each vertex into the neighbors, accumulate the opposite displacement from each neighbor into the vertex. I think this is the same and it does not produce artifacts in Multires. Reviewed By: sergey, brecht Differential Revision: https://developer.blender.org/D7508
2020-06-01Sculpt: Cloth FilterPablo Dobarro
This tool is similar to the cloth brush, but it applies the cloth simulation deformation to the whole mesh in an uniform way. The simulation can be controlled using the mask to pin vertices and the face sets to define force action areas. It uses the same solver as the cloth brush which now no longer depends on StrokeCache. Reviewed By: sergey Differential Revision: https://developer.blender.org/D7857
2020-06-01Fix mesh filter using the wrong face set as activePablo Dobarro
This was returning the wrong face set in cases where the active vertex has more than one available face set. Reviewed By: sergey Differential Revision: https://developer.blender.org/D7858
2020-05-09Cleanup: double-spaces in commentsCampbell Barton
2020-04-30Task: Use TBB as Task SchedulerBrecht Van Lommel
This patch enables TBB as the default task scheduler. TBB stands for Threading Building Blocks and is developed by Intel. The library contains several threading patters. This patch maps blenders BLI_task_* function to their counterpart. After this patch we can add more patterns. A promising one is TBB:graph that can be used for depsgraph, draw manager and compositor. Performance changes depends on the actual hardware. It was tested on different hardwares from laptops to workstations and we didn't detected any downgrade of the performance. * Linux Xeon E5-2699 v4 got FPS boost from 12 to 17 using Spring's 04_010_A.anim.blend. * AMD Ryzen Threadripper 2990WX 32-Core Animation playback goes from 9.5-10.5 FPS to 13.0-14.0 FPS on Agent 327 , 10_03_B.anim.blend. Reviewed By: brecht, sergey Differential Revision: https://developer.blender.org/D7475
2020-04-20Fix T75662: Surface Smooth filter not checking face setsPablo Dobarro
In the main mesh filter loop vertex that do not have the active face set are skipped, so in the following surface smooth displacement loop these vertices were deformed using an uninitialized laplacian_disp value. Now the main loop initializes the laplacian_disp for all vertices and the deformation based on face sets is skipped in the second loop. Reviewed By: jbakker Maniphest Tasks: T75662 Differential Revision: https://developer.blender.org/D7443
2020-04-15Cleanup: shadow warningCampbell Barton
2020-04-14Sculpt: Sharpen Mesh FilterPablo Dobarro
This mesh filter sharpens and smooths the mesh based on its curvature, resulting in pinching hard edges and polishing flat surfaces. It fixes most of the artifacts of the voxel remesher and those produced when sculpting hard surfaces and stylized models with creasing and flattening brushes. It needs and accumulate_displacement step before each filter iteration which can't be multithreaded in an easy way (it would need something to sync the threads when modifying the data of neighbors in a different node), but this does not affect performance in a significant way. Reviewed By: brecht Differential Revision: https://developer.blender.org/D7335
2020-04-06Cleanup: spellingCampbell Barton
2020-04-03Cleanup: Move Mask Filter and Mask Expand to their own filesPablo Dobarro
2020-04-03Cleanup: Move Mesh Filter, Smooth and Automasking to their own filesPablo Dobarro