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"

Pages: 1 [2] 3

Author Topic: Animated Parameteric Plug-in Scripts  (Read 48328 times)

2020 Hindsight

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #15 on: January 07, 2021, 07:01:26 am »

Thanks Johnar!
Logged

AlecJames

  • Full Member
  • ***
  • Posts: 240
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #16 on: January 07, 2021, 08:24:26 am »

I agree that water effect is really good :)
Logged

ianross

  • Sr. Member
  • ****
  • Posts: 251
  • Imagination is the elixir of life.
    • View Profile
    • https://www.tradebit.com/filedetail.php/164976574-part-1-anim8or-tutor-course
Re: Animated Parameteric Plug-in Scripts
« Reply #17 on: January 07, 2021, 08:57:09 am »

Hi 2020 Hindsight this is really amazing, thank you. I enclose a zipped file of my toy yacht with water plane that incudes a reflective attribute water surface (rendered with the art ray tracer) , also there is a back drop cloud scene.
2020 Hindsight you are very welcome to animate this uploaded file with your new surrounding wave script.
Also thank you Steve.
Logged

2020 Hindsight

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #18 on: January 07, 2021, 12:19:53 pm »

Hi Ian,
There be monsters!


OK. Some scale and centring issues here!
Logged

2020 Hindsight

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #19 on: January 07, 2021, 06:28:02 pm »

How about this version Ian?

The water is wider than it is deep 192x128 to fill horizon, with small waves so the reflections don't go off the cloud .jpg backdrop. It would have been better if the wave origin wasn’t so far left or at least if it was further back from the grid.


« Last Edit: January 07, 2021, 07:11:27 pm by 2020 Hindsight »
Logged

2020 Hindsight

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #20 on: January 08, 2021, 08:58:31 am »

I think this looks better. I increased the height of the waves:

I tweaked the settings from the last video to:
    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 }


and

$DecayingWaveOrigins.push( ($x + $len_x * $dy - $len_y * $dx,
                            $y + $len_x * $dx + $len_y * $dy,
                            0.15, 4) ); // amplitude, wave length
Logged

ianross

  • Sr. Member
  • ****
  • Posts: 251
  • Imagination is the elixir of life.
    • View Profile
    • https://www.tradebit.com/filedetail.php/164976574-part-1-anim8or-tutor-course
Re: Animated Parameteric Plug-in Scripts
« Reply #21 on: January 08, 2021, 09:34:51 am »

Thank you 2020 Hindsight, fantastic work!!!!!! well done.
Logged

johnar

  • Hero Member
  • *****
  • Posts: 1032
  • Make it, Move it--Give it Life
    • View Profile
    • youtube vids
Re: Animated Parameteric Plug-in Scripts
« Reply #22 on: January 09, 2021, 03:36:42 am »

johnae the ground grid is underneath the water. The water has an index of refraction of 1.3 which redirects the rays as you look trough the surface.

Wicked!!
« Last Edit: January 09, 2021, 03:39:30 am by johnar »
Logged
%

2020 Hindsight

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #23 on: January 09, 2021, 09:11:51 am »

I would like to make floating objects bob with the waves. But I think I must be being thick as I cannot follow what is written under the heading “Controller Expression Script” in https://www.anim8or.com/scripts/spec/index.html

I have tried adding the following to the “Animated toy yacht on sea - 192x128zoom.an8” file I’ve been using, but I just get the error report “Error in reading file” in a pop-up window named “just so you’d know”:
  point3 $bluePos;
  $bluePos = GetAttributePoint3("toy yacht", "position");
  $position = $bluePos + (0, 50, 0);


I have also tried simply declaring an int variable at any point I think it may be acceptable within the .an8 file. But I always get the “Error in reading file” error report.

Can someone point me to a .an8 script that demonstrates how to use the GetAttribute* functions?

Should the above code be inside the scene { "scene01" …} section, or after the closing ‘}’? Or somewhere else?

Thanks,
John
Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 2126
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #24 on: January 10, 2021, 08:20:29 am »

2020 Hindsight - Did you try adding this to a controller script, or to a parameteric mesh script? The GetAttributeXXX() functions are only supported in controller scripts in a scene.
Logged

2020 Hindsight

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #25 on: January 10, 2021, 09:55:16 am »

I believe I added it to the “controller script” but I’m not confident in the terminology – I could be confused about the names of things.

I added it to the file with the “.an8” file extension not the “.a8s” file extension. The file attached to the post above that starts “How about this version Ian?” called “Animated toy yacht on sea - 192x128zoom.an8”
Logged

2020 Hindsight

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #26 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");

Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 2126
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #27 on: January 10, 2021, 12:24:24 pm »

OK, you make a Controller Script by opening an element's dialog in the scene editor, then click on the "..." next to the Location, Orientation, Visibility, etc. entry. This brings up a Key editor dialog. In the Expression area click on the "on" radio button, then on the "Edit" button. This is where you enter the Controller Script.

I've attaced an example with some controllers. You can also access the scripts text by double clicking on the name of the controller in the track window if it already exists.

Be sure to look at scene02 which has an example of a red flashing light.
« Last Edit: January 10, 2021, 12:32:47 pm by Steve »
Logged

2020 Hindsight

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #28 on: January 12, 2021, 07:52:40 am »

Thanks Steve. Things make more sense now!
Logged

2020 Hindsight

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Animated Parameteric Plug-in Scripts
« Reply #29 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;

Logged
Pages: 1 [2] 3