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 ... 3 4 [5] 6
61
Talking about parameters, I'm struggling with only ten on my wave object. Any chance of adding string parameters so that several parameters can be added in a single string?

Or sub-menus for parameters? Although that may get in the way of davdud101's live/"realtime" sidebars? Perhaps a magic character could be added to the field name to exclude it from the sidebar?

Possibly sub-menus could be added like this?:
#parameter("Scale", menu, 1, 1, 3 );
#parameter("Scale¦X Scale", float, 10.0, 0.001, 99999, scale, scale_x );
#parameter("Scale¦Y Scale", float, 10.0, 0.001, 99999, scale, scale_y );
#parameter("Scale¦Z Scale", float, 10.0, 0.001, 99999, scale, scale_z );

62
Hi Bayinghound,

Looking at the .an8 file for a saved mesh, it looks like it will be easy to create the mesh structures by directly writing to the file. I confess I haven't played with animation at all, so I don't know what the practical limits are. e.g. Ideally there would be a grid for every frame (so 90 meshes for your 3 second clip). Would that be too much for Anim8or/"morph targets" to handle?

If you are happy just to create the meshes then perhaps I could write a program in C that takes a .an8 file, looks for a wave object and replaces it with a number of mesh objects generated from the parameters in the wave object (the waves would look different to the script because I would be using a different random number generator). This feels like a dirty solution, and involves people trusting running my windows code, or knowing how to compile C for themselves.

Perhaps I can write a script to add an export waves option to Anim8or. Export scripts can write to files, and presumably have access to all the information I need.

I expect what you really want is to have it populate the sequence editor with X seconds of morph targets. If you could send me the Anim8or file for your animation so that I can crib from it, that would be a big help.

Thanks,
John

63
That looks good. I looked up "morph targets" and found the flag tutorial. I take it you saved something like 10 meshes and used them as key frames in the sequence editor.

Possibly I could save grids from the script - but I have a feeling I've read that you cannot save from this kind of script - I need to look at the documentation.

Alternatively what is the format of the files when you save a mesh - perhaps I could just write a program in C or Python to create the mesh files?

64
Hi bayinghound,

If my answer didn't seem to match your question, it is because I missed the word "as" when reading it.

I made a post https://www.anim8or.com/smf/index.php/topic,6026.0.html asking advice about animation, but I didn't get any responses. I feel it should be easy to automate, the script just needs to be called for each frame with a time or frame number - but I don't believe this is currently supported.

If you have patience, then I suspect you could manually change the time field, then save the waves as a grid with a name for that frame. And repeat for each frame, and load different grids for each frame. Automation would be so much nicer though!

John

65
Hi bayinghound,

I would expect the animated waves to look realistic - although I don't know anim8or well enough to do animations.

On the other hand decaying waves (which you can only add by changing the code) may look artificial, as the energy remains localised at the origin of the waves - so probably will look OK for boat hulls, reeds, and rocks sticking out of the water, but will probably look artificial for animated water drips. I suppose the code could be changed to take time from impact as well as distance into account when calculating wave height.

You can get a low fidelity feel for what the animation will look like, by changing the "Time" values in the "Parametric Plug-in  Editor".

You can do this by advancing the time by 5, and shift-Tab (to move back to the "Wave direction" field (so causing the waves to be redrawn)), then Tab (to move back to the "Time" field), to modify the field again. The waves will evolve rather than just shift position - but this will be more obvious the closer the "Min wave distance" is, and the larger the values of "X Tile", and "Y Tile". So position the cursor on "time", and with dexterity type quickly:

5<shift-Tab><Tab> 10<shift-Tab><Tab> 15<shift-Tab><Tab> 20<shift-Tab><Tab>...

It is easier to count up in 10s! But perhaps that works better with larger waves.

66
If you are having problems with decaying waves creating spikes that are too big (maybe poking through another object). You can change the script to reduce the spike size. (Originally this code was just to protect against dividing by zero.)

