Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

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.

Messages - NickE

Pages: 1 ... 5 6 [7] 8 9 ... 12
91
ASL Scripts / Re: Simple fluid simulation
« on: June 13, 2009, 09:47:24 am »
It turns out that Anim8or is full of surprises.  Did you know that object scripts run asynchronously to the rest of the program, and that scripts continue to run even if you change from object mode to scene mode?  Neither did I, until recently.

I have been playing with writing scripts to simulate fluids and was watching the evolving fluid simulation in object mode.  I was trying to figure out how I could possibly render the simulation.  The possibilities were:

1) Calculate all the frames as separate objects and manually (or by outside program) insert them into a scene, like you have to do to insert video into an animation.  The problem was that it was an enormous number of objects (24 per second), each with thousands of points.  The file would take forever to load and be gigantic!  I never tried that method.

2) Instead of calculating the fluid dynamics on a mesh, use lots of copies of a very small objects in way similar to the way that Terranim8or does particle effects with fire.  That requires an outside program to create an Anim8or file that would be very large with thousands of keyed elements per frame.  I haven't tried that method either.

3) Calculate a single frame at a time on the object and render that in object mode.  I tried to put the render() command into a script, but it crashes Anim8or every time. (I need to report that bug).  That would be a very manually laborious process.

4) Calculate a single frame at a time on the object and render that in scene mode.  Well, that would be as bad as (3) above, but I happened to change into scene mode while a script was running...Behold! the object changed in scene mode as the script continued.  By timing how long Anim8or took to render a frame, and by putting a delay loop in the script so that the next frame is not calculated until the previous frame is rendered, and by post-processing to remove duplicate frames, I was able to produce a fluid simulation that was completely done in Anim8or!

The interesting part is that since this functionality already exists in Anim8or, only a tiny change in the program is required for Steve to make this functionality formal.

I would like to request that an "object script" controller be added with access to the scene variables of time and frame.  If this were done, the full range of physics would be possible in Anim8or!

----

I have attached the ripple script and the project used to generate the above animation.  This test script requires a plane of 100 by 100 points, with the points numbered sequentially.  I will be posting a more complete version that will work with generic meshes soon.  It will be able to do non-planes (spheres, arbitrary solids, even cloth).

92
ASL Scripts / Re: Centre hotpoint to centre of mesh script request
« on: June 13, 2009, 09:15:06 am »
I'm pretty sure I could write a script to do this, but I do not understand what you mean.  What is the "hotpoint"?  Would just the point be centered or the entire mesh?

