| || |
script for Daz Studio will let you create tubular objects that follow curves you create by animating a marker.
The French horn shown above was created using this script.
The script is in the zip package 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
ToDo : A copy of this web page is also downloadable in a zip package.
Creating a pathSave Path : saving an animated marker path for use in mcjSuperLathe and mcjTransport
By animating the position of an object in the scene, we create a path.
We create a primitive-sphere, 16 segments, 32 sides, diameter 3cm
For convenience sake, we create a primitive plane, ( Size: 1 meter, Divisions 2 ) and apply to it, the blueprint of our intended path.
We set the view-camera to Top View
Starting at frame 0, we repeatedly move the red ball along the curve while and keyframe it using the keyframing button
Once we're done we know the path has 44 segments
so we must tell mcjTransport to build a 44-segment tube
Building the tube
Select your animated marker
Launch mcjTransport, which should be located in your studio/scripts/mcasual folder
in the "Zero Tube Creation" section, specify how many sides your tube will have, typically between 4 and 32.
The number of segments must fit the path's number of segments, so in the case of our example, 44.
Click the "Build" button and there you go, you created a tube!
But for now, the tube has a size of zero ( hence the name ZeroTube ) and is not visible.
Click the "Update Tube" button
the Zero tube will be "inflated". We're done !
Understanding the tube size
The diameter of the tube is governed by the Scaling of the animated marker and by mcjTransport's "Scale factor" slider.
in our example, the ball was not scaled up or down, so it's scale was still 100%, and mcjTransport's "Scale factor" was 1
so the resulting tube has a radius of 1cm.
If we want the tube to have a diameter of 3cm, we set mcjTransport's "Scale factor" to 1.5, and click the "Update Tube" button.
Next to the scale factor slider is a drop down list that lets you select which one of the marker's "XScale, YScale ZScale" sliders further influences the tube scale.
Using an mcjSphere as the animated marker
As you can see above, the primitive-spheres produced by Studio have the disadvantage of having their origins at the base of the sphere instead of having it at the center of the sphere. In some cases this can make the creation of the paths non-intuitive.
We suggest you use an mcjSphere prop. or make one. in fact, it's a normal primitive sphere that was exported and re-imported in Studio.
Tweaking the tube shape
adjust you animated marker's path
In the 3D Viewport, or in the Scene tab, select the marker (sphere), then while holding down the CTRL key, select the ZeroTube
it's very important to select only those 2 nodes, in that order
click the "Update Tube" button.
Tubes with Varying diameters
If you also animate the scale of the marker then, the diameter of the tube for this keyframe will vary accordingly.
By default, the "Use Z-Scale" option is selected, this means you can use the marker's "Z Scale"
parameter to adjust the diameter of the tube at a given keyframe.
If you work in side or front view, you will want to change this to "Use Y-Scale".
in the image below, the marker was moving in straight line, but its scaled was animated
we obtained the musical instrument known as an AnnoyAnnoyZela
Using custom profiles
By default the tubes have the number of sides you selected using the "Sides" slider of the "Zero Tube Creation" section.
and the tubes have a circular profile ( also known as 'section' ).
The "Profile" section lets you re-use profiles created using the scripts named mcjLathe and mcjSuperlathe.
mcjTransport can also produce custom profiles ( see below )
Example, i created a gear-shaped profile and saved it as gearme.txt
in mcjTransport's "Profile" section, i check-mark the "Use Curve File" check-box
i browse to and select my gearme.txt file.
a popup message appears
since the ZeroTube i created earlier has only 6 sides, but the newly loaded profile calls for 128 sides
- exit mcjTransport
- delete the ZeroTube
- re-select the animated marker
- launch mcjTransport
- in the "ZeroTube creation" section, i change 'sides' to 128;
- and press the "Build" button
( note that mcjTransport automatically selected the new ZeroTube )
press the "Update Tube" button
and we obtain a sort of baroque leg
Making rings by welding tube ends
The check-box labeled 'Closed Path" in the 'Path' section lets you crate rings
basically what it does is to weld the first ring/profile of the tube with the last one.
The position of the last ring is ignored, the position of the first ring is used
This is most useful when dealing with subdivided objects, for example:
Better rings with the "use C spline" checkbox
By default mcjTransport uses Daz Studio's animation curves when forming the tube.
In some cases this will result in hard edges near the ring joint ( figure A )
If you check-mark the "use C Spline" button, mcjTransport will use its own animation curve ( a Catmull-Rom spline ) to fix this ( figure B ).
Path / Weld Bottom , Weld Top : Adding caps at the tube ends
When you create the ZeroTubes, these two checkboxes let you cap the tube ends.
Path / Load 2D
Previously, we saw we can load a curve created using mcjLathe, mcjSuperLathe or mcjTransport and use it as the tube's profile.
Here the curve will be applied to your animated marker
Old programs like mcjLathe produced flat curves, say, like curves drawn on a sheet of paper.
so your animated markers will move on a floor or on a wall.
the path is rescaled to a 1 meter square domain.
tip : you can rescale a path by parenting the marker to a null, then re-scaling the null
The 'Path' section also includes a drop-down menu which lets you specify if the 2D path will run
over the floor ( "2D path : Top View" ) or run over a wall ( "2D path : Left View", "2D path : Front View" )
Path / Load 3D
Lets you load a 3D marker path saved by mcjTransport
this includes scaling
The 'Save Path' button will save the marker's animation ( the path ) in a file.
Both the 2D curve and the 3D curve are saved
These curves can be used by mcjLathe, mcjSuperLathe and mcjTransport.
In mcjTransport's case, they can be used as a profile or as a path.
The Torsion Section
mcjTranport's name comes from the method named "parallel transport", the script makes efforts to keep the tube non-twisted.
In the 'torsion section you can add controlled twisting.
The Twist slider sets in degrees the initial amount of twist. In the example shown below, we set it to 90 degrees
When the "Z-Rot Steering" is check marked, the "ZRotation" parameter of your marker is added to the tube's torsion.
The Turns slider sets the amount ( in number of turns ) of spin added over the length of the tube. In the example shown below, 3 turns .
In the example below, it was used to tilt the road
// by mCasual/Jacques
// Copyright (c) <2012> <mCasual/Jacques>
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), use the software and copy the source code.
// We do not allow selling or reselling of the unmodified software.
// 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.