-
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 are only moving along their normals, or in a single direction. 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. 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 encapsulate the potential deformation-space (basically the same thing as VFX Graph bounds.) The deformable might not get culled as efficiently depending on the size of the bounds, but not having to recalculate perfect bounds every frame could result in a net perf gain; however, don't take my word for it, profile your builds!
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 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