Age | Commit message (Collapse) | Author |
|
|
|
This seems to be giving speedup up to 10% in own tests.
--
svn merge -r60104:60105 ^/branches/soc-2013-depsgraph_mt
|
|
|
|
|
|
|
|
Adds new subsurf_copy_grid_paint_mask() function similar to
subsurf_copy_grid_hidden().
|
|
* Add new CCG function ccgSubSurf_setAllocMask(). Similar to to
ccgSubSurf_setCalcVertexNormals(), it sets whether the CCG elements
have a mask layer and what that layer's offset is. Unlike normals
however, it doesn't change any behavior during CCG calculation; it's
there only to give CCGKey information on the mask.
* Add a new flag to _getSubSurf(), CCG_ALLOC_MASK. If set, space for
an extra layer is allocated, but the number of CCG layers is not set
to include it. This is done because GridPaintMasks are absolute,
rather than being relative to the subdivided output (as MDisp
displacements are), so we skip subdividing paint masks here.
* Add a new flag to subsurf_make_derived_from_derived(),
SUBSURF_ALLOC_PAINT_MASK. This controls whether CCG_ALLOC_MASK is
set for _getSubSurf(). Related, masks are never loaded in during
ss_sync_from_derivedmesh(). After subdivision is finished, if the
alloc mask flag is set, the number of CCG layers is increase to 4
with ccgSubSurf_setNumLayers().
* Add a new flag to multires_make_from_derived(),
MULTIRES_ALLOC_PAINT_MASK. Not all multires functions need paint
mask data (e.g. multiresModifier_base_apply.) This flag is always
set in MOD_multires.c so that subdividing a mesh with a mask updates
properly even when not in sculpt mode.
* Update multiresModifier_disp_run() to apply, calculate, and add mask
elements. It's almost the same as the existing operations with xyz
coordinates, but treats masks as absolute rather than displacements
relative to subdivided values.
* Update multires_customdata_delete to free CD_GRID_PAINT_MASK in
addition to CD_MDISPS.
* Update multires_del_higher() to call the new function
multires_grid_paint_mask_downsample(), which allocates a
lower-resolution paint mask grid and copies values over from the
high-resolution grid.
|
|
* Changes to DerivedMesh interface: DMGridData has been removed,
getGridData() now returns an array of CCGElem pointers. Also added
getGridKey() to initialize a CCGKey (implemented only by
CCGDerivedMesh.)
* PBVH: added BLI_pbvh_get_grid_key().
* A lot of code is affected, but mainly is just replacing
DMGridData.co, DMGridData.no, and sizeof(DMGridData) with the
CCG_*_elem functions, removing the reliance on grid elements of
exactly six floats.
|
|
This is the first commit of the sculpt masking merge. Documentation:
http://wiki.blender.org/index.php/User:Nicholasbishop/PaintMasks
Thanks to Brecht for reviewing!
Replaced four boolean parameters with a single flag and a new enum,
SubsurfFlags.
|
|
|
|
Changed the create_vert_poly_map function to return a more compact
structure. Memory saved will vary depending on the mesh, but typically
it should be about one third of the old size.
|
|
|
|
|
|
|
|
ccg_gridsize() converts a level into gridsize, ccg_factor() is for
converting coordinates between different multires levels.
|
|
Renamed the multiresModifier_update() function to
multires_modifier_update_mdisps() and made it visible to subsurf_ccg.c
so it can be called directly. No functional change, just a bit simpler.
|
|
Previously, the shading and material was set once per PBVHNode when
drawing. This is still the case, but PBVHNodes are now built to
contain only one material and shading mode.
This is done with an extra partitioning step; once the number of
primitives in the node falls below the PBVH leaf limit, it's
primitives are checked for matching materials. If more than one
material or shading mode is present in the node, it is split and
partitioned (partitioned by material rather than 3D location.)
Given a sufficiently 'annoying' input, like a dense mesh with
thousands of materials randomly scattered across it, this could
greatly increase PBVH build time (since nodes might end up containing
a single primitive), but in general this shouldn't come up.
In order to support materials for grids, the CCGDM is building another
grid array (of DMFaceMat structs). This could be used to replace
CCGDM.faceFlag for some small memory savings (TODO).
|
|
Previously this was just a character array that stored face/poly flags
and mat_nr. Since mat_nr should be a short, this would have truncated
for higher values.
Replaced with a new DMFaceFlags struct.
|
|
|
|
- copy & rename EditMesh stricts for use with scanfill (remove unused members)
|
|
|
|
without the underscores these clogged up the namespace for autocompleation which was annoying.
|
|
polygon version of dm->getFaceMap(ob, dm)
sculpt uses this for checking connectivity.
|
|
|
|
http://markmail.org/message/fp7ozcywxum3ar7n
|
|
|
|
|
|
|
|
is in editmode.
|
|
|
|
|
|
Used a crazyspace approach (like in edit mode), but only modifiers with
deformMatricies are allowed atm (currently shapekeys and armature modifiers only).
All the rest modifiers had an warning message that they aren't applied because
of sculpt mode. Deformation of multires is also unsupported.
With all this restictions users will always see the actual "layer" (or maybe
mesh state would be more correct word) they are sculpting on.
Internal changes:
- All modifiers could have deformMatricies callback (the same as deformMatriciesEM but
for non-edit mode usage)
- Added function to build crazyspace for sculpting (sculpt_get_deform_matrices), but it
could be generalized for usage in other painting modes (particle edit mode, i.e)
Todo:
- Implement crazyspace correction to support all kinds of deformation modifiers
- Maybe deformation of multires isn't so difficult?
- And maybe we could avoid extra bad-level-stub for ED_sculpt_modifiers_changed
without code duplicating?
|
|
|
|
Fixes various crashes and redraw problems, most noticeable new feature
is that you can now sculpt on a multires mesh with deforming modifiers
preceding it.
I've left out support for sculpting on multires with enabled modifiers
following it, in this case only the base mesh can be sculpted now. The
code changes needed to do this are just too ugly in my opinion, would
need a more torough redesign which I don't think we should try now. In
my opinion this is also not really an important case, since it's going
to be incredibly slow anyway to run a modifier on a high res mesh while
sculpting.
So, to summarize current state:
* Fastest sculpting: base mesh with no modifiers or multires with only
modifiers preceding it.
* Slower sculpting: base mesh with modifiers, depends on the speed of
the modifiers.
* Not supported: multires mesh with modifiers following it.
|
|
- swapped in less verbose math functons
- modifier include cleanup
|
|
* #20833: layer brush doesn't work with multires.
* #20946: sculpt mode partially removes parts of the mesh in the viewport.
* #20420: grab brush stops after moving some distance.
* #20906: sculpt grab tool moves in wrong direction.
* #21132 and #21272: undo on object with subdivision surface modifier crashes.
* #21115: subsurf + multires + sculpting + undo causes crash.
* #20683: sculpt + multires apply + undo crash.
* #19094: wrong outline in solid mode.
|
|
|
|
msvc (though further work may be needed because changes made by the merge
|
|
|
|
Most likely will not compile for others, I'd appreciate any build errors
and missing files reports (I can never seem to get everything committed
and all the build systems working without help).
Porting over the sculpt/multires tools was a breeze,
thanks goes to brecht for a design that didn't exclude
ngons and was easy to port.
Note that I've not tested externally-backed multires
file support yet. Also, I still need to write version
patch code for some cases.
Some notes:
* Like trunk, topological changes don't update multires right,
so e.g. subdivide will duplicate multires data on the new faces,
instead of subdividing it.
* If you set the debug value (ctrl-alt-d) to 1 it'll turn on
my experiments in speeding up sculpting on higher-res multires
meshes (but note it makes partial redraw not completely accurate).
* There's a bug where you have to go through editmode to get out
of sculpt mode, not sure if I inherited or created this myself.
|
|
* Multithread parts of multires and subsurf. Only loops working on
face grid data and do no memory allocation have been multithreaded,
others would be more complicated.
* Force some CCGSubsurf functions to be inlined, gives a small overall
speedup in subsurf code.
* Fix sculpting not working correct with transformed objects.
* Fix a few cases of "spikes" on lower level multires levels. There's
still cases where it happens, usually on boundary cornders. The
problem is that in such cases the limit surfaces can be very different
from the low res surface, so the tangent space is very different too..
* Fix crash deleting multires higher levels with level set to 0.
* Fix crashes that happened sometimes when adding faces in editmode.
|
|
* Now uses the CCG DerivedMesh also in object mode, used to be edit mode only.
* Create CD_ORIGINDEX layer on demand, to save memory.
* Removed ss_to_cdderivedmesh function, and instead create ccgdm and then
convert that to cddm, to avoid code duplication.
* Added and implement DerivedMesh interface functions to obtain face grids.
* Store edge/face flags more memory efficient.
* Export CCGDerivedMesh struct in BKE_subsurf.h
|
|
soc-2008-nicholasbishop branch.
Note: any old code with multires_test() or multires_level1_test() can
just be deleted, not needed by the multires modifier.
|
|
|
|
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
|
|
main features are:
* Modifiers can now be in any order in the modifier stack
* DerivedMesh now has a standard framework for custom element data to be passed
through the stack with mesh data (being copied and interpolated as
appropriate), so modifiers can access whatever data they need
* The modifier stack code has been refactored and a number of bugs have been
removed
* The EdgeSplit modifier has been added:
http://mediawiki.blender.org/index.php/BlenderDev/EdgeSplitModifier
* The DerivedMesh modifier has been added:
http://mediawiki.blender.org/index.php/BlenderDev/DisplaceModifier
* The UVProject modifier has been added:
http://mediawiki.blender.org/index.php/BlenderDev/UVProjectModifier
For more info, see:
http://mediawiki.blender.org/index.php/User:Artificer/ModifierStackUpgrade
(currently undergoing reorganisation)
|
|
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
|
|
drawMappedEdges
- added DerivedMesh.convertToDispListMeshMapped function which converts and
also returns mapping information for use in editmode
- updated DispListMesh derivedmesh to be able to function in editmode
- update mirror modifier to support use as a cage
- update mirror & subsurf modifiers to properly pass mapping information down
modifier stack
It is now possible to have a mesh with mirror/subsurf modifiers where you
can edit with both as cage. Selecting the mirror'd part works, but of course
transform is flipped so it is a bit weird. Not the cleanest code in the
world and I can't say I am really happy with the architecture but it works for
now and supports the existing feature set.
|
|
to write one that is based on geometry (and not just vertex position)
- added editmode versions of modifier deform/apply calls and flag
to tag modifiers that support editmode
- added isFinalCalc param to applyModifier, basically a switch to let
subsurf know if it is calc'ng orco or not (so it can deal with cache
appropriately). This is kinda hacky and perhaps I can come up with
a better solution (its also a waste to do a complete subdivide just
to get vertex locations).
- changed ccgsubsurf to not preallocate hash's to be approximately correct
size... this was probably not a big performance savings but means that
the order of faces returned by the iterator can vary after the first
call, this messes up orco calculation so dropped for time being.
- minor bug fix, meshes with only key didn't get vertex normals correctly
calc'd
- updated editmesh derivedmesh to support auxiliary locations
- changed mesh_calc_modifiers to alloc deformVerts on demand
- added editmesh_calc_modifiers for calculating editmesh cage and final
derivedmesh's
- bug fix, update shadedisplist to always calc colors (even if totvert==0)
- changed load_editMesh and make_edge to build me->medge even if totedge==0
(incremental subsurf checks this)
todo: add drawFacesTex for ccgderivedmesh
So, modifiers in editmode are back (which means auto-mirror
in edit mode works now) although still not finished. Currently
no cage is computed, the cage is always the base mesh (in
other words, Optimal edge style editing is off), and the final
mesh currently includes all modifiers that work in edit mode
(including lattice and curve). At some point there will be toggles
for which modifiers affect the final/cage editmode derivedmesh's.
Also, very nice new feature is that incremental subsurf in object
mode returns a ccgderivedmesh object instead of copying to a new
displistmesh. This can make a *huge* speed difference, and is very
nice for working with deformed armatures (esp. with only small
per frame changes).
|
|
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
|