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 - 2020 Hindsight

Pages: 1 2 [3] 4 5 6
31
General Anim8or Forum / Re: 3D Printing Using Anim8or
« on: September 15, 2021, 05:27:10 am »
I've done 3D printing using Anim8or. The way to do it is to export to a .stl file. To do this, in Object view, select Object->Export ...
This opens the "Pick a File:" dialogue. At the bottome of this dialogue  there is a drop down selection "Save as type" for the file type. Select "STL (Binary)(*.stl)", (or "STL (ASCII)(*.stl)" should also work , but the files will be bigger - theoretically you can tweak these in a text editor, but I've never felt the need to do this.)

Once you have your STL file you can import them into a slicer of your choice - you can pretty much use any slicer for any printer as printers all take gcode files. However if you want to do something printer specific like two colour printing, you are best sticking to the slicer the printer maker recommends. My go to slicer is Raise3D IdeaMaker.

You can also create gcode for CNC machines from the STL files - but that gcode has instructions for a cutter - so passing 3D printer gcode to a CNC machine is a bad idea. For starters there won't be a code to spin the cutter. (Obviously you need to use the appropriate software to convert your .stl file to a CNC cutting path.)

32
Yes.

Actually, in a loosely connected issue, it has just dawned on me that I cannot animate a flag with my wave script. At least with Anim8or V1.01.1402 that I have installed.

To map the flag image to the mesh I need to "convert to subdivided" otherwise I cannot select the UV tool to "Enable texture generation for: ...")

And once I do that the wave script no longer gets re-evaluated each frame of the render (and the script no longer outputs frame numbers to the Debug Output window).

There is a comment on the build 1395 release notes about "Parameteric Plug-In Scripts can be subdivided after the script runs."

So I'm not sure if this should work, or if I've misunderstood.

33
Could the indexed image be mapped on to a moving mesh - or is that a problem? e.g. Could you map a moving kaleidoscope pattern on to an animated cuttlefish?

34
Has anyone played with the wave script for flags?

35
That would be great!

I notice that the OpenCV library I've been using for video also has C, and C++ interfaces. Possibly that would make your job easier?
https://opencv.org/platforms/
if the license is compatible with yours:
https://opencv.org/license/


So I guess you could translate the above Python code to C++ with the following :
VideoCapture ( )
https://docs.opencv.org/3.4/d8/dfe/classcv_1_1VideoCapture.html

read() method to get next frame:
https://docs.opencv.org/3.4/d8/dfe/classcv_1_1VideoCapture.html#a473055e77dd7faa4d26d686226b292c1

imwrite()
https://docs.opencv.org/3.4/d4/da8/group__imgcodecs.html#gabbc7ef1aa2edfaa87772f1202d67e0ce

I added an alpha channel by calling:
image = cv2.cvtColor(image, cv2.COLOR_RGB2RGBA)  # Replace RGB image with RGBA image.
between read(), and imwrite()

And some day maybe you could do joint tracking from video by filming people with post-it notes or reflectors on their joints ;)


36
This is some simple Python code to chop video into image files:

(As the comments explain I cribbed from stackoverflow and downloaded a video file 'SampleVideo_720x480_5mb.mp4' for the test - that filename lies; it is actually 640x480. The code seems to work with whatever video resolution or format you pass to it. The code comment actually points to a different video file on the same download site - hope that doesn't confuse anyone - any video file should work just put the video file name in the line: vidcap = cv2.VideoCapture('SampleVideo_720x480_5mb.mp4') ):


'''
https://stackoverflow.com/questions/33311153/python-extracting-and-saving-video-frames
From here
https://sample-videos.com/
download this video
https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_5mb.mp4
so we have the same video file for the test. Make sure to have that mp4 file in the same directory of your python code.
Then also make sure to run the python interpreter from the same directory.

Note: I had to install "opencv-python" package for "cv2"
'''

import cv2


#vidcap = cv2.VideoCapture('big_buck_bunny_720p_5mb.mp4')
vidcap = cv2.VideoCapture('SampleVideo_720x480_5mb.mp4')

success, image = vidcap.read()
count = 0
while success:
  #cv2.imwrite("frame%d.jpg" % count, image)     # save frame as JPEG file
  cv2.imwrite("frame%d.png" % count, image)     # save frame as PNG file
  success,image = vidcap.read()
  print('Read a new frame: ', success)
  count += 1



If anyone wants to use this code, you need to install Python3 on your machine, and the package "opencv-python". (Python Packages are installed using the pip command, or from a menu on your IDE.) I use the PyCharm IDE by JetBrains, it is free.


That code just produces normal image files. But I have written another version which converts a green screen background into alpha. I filmed this against a disposable table cloth on my washing line. If I had ironed it, I wouldn't have had to have alpha selection as aggressive as it is. Note I've only attached every 6th frame.

37
Feature request for Steve,

I was wondering if it would be possible for you to add a feature to Anim8or so that if a user entered an image file name like "hero{frame}.png", Animator would understand it should replace "{frame}" with the frame number, to pull in a different image file for each frame. It would be even nicer for video editing if you could enter something like "hero{frame+30}.png" to have the first frame read from "hero30.png", then "hero31.png"... ?

I envisage this working regardless of whether you enter the file name in a dialog box, or into a '.an8' script like:
  image {
    "C:\\ANIM8OR MANUAL\\waves\\water types\\sky-1286888_960_720_{frame}.jpg" }


The image files could be generated from video by other software. I have written code to do it in Python, but I expect there are software packages available to chop video into image files.

38
Something that I've noticed on the 1.01.1394+ build (I haven't downloaded the latest) is that in the "Parametric Plug-in Editor" if you delete a float field the cancel button does nothing (but it does work if you do the same to an int field).