Lines 206,207 are an if statement:
if( $distance <= 0.1 ) // If you want big spikes change this to: if( $distance == 0 )  
    $distance = 0.1; // Avoid division by zero for points exactly on tile boundary



If you want smaller spikes you could modify these lines to: 
if( $distance <= 0.5 )
    $distance = 0.5;



If on the other hand you want to make a feature of the spikes you can increase them with:
if( $distance <= 0.001 )
    $distance = 0.001;


Remember each tile is 1.0 long. The maximum spike is achieved when the wave origin is positioned on the corner of a tile (i.e. X and Y are both whole numbers). The "if" statement above bluntens spikes.

67
ASL Scripts / Re: I have written a script to simulate waves.
« on: November 17, 2020, 03:09:32 pm »
So tempting that I have posted a new script to do that!

Get it here: https://www.anim8or.com/smf/index.php/topic,6029.0.html

68
In the code there are a couple of commented out example wave origins:

$WaveOrigins.push( (0,0, 0.25, 5) );    // Example of how to add a hard coded immortal wave, should you have a reason to do so.

This is an immortal wave starting at the bottom left with a wavelength of 5.

and

$DecayingWaveOrigins.push( ($XTiles/2, $YTiles/2, 40, 7) );    // x, y = horizontal offset, z = amplitude, w = wavelength;

This is a decaying wave starting in the centre, with a wavelength of 7.

I captured some images:

First one with the randomly generated waves + immortal waves + Decaying waves. I selected a Time to demonstrate what I mean by a "spiky spikes" in the code comments.

The second image is the same setup, but with the "Max wave height" turned down to 0, so only the hard coded waves are visible.

69
As an example of creating waves around a boat I came up with this rough and ready demonstration of a boat hull at 45 degrees. (note +0.5 on x,y to avoid big splashes):

$DecayingWaveOrigins.push( ($XTiles/2 -10.5, $YTiles/2 +10.5, 3, 3) );
$DecayingWaveOrigins.push( ($XTiles/2 -8.5, $YTiles/2 +8.5, 4, 4) );
$DecayingWaveOrigins.push( ($XTiles/2 -6.5, $YTiles/2 +6.5, 5, 5) );
$DecayingWaveOrigins.push( ($XTiles/2 -4.5, $YTiles/2 +4.5, 6, 6) );
$DecayingWaveOrigins.push( ($XTiles/2 -2.5, $YTiles/2 +2.5, 7, 7) );
$DecayingWaveOrigins.push( ($XTiles/2 -0.5, $YTiles/2 +0.5, 8, 8) );
$DecayingWaveOrigins.push( ($XTiles/2 +2.5, $YTiles/2 -2.5, 7, 7) );
$DecayingWaveOrigins.push( ($XTiles/2 +4.5, $YTiles/2 -4.5, 6, 6) );
$DecayingWaveOrigins.push( ($XTiles/2 +6.5, $YTiles/2 -6.5, 5, 5) );
$DecayingWaveOrigins.push( ($XTiles/2 +8.5, $YTiles/2 -8.5, 4, 4) );
$DecayingWaveOrigins.push( ($XTiles/2 +10.5, $YTiles/2 -10.5, 3, 3) );

70
OK,  I didn't anticipate a new update this quick, but looking at Ian Ross's yacht image made me think that it would look better if objects in the water looked like they were interacting with the water. So here is a new script to do that, called "Combo waves". It has a new icon to avoid confusion with the "waves" script.

I considered tagging this onto the end of the "waves" topic. But I think the script is different enough to warrant starting fresh. The interface for generating random waves is identical, and you should follow the instructions posted on the "waves" post https://www.anim8or.com/smf/index.php/topic,6025.0.html.

If you don't edit the script itself then this script is indistinguishable from my "waves" script. However I have modified the code to allow wave sources to be easily added.

There are two types of wave that can be added:
1) Decaying waves: These are best for boat hulls, drips, etc.
2) Immortal waves: These never reduce in size, and are good for wind produced waves - best if they are placed outside the visible area of the mesh.

