mcjShrinkWrapA
Introduction
This script allows you to shrink wrap an object, usually a tube onto a figure or object.
It requires the presence of the mcjCollider plugin on your Windows PC
https://sites.google.com/site/mcasualsdazscripts2/mcjcolliderds45
Warning
Warning - According to statements seen in the Daz3D forum, Using "shrink-wrap" modeling tools
to create and distribute clothes and figures derived from Daz3D figures like Genesis is forbidden
and could result in litigation for copyright violations.
History
February 20th 2019 - Version 3, safer for subdivided surfaces that could render a scene file un-loadable
June 28th 2013 released
July 8th 2013 added a progress display / terminator
Installation
The zip package is found at the bottom of this page
unzip it in your daz content folder, typically C:\Program Files\DAZ\Studio\content\
once installed, it will appear in your content library, under Studio / Scripts / mcasual
You will also find attached a file named FourFreeTubeShapesForShrinkWrapping.zip which contains 4 tube shapes.
To load those in a scene, use Daz Studio's "File / Import / Wavefront Object" menu. Use "Poser Units" as your import settings.
Use
Select the figure to be wrapped, example, Aiko5
create an mcjCollider node, by selecting "mcjCollider" from Daz Studio's "Create" menu
Place the wrapper object, example a mcjShrinkTubeRound32x16 tube around the section of the figure to be wrapped
Launch the script mcjShrinkWrapA
Specify the minimum distance from the figure you want the shrink wrapping to shrink.
press the 'doit' button
wait a few seconds, be patient
close mcjShrinkWrapA by clicking the Exit button
The wrapper object ( tube ) should now have a new Morph channel
when you set its strength to 100% the result will be visible
Warning - if you accidentally selected a gigantic wrapper object,
the script may be stuck in processing mode for a very long time.
Problematic cases
be aware that the script "fires" the mcjCollider hundreds of times.
The collision detection rays are shot from the vantage point of the wrapper tube
and aimed at the figure.
Sometimes the rays pass right between two of the figure's many facets.
In those cases the resulting wrap will contain defects.
one way to fix this is to rotate the wrapper tube by a very small angle around the Y-Axis
say, 1 degree. This way the collision detection rays have less chances of shooting through
( this usually happens at x = 0 when the collider ray points along the Z axis )
How it works
the script goes through the wrapper cloth’s vertices one by one.
Each vertex has a “normal” which is like a flagpole planted perpendicular to the “ground” at the position of the vertex ( shown here in green )
The script installs an mcjCollider at the top of the flagpole
The script orients the mcjCollider so that it points toward the ground, in line with the flagpole
The script “fires” the mcjCollider
The collider crashes at the surface of the figure being wrapped
The script adds an entry in the morph that makes the cloth vertex move just above to the crash site
If the collider misses the figure, for example while trying to wrap 2 legs, then the script moves the
cloth vertex the sane distance it did, the last time it did hit something. The result of this is not optimal
but often better than just leaving the vertex alone
---------------------------------------------------
New Safer Upgraded 2019 - Version 3
---------------------------------------------------
With the old version of this script if the wrapper object was a subdivided surface, and you saved this scene as a .duf file, the file would become un-openable !!!
There are now 2 Help buttons, 1 leading to this web page, one that pops up basic instructions
There are now 3 options regarding collider rays that dont collide against the wrapped object
- Move vertex like the last hit : the old method, produces good results if the vertices of the object are ordered so that one vertex[i+1] is close to the vertex[i]
- Leave vertex where it is : you could then delete those vertex in your favorite modeling tool
- Move vertex near wrapper axis : the script will project the vertex onto the Y axis of the wrapper object, then pull it back by the amount you give in the "Wrapper Axis Gap" field
License
//===================================================================
// by mCasual/Jacques
//===================================================================
// ( MIT License )
// Copyright (c) <2013> <mCasual/Jacques>
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//===============================================================================================