workspace cloth simulation to modelspace vertex animation
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
workspace cloth simulation to modelspace vertex animation
uses a workspace jscript object that calls a modelspace python script that writes vertex animation keys for workspace cloth animation
save your scene to a new name
THIS PROCESS WILL DESTROY THE WORKSPACE CLOTH ANIMATION
THIS PROCESS WILL DESTROY THE WORKSPACE CLOTH ANIMATION
don't forget to save your scene with a NEW name, don't save to the same name
add the cloth2vertexanim.RsObj node to the scene
set a delay value in Period - the delay will be applied to allow time for the physics to run and the python script to copy vertex positions and key them
run simulation and take note of final PhysEngine Current Time for end of the animation
run the sim and when it reaches the end of what you want note the Current Time in the PhysEngine node
set physicsRuntime of the cloth2vertexanim to the last time value from above
set the animation time line to more or less the same length of time as the physics run
set a step value
example time line is set for 60 frames a step value of 6 will keyframe every 6 frames for a total of 10 keyframes
UPDATE NOTE: The step must divide evenly into the total frame count. 60/6=10 which is ok but if the step value was 7 then 60/7=8.57 and the loop node used in the script won't see the end of the count.
rename the cloth object to "clothMesh"
copy the cloth object and rename the copy to "targetMesh"
move the targetMesh away from the cloth mesh in the 3d view or the target will interfere with the cloth sim
remove cloth attributes from the targetMesh and flatten history on the targetMesh
switch main view to Model
load the python script cloth2vertexanim.py into the scene
open the script editor
choose scene in the dropdown
assign the cloth2vertexanim.py
run the script - this initial run prevents random vertex animation keys from being created
push the start button on the node object and wait for the time indicator to move to the end
when the script finishes the targetMesh will have vertex animation to match the cloth simulation
I'll try to make a tutorial for this sometime next week
Edit: Have to delay tutorial until fix a problem with the script and found out that the loop node only works with integer values.
save your scene to a new name
THIS PROCESS WILL DESTROY THE WORKSPACE CLOTH ANIMATION
THIS PROCESS WILL DESTROY THE WORKSPACE CLOTH ANIMATION
don't forget to save your scene with a NEW name, don't save to the same name
add the cloth2vertexanim.RsObj node to the scene
set a delay value in Period - the delay will be applied to allow time for the physics to run and the python script to copy vertex positions and key them
run simulation and take note of final PhysEngine Current Time for end of the animation
run the sim and when it reaches the end of what you want note the Current Time in the PhysEngine node
set physicsRuntime of the cloth2vertexanim to the last time value from above
set the animation time line to more or less the same length of time as the physics run
set a step value
example time line is set for 60 frames a step value of 6 will keyframe every 6 frames for a total of 10 keyframes
UPDATE NOTE: The step must divide evenly into the total frame count. 60/6=10 which is ok but if the step value was 7 then 60/7=8.57 and the loop node used in the script won't see the end of the count.
rename the cloth object to "clothMesh"
copy the cloth object and rename the copy to "targetMesh"
move the targetMesh away from the cloth mesh in the 3d view or the target will interfere with the cloth sim
remove cloth attributes from the targetMesh and flatten history on the targetMesh
switch main view to Model
load the python script cloth2vertexanim.py into the scene
open the script editor
choose scene in the dropdown
assign the cloth2vertexanim.py
run the script - this initial run prevents random vertex animation keys from being created
push the start button on the node object and wait for the time indicator to move to the end
when the script finishes the targetMesh will have vertex animation to match the cloth simulation
I'll try to make a tutorial for this sometime next week
Edit: Have to delay tutorial until fix a problem with the script and found out that the loop node only works with integer values.
- Attachments
-
- cloth2vertex.zip
- (41.05 KiB) Downloaded 374 times
Last edited by clintonman on 14 Oct 2009, 04:43, edited 1 time in total.
-
froo
- Captain
- Posts: 2554
- Joined: 22 May 2009, 12:13
Re: workspace cloth simulation to modelspace vertex animation
Very Cool Clinton. 
-
Benji
- Senior Chief Petty Officer
- Posts: 280
- Joined: 22 May 2009, 01:23
Re: workspace cloth simulation to modelspace vertex animation
This is has a lot of potential, thanks. 
-
3dvisuals dude
- Chief Warrant Officer
- Posts: 643
- Joined: 03 Jun 2009, 02:53
- Type the number ten into the box: 0
Re: workspace cloth simulation to modelspace vertex animation
This is very useful for OurSpaces projects online. Looking forward a great deal to the tutorial and thank you for creating this for us all! 
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: workspace cloth simulation to modelspace vertex animation
An update, but not good news I'm afraid. The script runs by setting the continue flag on the physics engine and I'm getting completely different results between regular physics and continuous physics modes. I'm going to have to work on this on a little bit longer.
I'll let you guys know how it turns out.
Edit: AS the professor would say, "Good news everyone!" I figured out an easier and better way to do this. It's not programmed yet but my test shows it will work. Stay tuned.
Clinton
I'll let you guys know how it turns out.
Edit: AS the professor would say, "Good news everyone!" I figured out an easier and better way to do this. It's not programmed yet but my test shows it will work. Stay tuned.
Clinton
-
v3rd3
- Lieutenant Commander
- Posts: 1191
- Joined: 21 May 2009, 20:04
Re: workspace cloth simulation to modelspace vertex animation
Clinton, as you may know most of us hang on your every word..... 
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: workspace cloth simulation to modelspace vertex animation
That made me laugh.v3rd3 wrote:Clinton, as you may know most of us hang on your every word.....
Here's an update that uses the new technique and adds another script. It's not all done but it works.
cloth2morph.RsObj will create a morph object from a cloth simulation.
cloth2vertex.RsObj will create copies of the cloth shape at regular intervals and is used with modelCloth2vertexAnim.py to create model side vertex animation.
Here are the notes until it's all done and I can create a tutorial for them:
Cloth to Morph
set endTime in seconds for physics run
set stepFrames step so not keyframe every frame
distance is how far to move the copy in x,y and z so it doesn't interfere with the cloth sim
select the cloth object
push "copy cloth" to copy cloth animation to morph targets
Cloth to Vertex
set endTime in seconds for physics run
set stepFrames step so not keyframe every frame
distance is how far to move the copy in x,y and z so it doesn't interfere with the cloth sim
select the cloth object
push "copy cloth" to copy cloth animation to sequential meshes and transform proxies
go to model side
load the modelCloth2vertexAnim.py into the script editor for the scene object and run it
- Attachments
-
- cloth2vertexmorph.zip
- (20.5 KiB) Downloaded 380 times
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: workspace cloth simulation to modelspace vertex animation
OK here are the final scripts. This last change animates the morphs created from the cloth simulation. During the process it will ask to convert to editable mesh 2 times. Once at the start and once at the end. Just answer yes in both cases. Tutorial coming in the future.
It has one bug in that the final morph isn't captured so run the physics a little bit longer to get all the animation needed.
It has one bug in that the final morph isn't captured so run the physics a little bit longer to get all the animation needed.
- Attachments
-
- cloth2vertexmorphee1e.zip
- (22.27 KiB) Downloaded 361 times
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: workspace cloth simulation to modelspace vertex animation
Final versions are done and demo/tutorial is finally done. The final version installs as a button and incorporates both the cloth to vertex and the cloth to morph scripts. The second topic on the page has the installer, the python script for vertex animation and a tutorial for vertex and morph conversions in video format.
http://www.clintons3d.com/plugins/trues ... index.html"
Near the end of the morph video the cloth object was turned stiff by the save animation options of the physics simulation. I forgot to mention that you can just go to the first frame and delete the animation to get the cloth back. The button I use to toggle the visibility can be found on my plugins utility page: http://www.clintons3d.com/plugins/trues ... index.html"
http://www.clintons3d.com/plugins/trues ... index.html"
Near the end of the morph video the cloth object was turned stiff by the save animation options of the physics simulation. I forgot to mention that you can just go to the first frame and delete the animation to get the cloth back. The button I use to toggle the visibility can be found on my plugins utility page: http://www.clintons3d.com/plugins/trues ... index.html"
-
3dvisuals dude
- Chief Warrant Officer
- Posts: 643
- Joined: 03 Jun 2009, 02:53
- Type the number ten into the box: 0
Re: workspace cloth simulation to modelspace vertex animation
Excellent! I am looking forward to checking this out thoroughly as soon as I can allocate the proper time to focus on it exclusively. I know I won't have the time but i intend to MAKE the time for sure, this is important stuff here and thank you for doing all this for us all sincerely! 
-
noko
- Senior Chief Petty Officer
- Posts: 170
- Joined: 24 May 2009, 04:16
Re: workspace cloth simulation to modelspace vertex animation
Really impressive! I am going to have fun with this Clintoman, thanks!
-
tahnoak
- Master Chief Petty Officer
- Posts: 339
- Joined: 02 Sep 2009, 01:31
Re: workspace cloth simulation to modelspace vertex animation
As soon as I figure out what the heck this is. I am looking forward to having a go at it.
I am sure it is something that I have wondered if I could do but never saw it written down before. Thanks for putting this out there.
I am sure it is something that I have wondered if I could do but never saw it written down before. Thanks for putting this out there.
-
Steinie
- Captain
- Posts: 2958
- Joined: 21 May 2009, 17:38
- Type the number ten into the box: 10
Re: workspace cloth simulation to modelspace vertex animation
Clintonman always makes these cool pieces of code that are not immediately
valuable until you start studying it.
I think he is using Python scripting on the Model Side so that we can capture Cloth Morphs on the workSpace side? I am not 100% clear on this but I know I'll be using this soon.
I know there was a need to capture cloth animation on the workSpace side, is this a way to do that?
I'm still a new user when it comes to animation, keyframes and morphs.
valuable until you start studying it.
I think he is using Python scripting on the Model Side so that we can capture Cloth Morphs on the workSpace side? I am not 100% clear on this but I know I'll be using this soon.
I know there was a need to capture cloth animation on the workSpace side, is this a way to do that?
I'm still a new user when it comes to animation, keyframes and morphs.
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: workspace cloth simulation to modelspace vertex animation
New update after almost 8 years.
New - can create vertex color animations from cloth sim
Fixed errors caused by not keeping the script up to date.
Uses new persistent installer - survives a reset default context
http://clintons3d.com/plugins/truespace ... morph.html
New - can create vertex color animations from cloth sim
Fixed errors caused by not keeping the script up to date.
Uses new persistent installer - survives a reset default context
http://clintons3d.com/plugins/truespace ... morph.html
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: workspace cloth simulation to modelspace vertex animation
Update November 2024
Pre-Release announcement. There is one more thing I want to try before calling it done.
changes:
VAT - vertex animation texture, changed from incorrect VTA
fixed math used in VATs - the main reason for the update
stack view not required for vat animations
new cob export for modelspace vertex animations
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 proper name instead of just "targetMesh"
test shows morph conversion will "work" with cameras and lights - so 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
Pre-Release announcement. There is one more thing I want to try before calling it done.
changes:
VAT - vertex animation texture, changed from incorrect VTA
fixed math used in VATs - the main reason for the update
stack view not required for vat animations
new cob export for modelspace vertex animations
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 proper name instead of just "targetMesh"
test shows morph conversion will "work" with cameras and lights - so 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
-
clintonman
- Captain
- Posts: 5659
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
Re: workspace cloth simulation to modelspace vertex animation
Yesterdays update is now official
I was attempting to save and load undo history files. A history file was created but tS refused to load it. This would have been a big improvement over the current techniques of controlling undo in script.
I was attempting to save and load undo history files. A history file was created but tS refused to load it. This would have been a big improvement over the current techniques of controlling undo in script.