Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

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 - CobraSpectre

Pages: [1]
1
Anim8or v0.98 Discussion Forum / Bad meshdata from subdivision?
« on: September 26, 2008, 07:05:06 am »
I've been working on the mirroring script so that it supports subdivision elements as its source. In order to do this I've changed the code so that it pulls point data from a meshdata and not a shape.

At this point, the script works fine, until it doesn't. When using a subd it will occasionally get an error of "*** Out of bounds memory reference in script ***". Based on the line errors it appears to happen on commands like $M.GetNumSides().

I've never had it fail on a mesh or a mesh > subd > mesh.

The most reliable way to get it to error is to have a subd, select some or all points, then keep moving or rotating them to different positions. Eventually, it causes an error.

Using .97d. Remember, the subd has to be named "mesh01"

Code: [Select]
#command("object");

/* Y axis mesh mirror, USE AT YOUR OWN RISK */

shape $S, $NewS;
meshdata $M;
attribute $Attr;
int $i, $j, $sides;
point3 $pointedit;
quaternion $rotation;

$S = project.curObject.LookupShape("mesh01"); /*get the original shape */

if ($S != NULL) {

$Attr = project.curObject.LookupAttribute("STOP");

/* create a copy */
$NewS = mesh();


while ($Attr == NULL) {

  $M = $S.GetMeshData();

  $NewS.Open();

  /* copy the points and faces */
  for $i = 0 to $NewS.GetNumPoints()-1 do {
    $NewS.SetPointSelected($i, true);
  }
  $NewS.DeleteSelectedPoints();

  /* correct orientaton */
  $rotation = $S.orientation;
  $rotation.y = -$rotation.y;
  $rotation.z = -$rotation.z;
  $NewS.orientation = $rotation;

  for $i = 0 to $M.GetNumPoints()-1 do {
    $pointedit = $M.GetPoint($i);
    $pointedit.x = -$pointedit.x; /* mirror around Y axis, make x points negative */
    $NewS.AddPoint($pointedit);
  }

  for $i = 0 to $M.GetNumFaces()-1 do {
    $sides = $M.GetNumSides($i);
    $NewS.OpenFace(0, 0);
    for $j = 0 to $M.GetNumSides($i)-1 do {
      $NewS.VertexN($M.GetFacePointIndex($i, $sides-1-$j));
    }
    $NewS.CloseFace();
  }

    $NewS.Close();

  /* check for attribute to stop the cycle */
  $Attr = project.curObject.LookupAttribute("STOP");
}

}


2
ASL Scripts / EXPERIMENTAL Mirroring Script
« on: September 24, 2008, 10:37:09 pm »
First, I have to thank Kubajzz for finding this 'feature' in anim8or. The code below is obviously built on his code.

Second, this is still highly experimental, it causes my CPU to go to 100% utilization which may cause problems and random restarts due to heat. Use at your own risk.

Notes:
  • This attempts to create real time mirroring for modeling. A new mesh is created that is mirrored around the X axis. Point edits, and object rotation carry over to the mirrored mesh. Materials work depending on situation, texture coordinates have not been tested.
  • Adding the open and close to the mesh at each cycle prevents RAM use from going out of control while removing the condition to update. RAM and page file may still go up, please monitor them from the Task Manager.
  • It appears to be possible to catch the mesh mid-update and it may not draw correctly. Interface workaround: if you are using the one display or four display pressing "1" or "4" respectively will force anim8or to redraw.
  • Either mesh can be moved without affecting the other. The mirrored mesh can be added to a group without a problem and can be independently rotated.
  • The script looks for a mesh named "mesh01" to mirror.
  • The script exits when there is an attribute named "STOP".
  • Exiting anim8or without stopping the script causes anim8or to quit with an error.
  • When switching to other modes CPU stays at full, CPU drops when a menu is opened.
  • Running this script prevents other scripts from running.

There's still more that can be done to improve the script. I'm hoping Anim8or can improve to make this easier to work with.

Update:
Correct Normals
Code: [Select]
#command("object");

/* X axis mesh mirror, USE AT YOUR OWN RISK */

shape $S, $NewS;
attribute $Attr;
int $i, $j;
point3 $pointedit;
quaternion $rotedit;

$S = project.curObject.LookupShape("mesh01"); /*get the original shape */

