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.

Messages - 2020 Hindsight

Pages: 1 [2] 3 4 ... 6
ASL Scripts / Re: Animated Textures Using Controller Scripts
« on: October 01, 2021, 05:58:10 pm »
I suppose I can try uploading the two new files without putting them in a zip file.
Basically the 7z file Raxx uploaded is the directory structure I was using. The flame texture files can be found in that archive.

I have attached my example project:
"Example 1 - Two flames.a8"

And my simplified animated texture script template:

General Anim8or Forum / Re: "Simplifying" A Model
« on: October 01, 2021, 03:10:09 pm »
Meshmixer allows you to do this:

ASL Scripts / Re: Animated Textures Using Controller Scripts
« on: October 01, 2021, 01:17:09 pm »

How the values in the script were derived:

In the directory:
C:\Simple Animated Textures\Sprites\fire
There are a number of texture files, each with a number suffix.
The first one is called: fire1_0055.png
The last one is called: fire1_0106.png

Previously you will have done the following:
In Object view, a mesh was created, double clicking on a mesh face will bring up the "Mesh Editor" dialogue. On the "Material" drop down box, select new and click the "..." button next to it to bring up the "Material Editor" dialogue. Press the "." button next to "Ambient" brings up the Texture dialogue box, and you can create a new texture by clicking the "Load Texture" button. Select a texture file from the sequence, e.g. "fire1_0055.png". At this point the "Name:" field will say "fire1_0055", change this to "fire1", this is the name of the texture that the script will use to identify the texture!

So back to the script file:

Identify the texture to animate by giving its name in quotes in the following line:
$t = project.LookupTexture("fire1");

