Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  


Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - NickE

Pages: [1] 2
Have you ever had a collection of points and wanted a mesh that corresponded to the surface of those points?

In my never ending quest to bring physics (or to effects that look mostly like physics) to Anim8or through scripting, I was working with smoothed particle hydrodynamics (SPH) to simulate fluids.  Using Anim8or points as particles, I was able to write scripts to simulate the fluid action, but had no real way of rendering just points.  The actual SPH script is still in development.

One popular way to extract a surface mesh from a point cloud is to use a technique called Marching Cubes.

Below is an implementation of the the Marching Cubes Algorithm in ASL.  The documentation for usage is within the script itself.

ASL Scripts / SetFacePointIndex method
« on: December 30, 2015, 06:56:01 pm »
I am trying to write an ASL script to essentially do what the Edit->Fix Normals command does.

I am using the technique of picking a face as the standard and testing whether the adjacent faces have the edges (or points) are wound in the same direction, then testing the adjacent to the adjacent, etc.  If I find a face that is wound in the same direction as the previous, I would like to reverse the winding.

I am trying to use the mesh.SetFacePointIndex method to do this:

Code: [Select]
for $k = 0 to $source.GetNumSides($otherface)-1 do {

where $ofptindex[] is the list of the index to the face points in the original order. 

I am working with a cube converted to a mesh as a test. E=EdgeIndex, F1:Face containing edge, F2:Other Face containing edge

Code: [Select]
E:1  F1:0 F2:5
E:2  F1:0 F2:3
E:3  F1:0 F2:4
E:4  F1:0 F2:2
E:5  F1:1 F2:2
E:6  F1:1 F2:4
E:7  F1:1 F2:3
E:8  F1:1 F2:5
E:9  F1:2 F2:4
E:10 F1:2 F2:5
E:11 F1:3 F2:5
E:12 F1:3 F2:4
So, if the original vtxIndex were [4,5,7,6], then the new would be [6,7,5,4].  Unfortunately, the above code results in three extra edges: 6-5, 5-5, and 4-4.

Code: [Select]
E:1  F1:0 F2:5
E:2  F1:0 F2:3
E:3  F1:0 F2:4
E:4  F1:0 F2:2
E:5  F1:1 F2:2
E:6  F1:1 F2:4
E:7  F1:1 F2:3
E:8  F1:1 F2:5
E:9  F1:2 F2:4
E:10 F1:2 F2:5
E:11 F1:3 F2:5
E:12 F1:3 F2:4
E:13 F1:0 F2:0 *
E:14 F1:0 F2:0 *
E:15 F1:0 F2:0 *

I am guessing that the extra edges are left over when the Face Point Index is re-assigned one vertex at a time.

Am I understanding the mesh.SetFacePointIndex method correctly?  What is the proper way to accomplish this?

Thank you!

ASL Scripts / Mesh to Mesh Morphing Hack
« on: May 30, 2015, 10:29:50 am »
Mesh to Mesh Morphing Hack:

The idea behind this technique for mesh to mesh morphing is to have an intermediate shape "between" the starting and ending mesh rather than flowing smoothly from the starting to the ending mesh.  Direct morphing is prohibitive in Anim8or because it would require that one "map" specific areas of one mesh to the other mesh ahead of time.  Theoretically, the mapping could be done with textures, but it would be very slow and laborious.

When I first started playing with this technique, I wrote a script that would convert any mesh into a simple shape like a sphere, cylinder, cube, or any other easily definable shape.  Taking a mesh in Object Mode, creating a new "Morph Target" (Build->Morph Target->New...), then running the script, the points of the mesh are transformed to the desired shape.  In Scene Mode, you can watch the original mesh change into the simple shape and back by adjusting the scene morph target keys.

The next logical extension to this is to take two different meshes and convert each of them to the same sized intermediate shape.  In Scene Mode, you make the first mesh visible and unmorphed, the second mesh invisible and fully morphed, perfectly superimposed.  When the first mesh is fully morphed, make it invisible, make the second mesh visible and proceed to unmorph it back to its original shape.  You get the illusion that the first mesh flowed to the intermediate shape and then flowed into the second mesh.  This looks pretty cool and has many possibilities on its own.

The next logical extension is to try to get the illusion of flowing somewhat more smoothly from the starting mesh to the ending mesh by using scripting that allows the starting mesh to be transformed so that it "shrink wraps" the ending mesh.  Then, the ending mesh is transformed so that it "shrink wraps" the morph of the starting mesh.  After that, the same visibility tricks in Scene Mode are used.  That is how the video in,5165.msg38573.html is done.

A further note on "shrink wrapping" one mesh around another:  I convert the mesh that will be the "wrapper" to a sphere (To_Sphere.txt)that is larger than the target before applying the "shrink wrapping" script (ShrinkWrap_Target.txt).

Finished Works and Works in Progress / Fun with Morphing
« on: May 27, 2015, 08:02:13 pm »
I wrote a script to help morphing from one mesh to another.  It is kind of a hack where one superimposes the ending mesh on the starting mesh and runs the script while in the morph, then does the opposite (the starting on the ending) then uses scene mode visibility tricks.

ASL Scripts / ASL Command render() always crashes Anim8or
« on: February 02, 2015, 10:06:17 am »
Has anyone ever successfully used the render() command in an ASL script?  I have tried to use it off an on since V0.95, but it always crashes Anim8or.

I like to write scripts to do physics simulations, but these type of scripts only work object mode. (See topic,2358.msg25814.html#msg25814 for tricks required to render.)  It would be nice to be able to render the results of the simulations more easily.  Rendering from object mode is not ideal, but perhaps workable.

Another possibility is an Object Mode ASL command to switch to Scene Mode and render and save a particular frame before continuing:  RenderSceneFrame(int Frame,string Filename)

Any thoughts?

If the attached an8 file is opened and switched to Sequence Mode or Scene Mode, Anim8or crashes.  Oddly, if the figure (and object) are imported into another an8 project, the figure can be added to a sequence and work as long as the figure is not modified.  If an attempt is made to alter the figure, Anim8or will crash.

This file was created by a prototype SMD file importer (similar to the BVH importer) that I am writing. This crashing behavior occurs regardless of whether the object is added to the skeleton.  A bare skeleton causes the same behavior.

Any insight would be appreciated.

Thank you,

ASL Scripts / Metric Screws and Nuts Script
« on: October 19, 2014, 01:50:44 pm »
Attached is a script to generate Metric Screws and Nuts.  Currently supported are Socket Head, Button Head, and Hex Head.



ASL Scripts / Allthread Script
« on: October 18, 2014, 07:56:54 pm »
Attached is a parametric script to generate allthread.  The thread profile is based on the ISO Metric Thread Standard.  You can edit the script to give other thread profiles.



ASL Scripts / Involute Gear Script
« on: October 15, 2014, 04:46:05 pm »
I needed some involute gears for a project that I am doing, so I ported this script from the OpenSCAD library.  I could have done the modelling in OpenSCAD, but I like to Anim8 things before I print and build them.  OpenSCAD is a great tool, but gets a bit prolific with the faceting.  Plus, I was able to use Anm8or's new functions capabilities in a practical manner for the first time.

Thank you, Steve for continuing to improve Anim8or!

   I think I may have found another bug (or maybe it is a feature), but it has been around since at least v0.95c. (I tested).

In Figures (and therefore Sequences and Scenes), the 28th child bone does not follow the changes to the 27th bone (the 28th bone's direct parent).  The 28th bone does follow the changes to any earlier bone.

It is strange that this has not been seen before, but I could not find any mention of it.  Maybe I am doing something incorrectly.

I have attached a sample an8 that shows this behavior in the figure (and sequence, and scene).  I have made several similar figures and each shows the same behavior.

What do you think?

Thank you!

Steve: Upon further testing, it appears to be related to having a namedobject attached to the bones.  When I delete the objects attached to the 27th bone, the 28th bone responds correctly, but the 29th now does not respond to the 28th until I delete the object attached to it (and so on).

In Object Editor, if a textured mesh is double-clicked to bring up the "Mesh Parameters" dialog box, when the "OK" button is clicked, the mesh loses references to its materials.  The UV coordinates are not lost, but the mesh's face references to individual materials are lost.

I first noticed this in Build 1086 and it persists in Build 1088.

A close look at the an8 file before and after shows that the "materiallist" has had the materials removed (leaving only the {" -- default --"}. Further, in the "faces" section, individual references to the materials are set to zero.  The materials are still in the object, just no longer associated with the mesh.

Thank you for continuing development on Anim8or.  I have been using it continuously since 2007.

I am especially looking forward to more ASL development.

ASL Scripts / BVH File Import into Anim8or
« on: March 20, 2011, 09:07:09 am »
Attached below is a working BVH file import program for Anim8or.  For those that are not familiar, BVH is a motion capture file format that describes a skeleton made up of joints (points) and a timeline of XYZ Euler angles that describe the rotation of the joints.  See for an overview of the description.

Anim8or differs widely from the BVH file format in that Anim8or's Figure Mode uses bones for the skeleton where the orientation of the bones is described by a quaternion.  The Sequence Mode uses XYZ Euler angles to describe the change in orientation of the bone relative to the initial orientation of the bone set in Figure Mode.  In Anim8or, the rotation of the bones, when unconstrained, goes from -360 to +360 degrees.  Conversion to and from quaternions and Euler angles requires the use of trigonometric functions.  The atan2 function, for example, goes from -180 to 180 degrees.  A small change in angle in the BVH file across one of these trigonometric limits can trigger Anim8or to flip the bone 180 degrees.

Anim8or has bugs in calculating the frames between keys.  Sometimes it will interpolate wildly. 

Scene Mode has a bug (or maybe it is intentional) where the root bone orientation is completely ignored.  Since the root bone orientation is the orientation of the entire figure, the bug is overcome by keying the root bone orientation into the orientation controller of the figure in Scene Mode.

Sequence Mode has no translational motion abilities, so the BVH translation is keyed into the position controller of the figure in Scene Mode.

The program can currently read in a BVH file and create an Anim8or project file (an8).  This means it generates a skeleton in Figure Mode, a sequence that uses the skeleton, and a scene containing the figure and the sequence.  It keys the orientation and position for the figure directly in scene mode.  For reference, the program also generates a simple line object in the same position as the skeleton.  I found this useful for getting the size and posture of the object to be skinned close.

BVH files sometimes have issues as well.  Most of the Carnegie-Mellon BVH repository files have zero-offset joints.  This introduces some small error when these zero-offset joints have rotations.  Many BVH files have skeletons of very small scale.  I have added a scaling function to the program to allow you to modify the overall scale of the skeleton.  Many of the BVH file have frames-per-second (FPS) of 30, 60, or 120.  I have added the ability to change the FPS.  Please realize that the recalculation of the FPS requires computational interpolation of the motion.  I am using simple linear interpolation in that calculation that introduces some error.  To reduce the number of keys (to reduce file loading time), the program allows you to choose how often to key the original motion as well as put in a tolerance factor to not key when there is change less than this tolerance factor.  In BVH files that have a lot of fast motion, you will need to key more often.  One martial arts BVH file I tested required every frame to be keyed or significant motion error occurred.  Loading that 650 frame Anim8or file takes about 4 minutes on my computer.  Some BVH files have a first frame that is zero motion (original skeleton pose).  There is an option in the program to skip this frame in the sequence and scene.

Some minor tweaking in Anim8or is often necessary due to the fact that trigonometric functions change rapidly near the limits.  This relatively easy to do.  A BVH file I tested that had a runner turning a 90 degree turn worked fine except the right upper arm was slightly off.  A small adjustment in Figure Mode was all that was necessary.

While the program works pretty well for what it does, the results of the program are not readily portable or incorporated into existing projects.  The final product is in Scene Mode.

The program is written in VB6, so you might need to download some runtime libraries if your computer does not already have them.

Please play with the program and give me your feedback and ideas on how to make this more useful to Anim8or users.

Some hasty examples done with figures from BobIt's figure plugin are posted on youtube:

Chinese Martial Arts:[/youtube]]http://www.

Hooker Walk:[/youtube]]http://www.

Thank you.

ASL Scripts / Simple fluid simulation
« on: June 12, 2009, 08:34:38 pm »
I have been experimenting with trying to simulate fluids using Anim8or:[/youtube]]http://www.

The water is a single mesh.  No morph targets were used.  The scene contains only a single copy of the water mesh object and the container mesh object.

Any guesses on how it was done?

ASL Scripts / File Read Function(s)
« on: July 30, 2008, 11:45:00 am »
If I could beg for a single ASL update for the next preview, it would be member function(s).

Here's why:

It would be a work-around for most of the other items on the scripting wish-list. 
(1) One could read and write Anim8or project files allowing one to do particle animation, fluid dynamics, and physics by generating objects and morph targets and scene object placement and controller values, and so much more!
(2) One could simulate parameter passing between scripts
(3) Custom import filters

Once a ability exists, the only thing needed to have robust access to all of Anim8or's modes would be the ability to trigger another script's execution from within a script.  (more begging here)  Even the simplest implementation would be sufficient: completely terminate the original script and begin execution of the requested script.  The file read/write functions can be used to simulate user defined functions ability.

Those two additional functions - and script.execute - would open the door to the development of libraries of script functions like physics, walk sequences, mouth movement, lip synch, etc.

Thank you!

ASL Scripts / PrinttoString file function
« on: July 21, 2008, 06:46:59 pm »
I cannot get the PrinttoString file function to work.  The following test script:
Code: [Select]
string $fname;
file $output;


string $tostring;
int $i;


$output.PrintToString($tostring,"test: %d",$i);


Gives "undefined member reference 'PrintToString'" error.  Interestingly, the line:
Code: [Select]
PrintToString($tostring,"test: %d",$i);does not give an error, but returns an empty string.

Your thoughts?

Pages: [1] 2