if ($S != NULL) {

$Attr = project.curObject.LookupAttribute("STOP");

/* create a copy */
$NewS = mesh();


while ($Attr == NULL) {

  $NewS.Open();

  /* copy the points and faces */
  for $i = 0 to $NewS.GetNumPoints()-1 do {
    $NewS.SetPointSelected($i, true);
  }
  $NewS.DeleteSelectedPoints();

  /* correct orientaton */
  $rotedit = $S.orientation;
  $rotedit.y = -$rotedit.y;
  $rotedit.z = -$rotedit.z;
  $NewS.orientation = $rotedit;

  for $i = 0 to $S.GetNumPoints()-1 do {
    $pointedit = $S.GetPoint($i);
    $pointedit.x = -$pointedit.x; /* mirror around X axis, invert x values*/
    $NewS.AddPoint($pointedit);
  }

  for $i = 0 to $S.GetNumFaces()-1 do {
    $NewS.OpenFace(0, 0);
    for $j = 0 to $S.GetNumSides($i)-1 do {
      $NewS.VertexN($S.GetFacePointIndex($i, $S.GetNumSides($i)-1-$j));
    }
    $NewS.CloseFace();
  }

    $NewS.Close();

  /* check for attribute to stop the cycle */
  $Attr = project.curObject.LookupAttribute("STOP");
}

}

3
General Anim8or Forum / GPU Gems available free online
« on: May 14, 2008, 09:32:32 pm »
Nvidia has put GPU Gems online in HTML form. It has lots of great articles about real time graphic programming and techniques.

Read it here

You may also be interested in knowing that Steve contributed chapter 20 Texture Bombing.

4
General Anim8or Forum / An8zip - texture packager for Anim8or
« on: May 08, 2008, 03:43:49 am »
An8zip is a stand alone utility that searches an anim8or file for the images that are used and then packages the anim8or file and images into a zip.

An8zip does not modify or write to the anim8or file, though you should still have a backup. If not all images were found, try resaving the anim8or file in Anim8or.

Download it, try it out, and please report any problems. I've only tested with Windows XP.


Known Issues:

Only the file location saved in the anim8or file is searched.

Images that have the same filename but a different directory are not handled. The image name must be changed.

Directory structure is not preserved.

Windows 95/98/ME may require w9xpopen.exe to run.

Download from Anim8or.org from the attachments of the first post or try this direct link to An8zip_v1.zip

5
Anim8or v0.98 Discussion Forum / Bug Report
« on: March 24, 2008, 03:11:56 pm »
Here are the bugs I've found so far with .97a Preview with ART rendering.

Common settings:
.97a Preview
ART Renderer
No light attributes set

1 Sample rendering
If you choose 1 as the number of AA samples and render with AA, Anim8or will freeze and crash. It will render if AA is unchecked. Based on the number of rays, no AA always uses 1 sample per pixel.

Local light rendering
With "Show Camera" enabled, a local light rendered from any view other than camera01 will not show any light cast. Disabling "Show Camera" allows it to be rendered from other views/cameras.

Local lights and Spot lights ignore radius

Crash on depth channel
Rendering with a depth channel causes anim8or to crash.

Alpha Channel
If an alpha channel is rendered the image will render solid black.

Horizontal Lines in render
This is a bug I'm having difficulty reproducing. Sometimes horizontal artifacts that are similar to volume shadow or Z fighting errors will appear. I've only seen it with 4 AA samples using raytraced specular glossy and reflection materials.

6
Anim8or v0.98 Discussion Forum / ART Light Attributes and AA
« on: March 20, 2008, 09:23:47 pm »
I was testing out the new light attributes in ART. The jittered and multijittered lights look like monte carlo even if the lights are set to ordered. Regular looks like ordered. Edit: Sometimes (with the right settings) regular can look similar to ordered but they don't look the same.

The other problem is that a light's shadow softness and noise can look very different between ART and scanline.

Can we have more details as to how the new AA options compare? And how the samples work and how they are different than scanline?

The new Movie Image is nice and works well.

7
ASL Scripts / Find Distance Between Two Points Script
« on: February 14, 2008, 11:56:28 pm »
One feature that I have wanted in Anim8or was the ability to measure the distance between points. I thought it would be easy, it was, getting that number out to the user isn't.

For starters, there isn't a debug number out. So while coding this I was creating parametric spheres to figure out what was going on with my code. The easy way to get a float out would be to use an export script or create a parametric object. I considered an export, except that it would be in the export menu and you have to find the file. I really didn't want a parametric object because it messes with your object and the undo.

I figured a material would be a good option. In the material toolbar, you can keep it there until you want to get rid of it. Compare several measures if necessary. Except you can only name a material with a string, not a float. Also there is no inbuilt function to convert from float to string.

I end up coding my own my own converter. It may not use the best method, but it works. However, it does have some problems with accuracy. Some numbers will evaluate out with trailing 0s or 9s and then pseudorandom 'noise' numbers. Others are just fine. During testing I found that in general only the first eight digits would be accurate, after that the float has noise. Also really big numbers tend to have problems.

