A version comes pre-installed in the Unofficial trueSpace Updates - https://www.united3dartists.com/forum/viewforum.php?f=55
persistent base install v3 required
Clintons3dPluginExt is required to save EXR format animation textures.
The modelspace vertex animation also requires a python
script, "modelCloth2vertexAnim.py", available
here.
Right click to save the archive. It can be unzipped in to "C:/trueSpace761/tS/PythonScripts",
but the location does not really matter.
The included re.py script must be placed in the PythonScripts folder or in the root folder of tS.
Installation:
- Install the persistent base if not already installed
- install the rsx plugin
- Copy "modelCloth2vertexAnim.py" and "re.py" into "C:/trueSpace761/tS/PythonScripts"
- Drag the node into the link editor and press the install button
- Delete the node from the scene after install is complete
Morph Animation:
-
End Time - number of seconds to capture, where the time starts at 0.
-
Frames Per Sample - number of frames that run between samples. A value of 10 means 10 simulation frames will run between each capture of the mesh state.
-
Make Morph - create a morph animation from the selected cloth simulation.
Vertex Color Animation:
-
End Time - number of seconds to capture, where the time starts at 0.
-
Frames Per Sample - number of frames that run between samples.
A value of 10 means 10 simulation frames will run between each capture of the mesh state.
-
Relative Shape - a new shape for the converted cloth will be created that maximizes the color space for small motions.
The animation is stored as the change of each points position relative to the new optimized shape.
When unchecked the bounding box extents of the animated shape serves as the container defining the maximum and minimum point locations.
-
Export Images - export the resulting position and normals animation images for use in other applications.
Images can be saved as png, tga, hdr and jpg formats. The rsx extension adds exr float format images.
The prefixes "VAT_Posn_" and "VAT_Norm_" will be added to the file names to indicate the position and normals images.
-
Make Vertex Color - create a vertex color animation from the selected cloth simulation with the option to export the bitmaps as image texture files.
Modelspace Vertex Animation:
-
End Time - number of seconds to capture, where the time starts at 0.
-
Step Frames - number of frames that run between samples. A value of 1 means for each simulation frame the mesh state is captured.
-
Distance - offset value in x,y and z to prevent the copied meshes from interfereing with the cloth simulation run.
- Save tS66 COB - when active an ascii format tS cob file is created.
When unchecked mesh objects are created for each captured frame and a python script is used to combine them into a vertex animation in modelspace.
-
Make Vertex - create a collection of meshes from the selected cloth simulation to be used in the modelspace python script for vertex animation.
The first step is to determine the length of the animation.
Make sure the "PhysEngine" node is visible and you can see the Current Time.
Run the simulation and and take note of the Current Time value. Stop the simulation after determining the desired end time.
Morph Animation
- Set the End Time to the length of the desired animation.
- Set the Frames per Sample value. This is how many frames of the simulation will run before a morph target is created.
- Select the object and press the Make Morph button.
- Answer "Yes" to any construction history alerts.
Vertex Color Animation
- The cloth object must have compound D3D nodes style materials. Use the material converter script if the material is a base material.
- Option: freeze the cloth objects transforms.
- Set the End Time to the length of the desired animation.
- Set the Frames per Sample value. This is how many frames of the simulation will run before a morph target is created. Vertex color animation is stepped, so a value of 1 works best.
- Use Relative Shape if the cloth object has very small motions.
- If exporting the result to another 3D program or game engine, enable the Export Images.
- Select the object and press the Make Vertex Color button.
- Answer "Yes" to any construction history alerts.
- As instructed press the Vertex_shader button, "Activate". The LE will open to it automatically.
- A Vertex Animation Texture (VAT) node is added to the object and the information can be used in the vertex shader development.
Modelspace Vertex Animation(COB file)
- Set the End Time to the length of the desired animation.
- Set the Step Frames value. This is how many frames of the simulation will run before a shape target mesh is created.
- The Distance value is not used.
- Save tS66 COB enabled
- Select the object and press the Make Vertex button.
- Answer "Yes" to any construction history alerts.
- Go to modelspace or open trueSpace v6.6
- Load the cob file
Modelspace Vertex Animation(Python Workflow)
- Set the End Time to the length of the desired animation.
- Set the Step Frames value. This is how many frames of the simulation will run before a shape target mesh is created.
- Set the Distance so that the copied meshes don't interfere with the cloth simulation.
- Save tS66 COB disabled
- Select the object and press the Make Vertex button.
- Answer "Yes" to any construction history alerts.
- Go to modelspace
- Open Python Scripts and choose "Scene" from the dropdown
- Load the python script, "modelCloth2vertexAnim.py", into the Scene script
- Run the script to create the vertex animation.
- Remove the script from the scene by pressing the New script button
- Delete the targetMesh objects and the transformNode objects
Notes
- For most cases the Morph Animation is the best choice for use inside of trueSpace.
- Press the "Esc" key to abort a run.
- Always answer yes when asked about construction history.
- VAT does not work with scene instanced materials
- VAT hdr file format does not have true hdr data, values are stepped like an 8 bit image
- Vertex colors only render with the D3D render engine
- Vertex color normals will not process within trueSpace shaders.
- If you choose to not clear history when asked and you need to undo past the conversion run, save the new animated object first, then perform the undos.
Vertex color animation works better if the cloth object does not have any rotation values. The main advantage is that the animated object can be moved and rotated. Use the freeze transform script to remove rotations.
Vertex color result can be moved and rotated if the original object does not have any rotations and the Use World Coordinates is checked.
- The information from the VAT node can be added to fbx exports by renaming it to "Metadata"
- When exporting to fbx any textures need to exist on disk and materials need to be compound materials. See material utilities.
- Close any open Scene View panels before running any python scripts. There is an incompatibility between the workspace Scene View and the modelspace python editor.
If it is open tS will slow down right after opening the python editor.
To fully recover from this state, close the Scene View and restart trueSpace.
TODO demo all 3 methods using the 3 Flags.RsScn sample from the pdf docs
TODO demo export of vertex color into Godot game engine(Unreal game engine?) - have new shader that uses normals and some rough steps worked out
TODO update videos
Videos below are based on an earlier version of the script
Click this for the
first part of the video demonstration for vertex animation(wmv,
4:00, 3.5Mb).
Click this for the second
part dealing with morph animation(wmv, 4:52, 3.9Mb).
Vertex Animation Texture script can be used to export position and normal textures created from a morph animation. It also has some theory behind the vertex color animation process.
Dev Notes
- note: when switch to modelspace objects named "xxx,(space)#" will change to "xxx,#"
- python delete command does not work
- re.py copied from python 1.5.2
- x,pitch and yaw and texture coordinate offsets are all negative in the cob file
- cob 6.6 and 7.6 are almost identical except for header and 7.6 color map has kd value, had to do 1-v for uv values
- exr format can save positive and negative float values - so would not need any scaling or offsets - cloth sims don't seem to require this to get a good result.
- off topic: NOTE: export scripts will see HLSL nodes, need different extension for it
- NOTE: can check for modelspace in 2 ways #1 if(typeof(tSBridge) != "undefined") #2 if(Node.Exists('Project/TSScene'))
- RsTime.EvalAnimStart and EvalAnimEnd give first and last keyframes in the scene and sets the play range, the in string value seems to be ignored
TODO - save and load history dev
November 12, 2024 - pre-release version
- fixed math used in VATs - the main reason for the update
- stack view not required for vat animations
- new cob export for modelspace vertex aniamtions
- default values for the input controls, vertex colors frames per sample has scrubber because default setup values did not work
- python file does not need to be edited to set the frame interval
- model vertex animation object has a prper name instead of just "targetMesh"
- test shows morph conversion will "work" with cameras and lights - removed restriction
- VAT result more compatible with rotation transforms
- cloth2vertexcolor does not require editable or shape node before running - removed restriction
- update installer toolbar resets and setup for load on demand
- higher contrast image toolbar button from UU modified
February 22, 2023
- new ui and color vertex export images checkbox by trueBlue
- activate/return to scene button by trueBlue
- trueBlue camera and light check restriction
- Vertex color animation node automatically opens in the panel view. No need to drag it in anymore.
- Added an "Open All VTAs" button to the VTA nodes. Activate all the vertex color animations in the scene without needing to select them all and no need to open the cloth panel to press the same button.
- better status line feedback in vertex color
- fixed tS modelside renaming of nodes which sometimes stopped the python file from running properly
- updated the python file to use the new modelspace freindly names
- added one more frame to model vertex animation so first frame not lost
- fixed vertex color to work with scene instanced materials
- vertex color works with multi-material objects
- morph and vertex colors use up fewer undo steps
- removed automatic flattening as that should be a user choice
February 13, 2023
- new vertex color animation
- updated morph
- fix errors
- updated the installer to use permanent style install
- fixed button highlighting
- workflow improvements for morphs
July 27 2015
- unique button id
- auto-installer