Chapter 4 · Recipes
4.14Quality presets
The Solver's Preset list sets six values together; Stretch quality is not part of a preset. Setting the same values from a script gives the same quality, and the panel then shows that preset.
global tpaPresetValues, tpaSetPreset
-- substeps, iterations, contact passes, smoothing, post collision passes, fast motion collision (ccd)
fn tpaPresetValues p = (
if p == #draft then #(1, 1, 1, 5, 0, false)
else if p == #tight then #(6, 2, 2, 10, 2, false)
else if p == #fast then #(8, 2, 2, 10, 2, true)
else if p == #high then #(8, 3, 3, 10, 3, true)
else if p == #ultra then #(15, 8, 7, 10, 3, true)
else #(4, 2, 1, 10, 0, false) -- #default: a new Solver's set
)
fn tpaSetPreset sv p = (
local v = tpaPresetValues p
undo "TenPix: Solver preset" on (
sv.substeps = v[1]
sv.iterations = v[2]
sv.contactPasses = v[3]
sv.smoothingIterations = v[4]
sv.postCollisionPasses = v[5]
sv.ccd = v[6]
sv.deepRescue = false -- every preset sets it off
)
)
-- tpaSetPreset (tpaFirst $Shirt Tnpix_Solver) #tight
| Preset | For |
|---|---|
| Draft | Blocking. |
| Tight clothes | Trousers and sleeves over bending joints. |
| Fast motion | Kicks and swinging hands. |
| High quality | The final. |
| Ultra quality | The finest result in one go, and the slowest; most shots do not need it. |
- Substeps divide each frame and evaluate everything again, collision included. They are the main fix for fast motion and the first thing to raise.
- Iterations only tighten a solve that is nearly right; they do not evaluate collision again.
- Cost. Substeps × Iterations is the first number to look at when a scene is slow.
- Contact passes follow a rule: Iterations or Stretch quality of 4 or more want at least 4 contact passes; 8 or more want at least 7.
- Deep rescue (
deepRescue, Surface only) moves back outside any cloth a body has come through. It adds time. - Many Solvers at once. The toolbar's Quality window applies the same presets to one Solver or many.