You can always cancel by pressing the Escape key, but I didn't know that, and suffered mild anxiety when I accidently deleted a field after zoning in on settings.

39
Sorry for the wild goose chase! I thought I was doing you a favour passing the report on.

I thought my script protected against getting large values.  But looking at it I see the new code bypasses the test!

40
Bug report:

Just got an "assertion failed!" message when rendering an image with the attached script files.
I had just changed my script to try an idea for a 'V' wake effect. It was a failure, and the water was very spiky - pointy waves, but not massively tall.

I get the same message from "Anim8or_1395.exe"

Message:
Assert failed!

Program: ...\Anim8or_1394_plus.exe
File C:\Users\rstev\MyApps\Anim8or\src\VArray.h
Line: 83

Expression: !"array index out of bounds"

To trigger the assert, I load "ThirdWaveTest.an8" go to Scene mode, And select Render->render image
After clicking OK I get the assert.

Here are the offending files:

41
Ongoing Anim8or Development / Re: ASL Attribute Functions
« on: January 14, 2021, 05:26:33 pm »
:( And here was me hoping to talk you into making scan accept strings as well as file handles:

scanner $scan;
string $commandString; 
$commandString = "boat,15,20,4,1,30,6,1\nboat,30,10,4,1,-150,6,1\n";
$scan.initialize($commandStirng);

42
Ongoing Anim8or Development / Re: ASL Attribute Functions
« on: January 14, 2021, 01:24:39 pm »
Hi Steve,
I believe there should be a way to send data to a parametric plugin using attributes.

In the following code I am trying to define where I want a boat to be placed on my wave object (version 3 of the parametric plug-in script is called "ThirdWave").

As a first step towards doing this I tried the following code with the hope of being able to set a float called "boat1" in the .AN8 script, and read it (like time, and frame) in the .a8s script.

So in the .AN8 file I created the wave object like this: 
parameteric {
    name { "ThirdWave01" }
    script {
        object $object;
        attribute $attribute;
        $object = project.curObject;
        $attribute = $object.NewAttribute("boat1");
        $attribute = SetFloatValue( 123.45 );
    }
    plugin { "ThirdWave" }
    base {
      origin { (-347.68 65 -347.68) }
      orientation { (0.70711 0 0 0.70711) }
    }
    material { "dielectric 1.33" }
    parameter { "X Tiles" int 96 }
    parameter { "Y Tiles" int 96 }
    parameter { "Scale" float 10.865 "scale" "scale_x" }
    parameter { "Seed" int 3454 }
    parameter { "Wave origin count" int 23 }
    parameter { "Max wave height" float 1.8 }
    parameter { "Mean wavelength" float 15 }
    parameter { "Min wave distance" float 100 }
    parameter { "Wave direction" float -140 }
    parameter { "Time" float 92 }

  }


And in ThirdWave.a8s I tried the read the value of boat1 with this code:   

    file $c;
    $c.open("$console", "w");
    $c.print("time = %5.2f\tframe = %d\t boat1=%f\n", time, frame, boat1);


Anim8or didn't like this, and so reported "Unable to locate script for Parametric plug-in: ThirdWave". It is the variable boat1 it doesn't like. It runs if you comment out the print line - but the point of the test is to transfer a value in boat1.

Is what I'm trying to do even possible? If so how?

In addition to sending boat position to "ThirdWave.a8s" I want to return the wave height and angle of the water surface at that point back to the .AN8 controller script so that the boat can bob on the water. One of the objectives is that boats can be placed without editing the .a8s parametric plug-in script - and hopefully implement 'V' shape trails as they move across the water.

The references I have looked at are pages 135-136 of https://www.anim8or.com/learn/pdf/anim8or_manual_1.01.1318_mark.pdf
and this thread.

43
Ongoing Anim8or Development / Re: Animated Parameteric Plug-in Scripts
« on: January 12, 2021, 08:48:14 am »
Some notes for people wanting to use animated water, and waves around objects.

Using the files “IansBoatWaves.a8s”, and “Animated toy yacht on sea - 192x128zoom.an8” which I attached to the “How about this version Ian?” post above. (These 2 files work, but the sea and sky will be black unless you copy the “sky-1286888_960_720.jpg” file from the zip file IanRoss posted.) Place these files in the Anim8orScripts directory.

1) You need a recent version of Anim8or. At least Version 1.01.1394+ dated 22/12/2020.

