-
Notifications
You must be signed in to change notification settings - Fork 226
Optimization Tips
Normals are most commonly used for lighting, so recalculation can be disabled if your mesh has an unlit shader or doesn't require normals for something else. You could also probably disable them if the vertices aren't moving much. You can get a pretty massive performance boost from disabling normal recalculation.
Bounds are used for frustum culling. If the bounds are outside of a camera's field of view (frustum) the mesh won't get drawn (see here.) This is important because if you move a mesh's vertices too far away from their original position without updating the bounds, it might get culled while you're looking at it! I recommend leaving bounds recalculation on for convenience if you can get away with it, but if the deformation is predictable, consider setting custom bounds that match the potential bounding volume of your mesh when it is deformed (basically the same thing as vfx graph or skinned mesh bounds.) You can do this easily by changing the Bounds mode of a Deformable to Custom and then toggle the Custom Bounds "🔴" record button.
Colliders are probably the slowest things to update. It doesn't require any additional calculations on Deform's end, but Unity/PhysX seem to require a lot of work to update a mesh collider. In general I wouldn't recommend using mesh colliders, but if you must, the best way I've found to improve performance is to disable the cooking options on the Mesh Collider.
This tip is mostly common sense, but the lower you can make your vertex count the better. High poly meshes can tank performance pretty quickly because each of their deformers typically has to process every single vertex.
Some deformers require complex math. Use them responsibly. The less deformers you can achieve an effect with, the better!
Deform is meant to be artist and designer friendly. It allows for rapid iteration and testing; however, it is not always feasible to do certain effects/animations on the CPU. Vertex shaders will always handily beat Deform performance-wise. Certain things like bounds and normal recalculation are made more difficult, but it's an important option to consider.
Remember, the source of every deformer is available for you to copy/paste/tear apart. They're all written with the mathematics library which has a shader-like syntax, so they're practically begging you to port them to the GPU.
Home
Installation
Getting Started
Creating a Custom Deformer
Masking
Optimization Tips
WTF Is Up Skinned Mesh Renderers?
Deform
DeformableDeformer
DeformableManager
Deformers
BendDeformerBlendDeformer
BulgeDeformer
CubifyDeformer
CurveDisplaceDeformer
CurveScaleDeformer
CylindrifyDeformer
InflateDeformer
LatheDisplaceDeformer
MagnetDeformer
MeltDeformer
RadialCurveDeformer
RadialSkewDeformer
RippleDeformer
ScaleDeformer
SineDeformer
SkewDeformer
SpherifyDeformer
SquashAndStretchDeformer
StarDeformer
TaperDeformer
TextureDisplaceDeformer
TransformDeformer
TransformOffsetDeformer
TwirlDeformer
TwistDeformer
UVOffsetDeformer
UVScaleDeformer
WaveDeformer