As with the original "waves" script the user can play with the run time parameters to create random weather. The values plugged into the "Parametric Plug-in Editor" only act on the randomly generated waves, not the hard coded waves (actually you can write code to read $XTiles, $YTiles, and potentially other passed variables, if you want to do clever things with your hard coded waves).

To add hard coded waves look for the following comment block in the script:
"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Start of additional hard coded waves block
///////////////////////////////////////////////////////////////////////////////
"

Under this there are two sub sections:
"
///////////////////////////////////////////////////////////////////////////////
//  Add additional hard coded non-decaying "immortal" wave origins here if required:
"

You can add as many additional wave origins as you want.

Each "immortal" wave origin is added with a line like:
$WaveOrigins.push( (0,0, 0.25, 5) );

In this example push() takes the parameter (0, 0, 0.25, 5). Which means the origin is at x=0,y=0, the wave height = 0.25, and the wave length = 5.


The second sub section is where decaying waves origins are added with a line like:
$DecayingWaveOrigins.push( (10, 20, 40, 7) );

In this example push takes the parameter  (10, 20, 40, 7). Which means the origin is at X=10, and Y=20, with a height of 40, and a wavelength of 7. (Decaying waves need larger height values than immortal waves do.)

You could place it at the center of the grid with:
$DecayingWaveOrigins.push( ($XTiles/2, $YTiles/2, 40, 7) );

In this example the width and height the user sets in the "Parametric Plug-in Editor" are read from $XTiles, and $YTiles, and used to find the centre.

Another variable that may be useful is "Max wave height" stored in $MaxWaveHeight


I mark the end of the area where hard coded waves should be added with the comment block:
"
///////////////////////////////////////////////////////////////////////////////
// End of additional hard coded waves block
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
"

Have fun!
John

71
ASL Scripts / Re: I have written a script to simulate waves.
« on: November 16, 2020, 11:47:45 am »
Those reflections look great Ian!

It is tempting to hard code some extra wave origins in the script, to correspond with the boat's hull. It wouldn't be hard to have a mix of decaying waves and the standard immortal waves.

72
I'm new to Anim8or, and this forum. I posted a script "animated_waves.a8s" yesterday.

In my waves script there is a time field to allow moving waves to be animated.

I was wondering if there is a way to automate the animation. What I have read on the forum so far indicates I cannot get the frame number or scene time passed to the script. There was a post on animating a flame, which involved having numbered flame image files which a script read in.

Would a possibility be to write a script that saved a series of wave objects as a sequence of .stl files? Is this idea sound, but a different file format would be better?

Has anything like this been done before that I could crib from? I.e. where a form changes as a function of time or frame number?

Any guidance /  recommendations?

Thanks,
John

( I posted my wave script here: https://www.anim8or.com/smf/index.php/topic,6025.0.html )

73
ASL Scripts / Re: I have written a script to simulate waves.
« on: November 14, 2020, 11:28:10 am »
Useful to know!

Thinking about it, when I was debugging I did change the name given to #plugin() to avoid confusing myself.

Thanks!

74
ASL Scripts / Re: I have written a script to simulate waves.
« on: November 14, 2020, 07:45:06 am »
Thanks!
I'm running version 1.00 of Anim8or. "29-May-17"

75
ASL Scripts / Re: I have written a script to simulate waves.
« on: November 14, 2020, 06:04:13 am »
This is an example of what the decay modification looks like (by commenting out line 133, and uncommenting line 134).

Note: Is there a bug in how Anim8or scans script files? Does it truncate file names? To create this image, I saved the modified version as "animated_waves_V1-01.a8s", and modified the icon so I didn't confuse it with the original "animated_waves.a8s". When I launched Anim8or both icons were there, but both icons ran the "animated_waves.a8s" script, I only got the decay effect when I changed the original to a .txt file! I have used the multiple file approach while debugging the code, and it has always worked but I was using shorter file names.

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