Anim8or might be blame. For example, you can't input a floating point number that would have a problem into a location or length without it being rounded to five digit places or switching to Xe+Y format. I don't want to just say the problem is Anim8or, because I really can't tell what's going on.

The part which finds the selected points is based on the OBJ export script example by Steve. I could not figure out how to use shapes from just the ASL spec. I learned you can crash Anim8or during a compile test with a type mismatch in GetPointSelected.

The script works using a selection of two points. You can use points on the same mesh or different meshes. It works with meshes in groups. Subdivision and path points cannot be used. If more or less than 2 points are selected, it will result in an error output.

Try it out, give some feedback on usage. Tell me what you think of the script code.

Code: [Select]
#command("object");

/* Two_Point_Distance.a8s
 * Version 1.0
 * Released: 14-Feb-08
 */

/* This script finds the distance between two selected points.
 * A new material is created to display the distance.
 *
 * To use, select two points of any mesh or meshes
 * and run this script. The distance is output as
 * the name of an object material. Distance is
 * in Anim8or units.
 *
 * Points can be of the same mesh, unjoined meshes, or groups.
 * Paths and subdivision objects cannot be used.
 *
 * Very large numbers may not evaluated properly,
 * materials created that start with "ERR:" may not be accurate.
 *
 * If more or less than two points are selected, a material
 * will be created with the name "Select 2 points".
 *
 * Portion of code based on export_obj_plugin.a8s,
 * Copyright 2006 R. Steven Glanville.
 */

/* Declare working variables for output needed in distance */

float $numOut;
int $UserErrFlag;

/* Start - Find distance between two selected points */

shape $shape, $shapes[1], $childShapes[1];
meshdata $mdata;
int $numPoints;
int $k;
point3 $point;
float4x4 $transformMatrix;
point3 $p[0];

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

while ($shapes.size > 0 && $p.size <= 2) {
   $shape = $shapes.pop();
   if ($shape.GetKind() == SHAPE_KIND_GROUP) {
      $shape.GetShapes($childShapes);
      while ($childShapes.size > 0) {
         $shapes.push($childShapes.pop());
      }
   }
   else if ($shape.GetKind() == SHAPE_KIND_SPHERE ||
            $shape.GetKind() == SHAPE_KIND_RECT_SOLID ||
            $shape.GetKind() == SHAPE_KIND_CYLINDER ||
            $shape.GetKind() == SHAPE_KIND_PARAM_PLUGIN ||
            $shape.GetKind() == SHAPE_KIND_PATH ||
            $shape.GetKind() == SHAPE_KIND_SUBDIVISION ||
            $shape.GetKind() == SHAPE_KIND_MODIFIER ||
            $shape.GetKind() == SHAPE_KIND_TEXT)
   {
   /* Point data cannot be processed, must be excluded */
   }
   else {
      $mdata = $shape.GetMeshData();
      $transformMatrix = $shape.GetGlobalTransform();
      $numPoints = $mdata.GetNumPoints();
      for $k = 0 to $numPoints - 1 do {
         $point = $mdata.GetPoint($k);
         if ($shape.GetPointSelected($k) == true) {
            $point = $transformMatrix.Project($point); /* Find global location */
            $p.push($point);
         }
      }
   }
}

if ($p.size == 2) {
   /* Euclidean distance */
   $numOut = sqrt(pow($p[0].x - $p[1].x, 2) + pow($p[0].y - $p[1].y, 2) + pow($p[0].z - $p[1].z, 2));
}

else
   $UserErrFlag = true;


/* End - Find distance between two selected points */


/* Start - Float to material name */

float $numEval;
int $digitArray[0];
int $DotLoc; /* number of places to left of decimal */
string $textout;
string $message;
int $i;
int $j;
int $totalnum;
int $NegFlag;
int $ErrFlag;
string $ErrorText;
string $UserErrorText;

$textout = "";
$message = "Dist: "; /* output string leader */

/* Set $numOut here to force its value. Use to test float to string conversion. */
/* $numOut = 5; */
/* $UserErrFlag = false */

/* Handle negative numbers */
if ($numOut < 0) {
   $NegFlag = true;
   $numOut = abs($numOut);
}


/* Error setup */
$ErrorText = "ERR: ";
$UserErrorText = "Select 2 points";

if ($numOut > 10000000) /* very large numbers do not convert to string properly */
   $ErrFlag = true;

if ($UserErrFlag == true)
   $numOut = 0;


/* determine $DotLoc */
$numEval = $numOut;
while($numEval >= 1 && $numOut >= 1){
   $numEval = $numEval / 10;
   $DotLoc = $DotLoc + 1;
}
$totalnum = $DotLoc;


/* Handle 0 case */
if ($numOut == 0) {
   $digitArray.push(0);
   $totalnum = 1;
}