2) Open "Animated toy yacht on sea - 192x128zoom.an8" You should get a pop-up DOS window titled "Anim8or Debug Output"

3) Switch to Scene mode

4) Press '1' on the numeric keypad to look through the camera

5) Render movie

This animation makes use of the addBoat() function in “IansBoatWaves.a8s” to create the waves around the boat.

The boat hull has to be added to the wave script. It would be much nicer if this could be controlled from the .AN8 script. But I don't know of a way to do that.
I would recommend that for each animation you copy and re-name the original wave script, and reflect the new file name in both the "#plugin("object", "mesh", "IansBoatWaves");" in the .a8s file, and the "plugin { "IansBoatWaves" }" line in the .AN8 file, otherwise the code is likely to call the old script rather than the modified one.

The new script will add a second wave icon which is less than ideal, so it is best to store your modified scripts in a different directory, and only copy them to the "Anim8orScripts" directory when you are making the animation. And after the animation remove the modified version.

As the addBoat() function adds decaying waves, the first waves are quite large, so it may look better to pass a smaller length and width to addBoat() than the real boat, and use the boat hull to hide the most violent waves.



“Animated toy yacht on sea - 192x128zoom.an8” sets the number of frames that get animated  with the "frames{600} " line.

The wave parameters used in the animation are set up in the .AN8 script with:
  parameteric {
    name { "IansBoatWaves01" }
    plugin { "IansBoatWaves" }
    base {
      origin { (-48 -15 -5.5) }
      orientation { (0 0 0 0) }
    }
    material { "material02" }
    parameter { "X Tiles" int 192 }
    parameter { "Y Tiles" int 128 }
    parameter { "Scale" float 0.50000 "scale" "scale_x" }
    parameter { "Seed" int 3454 }
    parameter { "Wave origin count" int 23 }
    parameter { "Max wave height" float 0.33000 }
    parameter { "Mean wavelength" float 7 }
    parameter { "Min wave distance" float 120 }
    parameter { "Wave direction" float -65 }
    parameter { "Time" float 92 }
  }


Note the "plugin { "IansBoatWaves" }" where  "IansBoatWaves" is the name given in the "#plugin("object", "mesh", "IansBoatWaves");" line of IansBoatWaves.a8s.
This differentiates this wave object from the original unmodified waves script.

The object name passed to “    name { "IansBoatWaves01" }” is generated form the plugin name, so adjust that too.

If the wave script didn't have the "#animated" line in it then it would just be calculated the once like the other un-animated objects in the scene.

The speed of the waves is controlled by the multiplier you put in the “IansBoatWaves.a8s” line:
$time = $time + time*6.0;


44
Ongoing Anim8or Development / Re: Animated Parameteric Plug-in Scripts
« on: January 12, 2021, 07:52:40 am »
Thanks Steve. Things make more sense now!

45
Ongoing Anim8or Development / Re: Animated Parameteric Plug-in Scripts
« on: January 10, 2021, 10:18:38 am »
For example I’ve tried:

scene { "scene01"
  frames { 600 }
  groundgrid { 0 }
  shadowbias { 0.00100 }
  background { 187 227 235 }
  image {
    "C:\\___ 0 ANIM8OR MANUAL\\waves\\water typpes\\sky-1286888_960_720.jpg" }
  panorama { (-90 90 -30 30) }
  objectelement { "BOAT" "toy yacht"
    loc { (-246.74 -128.82 -535.56) }
    orientation { (-0.11446 -0.01427 0.04222 0.99243) }
    scale { 10.591 }
  }
  point3 $bluePos;
  $bluePos = GetAttributePoint3("toy yacht", "position");


Pages: 1 2 [3] 4 5 6