Tell the script where to find the texture files. On our machine they are in the directory: C:\Simple Animated Textures\Sprites\fire
So put that full path in quotes on the following line (note that you have to swap the '\' characters to '/' otherwise you will get an error. You also add one at the end.)
$texPath = "C:/Simple Animated Textures/Sprites/fire/";

Our texture files all start with a name, and end with a number followed by the file extension. e.g. "fire1_0055.png"
Tell the script what the first part of the file name is with the following line:
$texPrefix = "fire1_";

Next tell the script how many digits there are in the file name. In our case "0055" is four digits.
$texDigits = 4;

Then tell the script what file extension our texture files have.
$texType = "png";

Next we tell the script the number of the first file in the texture sequence. In our case this is file "fire1_0055.png", so this is 55:
$texStartingFrame = 55;

Then we tell the script the number of the last file in the texture sequence. In our case this is file "fire1_0106.png", so this is 106:
$texEndingFrame = 106;

And that is all you have to change!

There is one more variable you can change if you want. This is at the top of the file, and normally is just set to 0:
$firstFrameNum = 0;
But if you want two flames burning, and not have both animations in step, you can define a second flame texture, and the script for the second flame will be identical except for the value of this variable. In the second texture script you could set:
$firstFrameNum = 20;
This defines which animation frame corresponds to the first texture file.

ASL Scripts / Re: Animated Textures Using Controller Scripts
« on: October 01, 2021, 12:24:46 pm »
I still cannot post the zip file! I also tried posting it as a 7z file. That failed too!
I also tried posting with notification turned off, etc.

Here is the contents of "sprite_controller.txt" which is what makes it work. This example uses the texture files from Raxx's original post:

texture $t;
string $texPrefix, $texType, $texPath, $texFileName;
int $i, $k, $texStartingFrame, $texEndingFrame, $texDigits;
int $texFrame, $numFrames;
int $firstFrameNum; // This is an animation frame number to correspond to $texStartingFrame image. E.g, two torches can burn out of sync by setting $firstFrameNum to different frames.
$firstFrameNum = 0;

// What's the name of the texture? This is NOT the file name, it's the Name field in the Texture Map panel in the Texture Selector dialog box of the material editor.
$t = project.LookupTexture("fire1");

// Texture File Path - Must be the exact location, does not look through subfolders
// Leave blank only if the files are located in the textures path in File->Configure (not in a subfolder!)
// Absolute Path Example: "D:/MyProject/Sprites/"
// Local Path (of .an8 file) Example: "./Sprites/"  Note that rendering movies doesn't work with relative paths - just use absolute paths.
$texPath = "C:/3D CAD/Anim8orScripts/Simple Animated Textures/Sprites/fire/";

// Texture Prefix - Enter the name (without numbers) of the image sequence's file name, right up until the numbering.
// For example, "filename_00001.png" has the prefix, "filename_"
$texPrefix = "fire1_";

// Number of digits in the texture name
// For example, if it's filename_00001, the value would be 5
$texDigits = 4;

// Texture File Type - "png", "bmp", "gif", or "jpg"
$texType = "png";

// What's the starting number?
// For example, if the texture is named "filename_00001.png", the value is 1
// For this and the ending number, configure any additional textures you added earlier as well
$texStartingFrame = 55;

// What's the ending number?
$texEndingFrame = 106;

// /////////////////////////////////
// /////////////////////////////////

// Determine number of frames
$numFrames = $texEndingFrame - $texStartingFrame + 1;

// Note: frame is a built in variable, as is time
// Mod results in frames looping over the available texture files.
//  $firstFrameNum allows you to choose which frame the texture file sequence loop starts on.
//  Adding $numFrames allows animation even when frame < $firstFrameNum
$texFrame = (frame + $numFrames - $firstFrameNum) % $numFrames;

// Belts and Braces: clamp should be redundent, but do need to add  $texStartingFrame
$texFrame = clamp($texFrame + $texStartingFrame, $texStartingFrame, $texEndingFrame);

// Determine how many zeroes to pad
$texFileName = PrintToString("%d", $texFrame);
$k = $texDigits - $texFileName.length();
$texFileName = "";
while($k > 0)
   $k = $k - 1;
   $texFileName = PrintToString("%s%s", $texFileName, "0");

// At this point  $texFileName contains just the padding zeros of the file number (if any)
$texFileName = PrintToString("%s%s%s%d.%s", $texPath, $texPrefix, $texFileName, $texFrame, $texType);

if ($t.GetFileName != $texFileName)

ASL Scripts / Re: Animated Textures Using Controller Scripts
« on: October 01, 2021, 12:10:47 pm »
I have tried repeatedly to post this but it kept failing to post. It could be due to the zip file attachment, even though it is only 2.5MB. So I will post this text, and try to post the zip file as a second post.

Raxx's script isn't as easy as it could be to use. So I have refactored it to make it as simple to use as I can. There is no time scaling in this version of the script.

I have attached a zip file containing an example project with two flames. Only absolute paths work, so for this example project to work on everyone's machine, it needs to be in a known location. I've coded the scripts to work if you un-zip the attached zip file to the directory:
C:\Simple Animated Textures
The flame .png files should be located in the directory:
C:\Simple Animated Textures\Sprites\fire

To correspond to the path set with the script line:
$texPath = "C:/Simple Animated Textures/Sprites/fire/";

(Relative paths can appear to work when you scroll along the time line, but render movie will not be animated.)

To run the example project:

In Anim8or open "C:\Simple Animated Textures\Example 1 - Two flames.an8"

Switch to Scene view.
Select camera view (e.g. press 1 on the numeric key pad)

The flames will animate if you drag the time slider, or render the movie.
This is the video it renders:

This is a much simplified version of Raxx,s script which bypasses most of the complexity.

I use the frame variable to work out which texture file needs to be loaded - so no messing around with graphs or keys.

To use the script for youself you just have to:
1) Create a named texture. For example the left hand flame texture in the example is named "fire1". And the script you create for this texture in step 2e knows which texture to animate with the following line:
$t = project.LookupTexture("fire1");

Raxx's video:
walks you through creating this texture at 2:01, and applying it to a mesh between 1:04 and 3:23

Raxx's video gives a second example of doing this between 4:09 and 5:18

2) for that texture, in Scene view:
a) add a Target (Build->add target). Give it a name like "fire3_sprite" to aid you knowing which texture it corresponds to.
b) double click on the target, and click on the "..." in the "Location" section.
c) make sure the "On" Expression radio button is selected, and press "Edit" next to it.
d) Open "C:\Simple Animated Textures\sprite_controller.txt" in a text editor, select all the text and copy it. Then replace the text in the Script Viewer that was displayed as a result of pressing "Edit", by pasting the text from "sprite_controller.txt"

