Chapter 3 · Reading a scene
3.6Looking at it
- Simulate, then capture. Run
TnpixTool.sim node frameup to the frame, move the slider there (sliderTime = (f as time)), and capture the viewport. Capturing a frame that has not been simulated yet simulates up to it. - Show End Result. Before you capture, open the Solver in the Modify panel (
modPanel.setCurrentObject (tpaFirst g Tnpix_Solver)). Opening a Tnpix panel turns 3ds Max's Show End Result on. With it off, and a modifier below the Solver selected, the cloth looks frozen. - Painted weights.
(tpaFirst g Tnpix_Channel).showWeights = truedraws the channel selected on the Channel panel, from dark blue (0) through yellow (0.5) to red (1). Capture it, then set it back tofalse. - Stretch and contact.
sv.stressHeatmap = truecolours every garment of the Solver group by how hard it is stretched or pressed. It is display only. Set it back afterwards. - The TenPix Graph.
TnpixGraph.open()shows the artist every Solver group with its objects and modifiers, in a window of its own. Opened from a script, it starts on the scene's first Solver group.
Capture without a snapshot tool. tpaCapture saves the active viewport, as it is drawn at that moment, to a PNG file. Read the file if your tools can open pictures; otherwise tell the artist where it is. Never judge a simulation from numbers alone: a garment can stay close to the body and still slide off it.
global tpaCapture
-- save the active viewport to the PNG file f; returns the file's path, or why there is no picture
fn tpaCapture f = (
local r = "No viewport picture here (" + f + " was not written)."
try (
completeRedraw()
local img = gw.getViewportDib()
if img != undefined do ( img.filename = f; save img; close img; r = f )
) catch ()
r
)
-- tpaSimTo $Shirt 24 (4.15), then: tpaCapture ((getDir #temp) + "\\tenpix_frame24.png")