93
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.com/watch?v=nRbhXJUqyC4[/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?

94
Anim8or v0.98 Discussion Forum / Re: anim8or program pooping out?
« on: May 24, 2009, 10:46:53 am »
I have had this problem before, but the issue was the memory stick wearing out, not the Anim8tor program.

95
General Anim8or Forum / Re: Help with correcting orientation problems
« on: April 30, 2009, 06:47:24 pm »
I would suggest using quaternions directly rather than converting the Roll-Pitch-Yaw to a quaternion.  See the wikipedia page:

http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation

and this page:

http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/
Be sure to look at the sidebar "Quaternion Physical Interpretation".


96
General Anim8or Forum / Re: rescale issue
« on: February 09, 2009, 09:03:22 pm »
The scaling could probably be done with a script to scale each individual object and keep the relationships between the objects mathematically.  I'll look into it.

97
ASL Scripts / Re: script request-copy along a spline
« on: January 31, 2009, 08:26:16 am »
My apologies.  I though you were referring to the web page tutorial on animating tank treads at:

http://www.tranceportsoftware.com/anim8orstuff/

98
ASL Scripts / Re: script request-copy along a spline
« on: January 30, 2009, 06:53:08 pm »
It is not a video tutorial, it is a web page.

99
Quote
The upper animation is made by sliding the "tape" in scene mode, the lower one is made with a morph target and a controller (by the way, once you set a controller for a morph target anim8or won't allow you editing it any more, at least it does so for me - clicking on its track doesn't pop up the edit key dialog).

To be able to edit the morph controller, you can click on the track for the controller, then bring up the key graph editor (the icon that looks like a graph) and double-click on the name.  That will bring up the "Key Value Editor" dialog box that you are referencing above.

I hope that helps.


100
ASL Scripts / Re: Magnet Tool
« on: November 09, 2008, 09:36:10 am »
Francesco,
Thank you for the diagram.  That helps me understand what you are attempting.

As far as I can tell, an object's position and orientation are a combination of three factors:  the raw point coordinates retrieved by the GetPoints() function, the Location (loc), and the Orientation.  When you move or rotate a whole object in the object editor, you are only changing the Location and the Orientation.  When you move a point, you are changing the raw point coordinates relative to the current Location and Orientation.   Whenever you need to know how one object's points relate to another object's points, both objects must be in the same coordinate system. 

Below is some code that moves two meshes into the same coordinate system.
Code: [Select]
file $output;
string $fname;
$fname="$console";
$output.open($fname,"w");

object $curObject;
shape $shape, $shapes[0], $childShapes[1];
shape $source,$target;

int $i,$j,$havesource,$havetarget;
int $ii,$jj,$kk;

int $sourcenumpts,$sourcenumfaces,$sourcenumedges;
point3 $p,$sourcemin,$sourcemax,$sourcecenter,$sourceloc;
quaternion $sourceorientation,$zeroor;
float4x4 $sourcerotmat;


point3 $zeropoint;

float $sourcedepth,$sourcedepthoffset;

int $targetnumpts,$targetnumfaces,$targetnumedges;
point3 $targetmin,$targetmax,$targetcenter,$targetloc;
quaternion $targetorientation;
float4x4 $targetrotmat;

$zeropoint.x=0.0;
$zeropoint.y=0.0;
$zeropoint.z=0.0;
$zeroor.x=0.0;
$zeroor.y=0.0;
$zeroor.z=0.0;
$zeroor.w=1.0;

$curObject = project.curObject;
$curObject.GetShapes($childShapes);
$shapes.size = 0;
while ($childShapes.size > 0)
    $shapes.push($childShapes.pop());

while ($shapes.size > 0) {
    $shape = $shapes.pop();

    if ($shape.GetKind() == SHAPE_KIND_MESH && $shape.name == "source")
    {
       $source=$shape;
       $sourcenumpts=$source.GetNumPoints();
       $sourcenumfaces=$source.GetNumFaces();
       $sourcenumedges=$source.GetNumEdges();
       $sourceloc=$source.loc;
       $sourceorientation=$source.orientation;
       $sourcerotmat=toFloat4x4($sourceorientation);
       $havesource=1;
    }
   
    if ($shape.GetKind() == SHAPE_KIND_MESH && $shape.name == "target")
    {
       $target=$shape;
       $targetnumpts=$target.GetNumPoints();
       $targetnumfaces=$target.GetNumFaces();
       $targetnumedges=$target.GetNumEdges();
       $targetloc=$target.loc;
       $targetorientation=$target.orientation;
       $targetrotmat=toFloat4x4($targetorientation);
       $havetarget=1;
    }
}

if ($havesource==1 && $havetarget==1)
{

   $output.print("Source Before:\n");
   $output.print("Loc: (%0.2f,%0.2f,%0.2f)\n",$source.loc.x,$source.loc.y,$source.loc.z);
   $output.print("Center: (%0.2f,%0.2f,%0.2f)\n",$sourcecenter.x,$sourcecenter.y,$sourcecenter.z);
   $output.print("Min: (%0.2f,%0.2f,%0.2f) Max: (%0.2f,%0.2f,%0.2f)\n",$sourcemin.x,$sourcemin.y,$sourcemin.z,$sourcemax.x,$sourcemax.y,$sourcemax.z);
   $output.print("Orientation (%0.2f,%0.2f,%0.2f,%0.2f)\n",$sourceorientation.x,$sourceorientation.y,$sourceorientation.z,$sourceorientation.w);



   /* apply orientation and location to shapes */
   for $ii = 0 to $sourcenumpts-1 do
   {
     $p=$source.GetPoint($ii);
     $p=$sourcerotmat.Project($p)+$source.loc;
     $source.SetPoint($ii,$p);
   }
   $source.loc=$zeropoint;
   $source.orientation=$zeroor;
   
   for $ii = 0 to $targetnumpts-1 do
   {
     $p=$target.GetPoint($ii);
     $p=$targetrotmat.Project($p)+$target.loc;
     $target.SetPoint($ii,$p);
   }
   $target.loc=$zeropoint;
   $target.orientation=$zeroor;

   /* get source stats */
   $sourcemin.x=10000;
   $sourcemin.y=10000;
   $sourcemin.z=10000;
   $sourcemax.x=-10000;
   $sourcemax.y=-10000;
   $sourcemax.z=-10000;

   for $i=0 to $sourcenumpts-1 do
   {
    $p=$source.GetPoint($i);
    if ($p.x < $sourcemin.x) $sourcemin.x=$p.x;
    if ($p.y < $sourcemin.y) $sourcemin.y=$p.y;
    if ($p.z < $sourcemin.z) $sourcemin.z=$p.z;
    if ($p.x > $sourcemax.x) $sourcemax.x=$p.x;
    if ($p.y > $sourcemax.y) $sourcemax.y=$p.y;
    if ($p.z > $sourcemax.z) $sourcemax.z=$p.z;
   }

   $sourcecenter.x = 0.5 * ($sourcemax.x + $sourcemin.x);
   $sourcecenter.y = 0.5 * ($sourcemax.y + $sourcemin.y);
   $sourcecenter.z = 0.5 * ($sourcemax.z + $sourcemin.z);

   $output.print("Source:\n");
   $output.print("Points: %d, Faces: %d, Edges: %d\n",$sourcenumpts,$sourcenumfaces,$sourcenumedges);
   $output.print("Loc: (%0.2f,%0.2f,%0.2f)\n",$source.loc.x,$source.loc.y,$source.loc.z);
   $output.print("Center: (%0.2f,%0.2f,%0.2f)\n",$sourcecenter.x,$sourcecenter.y,$sourcecenter.z);
   $output.print("Min: (%0.2f,%0.2f,%0.2f) Max: (%0.2f,%0.2f,%0.2f)\n",$sourcemin.x,$sourcemin.y,$sourcemin.z,$sourcemax.x,$sourcemax.y,$sourcemax.z);
   $output.print("Orientation (%0.2f,%0.2f,%0.2f,%0.2f)\n",$sourceorientation.x,$sourceorientation.y,$sourceorientation.z,$sourceorientation.w);


   /* get target stats */
   $targetmin.x=10000;
   $targetmin.y=10000;
   $targetmin.z=10000;
   $targetmax.x=-10000;
   $targetmax.y=-10000;
   $targetmax.z=-10000;

   for $i=0 to $targetnumpts-1 do
   {
    $p=$target.GetPoint($i);
    if ($p.x < $targetmin.x) $targetmin.x=$p.x;
    if ($p.y < $targetmin.y) $targetmin.y=$p.y;
    if ($p.z < $targetmin.z) $targetmin.z=$p.z;
    if ($p.x > $targetmax.x) $targetmax.x=$p.x;
    if ($p.y > $targetmax.y) $targetmax.y=$p.y;
    if ($p.z > $targetmax.z) $targetmax.z=$p.z;
   }

   $targetcenter.x = 0.5 * ($targetmax.x + $targetmin.x);
   $targetcenter.y = 0.5 * ($targetmax.y + $targetmin.y);
   $targetcenter.z = 0.5 * ($targetmax.z + $targetmin.z);

   $output.print("Target:\n");
   $output.print("Points: %d, Faces: %d, Edges: %d\n",$targetnumpts,$targetnumfaces,$targetnumedges);
   $output.print("Loc: (%0.2f,%0.2f,%0.2f)\n",$target.loc.x,$target.loc.y,$target.loc.z);
   $output.print("Center: (%0.2f,%0.2f,%0.2f)\n",$targetcenter.x,$targetcenter.y,$targetcenter.z);
   $output.print("Min: (%0.2f,%0.2f,%0.2f) Max: (%0.2f,%0.2f,%0.2f)\n",$targetmin.x,$targetmin.y,$targetmin.z,$targetmax.x,$targetmax.y,$targetmax.z);
   $output.print("Orientation (%0.2f,%0.2f,%0.2f,%0.2f)\n",$targetorientation.x,$targetorientation.y,$targetorientation.z,$targetorientation.w);


} else {
   $output.print("No source and/or target\n");
} /* end of have source or target if */
$output.close;

101
ASL Scripts / Re: Magnet Tool
« on: November 08, 2008, 03:31:54 pm »
You can access and change the object's pivot position in ASL.  It is referred to as "orientation" as a quaternion type.  You can construct a new quaternion of the rotation you desire and apply it to the whole object or you can can use the "toFloat4x4" and "Project" methods to change the orientation of the object on a point-by-point basis.   See the chain maker script or the copy source mesh to target mesh scripts for examples of how the orientation can be manipulated.

102
ASL Scripts / Re: data storage in/during controller scripts
« on: October 10, 2008, 06:33:30 pm »
You can access an element's position and orientation for each frame from a script.  You can create a dummy element to hold values between frames.  Between these two things, you can calculate rotational and translational velocities and acceleration.

It would be helpful if you could describe what you are trying to do.   There are techniques for reading the position of one element to set the other.  For example, one can use a controller script to control the rotation of tires, another script to move the vehicle proportionally to the rotation of the car, and yet another to move the camera with the car, and so on.

103
General Anim8or Forum / Re: Trees
« on: October 06, 2008, 08:51:22 pm »
Mongoose on the old Anim8or.org had posted a free program called TreeMaker that had been abandoned by its writer.  It allows one to make low (or high) poly trees, bushes, flowers, etc.  I've used it a bit.

104
General Anim8or Forum / Re: Exporting in roblox format (.mesh)
« on: October 05, 2008, 07:00:40 pm »
Are you using the latest version?  I had no problem with the script in version 0.97d.  Version 0.97b had a bug that broke export scripts.

I am not familiar with roblox, but the script did write a text file with a .mesh extension containing data in the format specified in the script.

105
General Anim8or Forum / Re: Bug in chain maker (script)
« on: September 28, 2008, 01:42:51 pm »
You get that error if you use any version of Animator before 0.97b.  This script ONLY works with version 0.97b and later.

Pages: 1 ... 5 6 [7] 8 9 ... 12