/* Add numbers to left of decimal to array */
$numEval = $numOut;
if ($DotLoc >= 1) {
   $numEval = $numEval / pow(10, $DotLoc-1);
   for $i = 0 to ($DotLoc-1) do {
      $j = $numEval;
      $digitArray.push($j);
      $numEval = $numEval - $j;
      $numEval = $numEval * 10;
   }
}

/* Add numbers to right of decimal to array */
if ($numOut < 1)
   $numEval = $numEval * 10;
while ($numEval != 0 && $totalnum <= 23) { /* prevent endless loop */
   $j = $numEval;
   $digitArray.push($j);
   $numEval = $numEval - $j;
   $numEval = $numEval * 10;
   $totalnum = $totalnum + 1;
}


/* Create strings for building number output */
string $str0; $str0 = "0";
string $str1; $str1 = "1";
string $str2; $str2 = "2";
string $str3; $str3 = "3";
string $str4; $str4 = "4";
string $str5; $str5 = "5";
string $str6; $str6 = "6";
string $str7; $str7 = "7";
string $str8; $str8 = "8";
string $str9; $str9 = "9";
string $strDot; $strDot = ".";
string $strNeg; $strNeg = "-";

if ($NegFlag == true)
   $textout = $textout + $strNeg;

/* Prevent excessive float output */
/* limit output to 8 digits or $DotLoc, whichever is greater */
if ($DotLoc > 8) /* eight appears to be max float accuracy */
   $i = $DotLoc;
else
   $i = 8; /* eight appears to be max float accuracy */
$totalnum = clamp($totalnum, 0, $i);

/* Truncate zeros */
if ($totalnum != $DotLoc && $digitArray[0] != 0) {
   $i = $totalnum - 1;
   $j = $digitArray[$i];
   while ($j == 0 && $i >= $DotLoc) {
      $i = $i - 1;     
      $j = $digitArray[$i];
   }
   $totalnum = $i + 1;
}


/* Build output */
for $i = 0 to $totalnum-1 do {

   if ($i == $DotLoc && $numOut != 0)
      $textout = $textout + $strDot;

   $j = $digitArray[$i];

   if ($j == 0)
      $textout = $textout + $str0;

   if ($j == 1)
      $textout = $textout + $str1;

   if ($j == 2)
      $textout = $textout + $str2;

   if ($j == 3)
      $textout = $textout + $str3;

   if ($j == 4)
      $textout = $textout + $str4;

   if ($j == 5)
      $textout = $textout + $str5;

   if ($j == 6)
      $textout = $textout + $str6;

   if ($j == 7)
      $textout = $textout + $str7;

   if ($j == 8)
      $textout = $textout + $str8;

   if ($j == 9)
      $textout = $textout + $str9;
}


/* Create material */
material $material;
$material = project.curObject.NewMaterial("must be unused"); /* Seriously... */
$material.SetDiffuseColor((0, 1, 0)); /* Set normal color */

if ($ErrFlag == true) {
   $textout = $ErrorText + $textout;
   $material.SetDiffuseColor((1, 1, 0)); /* Set error output color */
}
else
   $textout = $message + $textout;

if ($UserErrFlag == true) {
   $textout = $UserErrorText;
   $material.SetDiffuseColor((1, 0, 0)); /* Set user error output color */
}

$material.name = $textout;

/* End - Float to material name */


Crosspost to Anim8or.org

8
Anim8or v0.98 Discussion Forum / Key Frames - Moving and Adding problems
« on: December 22, 2007, 06:43:22 am »
I was working with Anim8or trying to do some basic animation and started hitting some problems I've had before but didn't explore in detail.

Key frames don't behave in an expected way, which is making animation cumbersome and difficult. My tests were just using position animation.

The first problem is trying to move a key frame. If you want to change what frame an action occurs on, such as moving it forward or backwards a few frames, your only real option is Edit > Frames > Insert Selected; Delete Selected. Which works, but isn't very efficient for working out timing or moving a group of frames.

When I try a copy/paste, the key frame spline knots get reset. If you have the knots set with the Graph Editor, a copy/paste or cut/paste moves them back to default positions, regardless of Key Type.

Ideas: Fix copy/paste
Make key frames dragable in the Track Window
Add to Key Position Editor a box like 'Frame' but instead of changing the current frame, it would move the key
Short cut keys for moving individual keys

The second problem is adding a new key frame between two existing keys. Especially when the knots are set, a new key frame will change the spline path and move the knots. If you already have curves set up and then have to add a new key, it makes it a lot of work. Best behavior would probably be to not change the surrounding knots or to interpolate it such that surrounding knots do change, but the path does not.

Pages: [1]