Chapter 2 · Examples

2.8A Fringe of Threads

Tnpix Threads needs no tear to show: along painted edges it fringes a hem from the first frame. With the channel left empty, every open border of the cloth is fringed.

p = Plane length:60 width:60 lengthsegs:1 widthsegs:1 pos:[0,0,50]
addModifier p (Tnpix_Garment())
p.modifiers[#Tnpix_Garment].edgeLength = 2.0
addModifier p (Tnpix_Gravity())
addModifier p (Tnpix_Solver())
addModifier p (Tnpix_Threads())           -- on top: directly above the Solver
th = p.modifiers[#Tnpix_Threads]
th.whereItTears = false                   -- this sheet does not tear
th.alongPaintedEdges = true               -- channel "" = every open border
th.grainFrom = 2                          -- Combed only ...
th.combAlong = 1                          -- ... along world X, for a flat sheet
th.warpEvery = 1.0
th.weftEvery = 1.0
th.threadLength = 3.0
TnpixTool.sim p 10                        -- simulate up to frame 10
print (TnpixTool.threadsInfo p)
print (TnpixTool.threadsMakeObject p)     -- the tubes into their own object

What you should see: the sheet falls and its four borders carry a fringe of threads that swing as it falls. The first print is the Threads status for frame 10, among it Along painted edges: every open border and the tube faces of every thread. The second is the name of the new threads object, for example Plane001_Threads: the tubes now live in that object, and the sheet leaves its stack as the Solver made it. Set th.viewportPercent to show more or fewer threads in the viewport; a render makes all of them.