e) Tweak the script to match your needs. E.g. the absolute path to the texture animation files. And the name of the texture that this script corresponds to. And the number of the first and last file in the animation sequence. To change which texture frame is displayed on a particular animation frame set the $firstFrameNum variable.

f) Press OK, on each of the three pop-up windows to close them down. Then save your project.

3) The texture should animate now. Presuming you have applied it to a mesh (I applied the texture to both Ambient and Diffuse in the example project).

I've posted a superman video to YouTube using it:

Other notes (Things that I may have over simplified):
1) One of the simplifications I have made is to remove the variables to disable the script. But you can disable the script by commenting out the entire script. You can do this by placing a "/*" open comment before the first line, and a matching "*/" after the last line to disable the script. (The speech marks are not to be included.)

2) To keep the time line clean, it makes sense to place the sprites under a parent object like Raxx does. In his video he shows how to create a container object to contain scripts at 15:54 :
Build->Add Target
Name it: sprites_scripts
Then double click on the individual sprites, like "fire1_sprite", and select "sprites_scripts" as the parent.

3) The simplified script loops over the texture files for the entire period of animation. However it would not be hard to modify the script to have a lead-in texture file to be displayed before frame == $firstFrameNum. e.g. this could be a png with all pixels 100% transparent. And you could have another file to be displayed when frame > ($firstFrameNum + $numFrames). E.g. a soot mark from an explosion.

This is a bit more advanced, and you will be changing code that appears after the line:
// /////////////////////////////////
// /////////////////////////////////

General Anim8or Forum / Re: 3D Printing Using Anim8or
« on: September 18, 2021, 05:25:21 am »
Old Codger

Talking about print beds, Maker's Muse uploaded a good video on the topic today:

If your bed adhesion is too high, you could try lowering the bed temperature for the print.

You were complaining about how long the print took. You might be able to slice with fewer shells, and lower % infill.

General Anim8or Forum / Re: 3D Printing Using Anim8or
« on: September 17, 2021, 07:05:13 pm »
Another option is to get a flexible print bed like this (expensive example - but shows the idea):

The print will pop off when you flex the bed. Prusa introduced them, theirs is held on by magnets.

General Anim8or Forum / Re: 3D Printing Using Anim8or
« on: September 17, 2021, 06:55:04 pm »
"...Then I saw where it left a residue of PLA filament material behind where one of the two pieces (the broken one) which I tried cleaning up but now seem to have messed something else up. ..."

The print head will probably just re-melt any residue PLA on the bed when you print there again.

BTW what make and model printer have you bought?

General Anim8or Forum / Re: 3D Printing Using Anim8or
« on: September 17, 2021, 06:37:12 pm »
The usual problem is getting the print to stick - so you are sort of ahead of the game there! The tool I use for getting prints off is an artist's palette knife. Another popular tool is a decorator's scraper tool. Try not to damage your print bed! My print bed isn't so good for adhesion, so I put packing tape on it (PLA sticks to the plastic tape better than to stainless steel). Some recommend rubbing a pritt stick over the bed to help adhesion, or spray it with cheap hair spray - I expect that will reduce adhesion in your case.

It is a pain to come back to a bird's nest if something goes wrong part way through a long print. And if you are leaving it unattended you need confidence that it will detect an overheating hot end, and not catch fire. (e.g. if the temperature sensor connection breaks, and the software isn't smart enough to realise that if the sensor is reading cold, the sensor is probably faulty.)

General Anim8or Forum / Re: 3D Printing Using Anim8or
« on: September 15, 2021, 06:44:13 pm »
It is satisfying watching your objects being printed. I'm sure you will have fun!

Tweaking is required to get good prints. A lot of people try to print objects using the fastest settings, but the best way to get a good looking print is to print slowly (or at least not too quickly). You often see echos of corners in printed objects because they have been flinging the print head around too fast.

The biggest problem I have with printing, is printing large objects. The wider an object is, the more it contracts as it cools, and tries to peel itself off the build plate. But I tend to keep to small components anyway. The printers at the FabLab have transparent enclosures to keep the ambient temperature up. They seem to have success printing large objects.

One guy at the FabLab printed a violin he downloaded from ThingiVerse for his daughter. So it is possible to print large objects

It might have been this one:
or possibly this one:

I've seen youtubers get good finishes on prints by painting them with primer, and then sanding with wet and dry to get rid of print layer ridges.

General Anim8or Forum / Re: 3D Printing Using Anim8or
« on: September 15, 2021, 04:46:42 pm »
Thanks Old Coger.
I've just had a try on build 1.01.1402 and got the same result.

Is there a reason for limiting lathe to 32 segments? I suppose it makes rendering faster, but isn't so useful for 3D printing.

Anyway I feel we are digressing from the point I was trying to make about using the boolean operations scripts:

You wanted to break down a large print in to smaller prints to fit on your printer's build plate. The boolean operations seem like they should be usable for that purpose. But davdud101 seemed to be indicating that boolean operations introduce inaccuracies. I wondered if he was talking about where a plane on both shapes the boolean operation take are coincident (I mean same position in space and parallel - like the opening to the hole through the roller when both cylinders were the same length)? Or is there another problem?

How are you intending to assemble the parts? Glue? Or nut and bolt? Or some other way?

General Anim8or Forum / Re: 3D Printing Using Anim8or
« on: September 15, 2021, 09:26:04 am »
A simple roller solid can be created in Anim8or without booleans by lathing a rectangle.  The object is limited to 32 facets around the circumference but this can be improved with smoothing and the topology of the ends is tidy.

Would smoothing have a toasted cheese effect on the precision of the corners? The end caps the binary operation produced fit perfectly (once I made the inner cylinder longer) - the surface just isn't divided like I would have done it by hand - but I shouldn't care about that.

General Anim8or Forum / Re: 3D Printing Using Anim8or
« on: September 15, 2021, 08:25:00 am »
Also Anim8or isn't the most dead-nuts precise tool out there so just be aware of that. I like it for rough dimensions and it can definitely work for less intricate stuff, but for things like boolean operations and extremely precise operations it's a bit tough to get clean results that would be useful on something like a 3d printer or CNC router.

The other week I wanted to print a simple roller. I created the .stl with Anim8or using the boolean operations script. My first attempt failed, because I tried to subtract one cylinder from a wider one, but made the "mistake" of having them both the same length. When I made the small diameter cylinder poke out both ends of the large diameter cylinder it worked. (Although the choice of how to divide the ends up into triangles was a bit eccentric.)

General Anim8or Forum / Re: 3D Printing Using Anim8or
« on: September 15, 2021, 07:45:36 am »
I've used - or at least played with Fusion 360. My biggest problem with it is the free licence for people with revenue of less than 10,000 per year (or however it is worded). They have now reduced functionality twice for the free version while I've had it installed. Personally I think any company using it need their heads examined, because they are putting their entire business at the mercy of a license that can be changed at any time. And they keep changing the interface, so the workflow that worked yesterday won't necessarily work today.

I keep meaning to look at FreeCad. But I've seen a video saying that it has a fundamental design flaw in it, and you are better off using a development branch that addresses this problem. I suggest you listen to the video, and read some of the comments:

Under the video there is a link to the RealThunders Branch: I've not looked at it, but I think that it is probably the version to learn with.

I noted to myself that this FreeCAD course looked like it may be worth watching:

General Anim8or Forum / Re: 3D Printing Using Anim8or
« on: September 15, 2021, 05:47:14 am »
If you are lucky you may be close to a FabLab. They are almost guaranteed to have 3D printers available (at my local FabLab they charge for usage time). And if you are lucky they will also have a CNC machine. My local FabLab has two: a small one (Roland MDX40), and one big enough to make large furnature (ShopBot).

Here is a map of FabLab locations:

There will be people there who can give you help and advice too.

Pages: 1 [2] 3 4 ... 6