Raylectron v5.2 animator

Raylectron (https://Raylectron.com) is a 3D rendering engine for Trimble Sketchup (https://sketchup.com)
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Raylectron v5.2 animator

Post by Support »

The Animation settings gas changed. You can now select an object and write a script to animate it.

Lets use a spaceship as an example. In Sketchup, make it a Component and then edit its property and enter a description and instance name so that you can easily find it in the list of objects. In that list, you will have other objects without names or with default names like component#3 but don't worry about them, that's because the spaceship contains components like the engines etc.

Once you export your model, go to the Animation settings and you can select your spaceship from the list that's above the scrip editor.

Now, make sure you don't have any scenes, If you do, right click the Scene icon and select "Delete all". Then, click the Add Scene icon and add 2 of them. The reason for this is to keep the cameara where it's at.

In the Animation settings, don't select the Camera, Sun and Clouds because for now, we'll only animate the spaceship.

After you have selected the spaceship, the script editor is then used to animate it. Here's how this works...

Scripting is done in the Pascal language. When the animator calls your script, the following variables will be defined first:

fps is set to your "Frames per Second" setting.
cf is set to the current frame number starting at 1.
rx, ry, and rz are used for rotations and initialized to zero.
px, py, and pz are used for positions and also initialized to zero.

rx is used for rotation along the x-axis (left/right axis).
ry is for rotation along the y-axis (front/back axis).
rz for rotation along the z-axis (up/down axis).

px is used for position along the x-axis.
py for position along the y-axis.
pz for position along the z-axis.

Positions will be applied after rotations regardless of the order you set them in your script. You need to set the rotations and/or positions relative to the beginning, they are not incremental, so use the variable "cf" to adjust accordingly.

Rotations are in degrees, and positions are in inches.

Rotations are about the axis position as defined in your Sketchup model's component. This means that you can select an arbitrary point of rotation rather than the default center of its bounding box.

For example, if you wish to advance your object forward (the y-axis) by 0.75 meters per second, you need to divide 0.75 meter by fps to obtain the amount to advance for this one frame, then multiply it by cf to get the final position. But don't forget to multiply your number of meters by 39.37 to convert to inches first:

i := 0.75 * 39.37;
py := (i / fps) * cf;


Don't be afraid of the script, ask me questions and you'll soon understand how it works.

First, select Draft Mode and also Simple Draft Mode to make it faster to draw so you can test your script. For now, lets just rotate your spaceship by 1 degree per frames...

ry := cf;

That's it. If you want to rotate it 3 degrees per frames...

ry := 3*cf;

that's it. Now change ry for rz and try that, than change it to rx and see what it does.

If you want to move your spaceship, use py to make it go forward...

py := cf;

that's going to move it one inch pre frames, too slow lol

The x,y,z axis are like in the Red, Green and Blue axis in Sketchup, so depending in the direction it was facing in Sketchup, you may have to use rx and not ry for example.

I'll leave it at that for now and will wait for questions...
Your support team.
https://SoftByteLabs.com
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

If you set your animation to be 10 seconds at 30 frames per seconds (for nice and smooth video) then that's 300 frames. So the animator will call your script 300 times with the variable "cf" set to
the current frame, so the first time your script is called, cf = 1 and on the second call, cf = 2 so on an so forth.
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Raylectron v5.2 animator

Post by GateGirl86 »

This is going to take a while and a whole bunch of trip ups before I get it :mrgreen:

Thank you Michael for the very, very detailed instructions. :salute
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

Here's a 5 min video showing me doing this...



Youtube is still processing the HD so the SD should not look that good. But it maybe in HD by the time you look at it.
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Raylectron v5.2 animator

Post by GateGirl86 »

I'll watch it during my break at 9am :mrgreen:
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

Another animation and this is the script I used, good luck :lol: :lol: :lol: ...

Code: Select all

// rotate ship at desired starting orientation.
rz := 90;

// Advance ship.
if (cf/fps) < 5 then // slow for the first 5 sec
  py := (cf-1)*3
else // start to accelerate.
  py := (cf-1) * (3+power(1.005, cf)-2.113); 

// after 15 sec, start to go up incrementally
if (cf/fps) > 13 then begin
  c := cf-(13*fps);
  d := power(1.01, c)-1.05;
  // limit to 45 degree
  if d > 45 then d := 45;
  rx := -d;
  // start to tilt too
  ry := c/5;
  if ry > 25 then ry := 25;
  ry := -ry;
end;

Your support team.
https://SoftByteLabs.com
Okwa
Posts: 486
Joined: Mon Feb 27, 2023 1:34 am

Re: Raylectron v5.2 animator

Post by Okwa »

I have now tried several times. I don't see anything at all in the animation tab under "Available objects", it's completely empty. I have tried both installation files you sent me. Also different models.
Made model into a component, no scenes, then created new scenes twice in Raylectron. But no matter how many times I tried it, there is not a single object available for animation in the animation tab. :?:
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

Which version of Sketchup are you using?
Your support team.
https://SoftByteLabs.com
Okwa
Posts: 486
Joined: Mon Feb 27, 2023 1:34 am

Re: Raylectron v5.2 animator

Post by Okwa »

Support wrote: Thu Apr 13, 2023 7:26 am Which version of Sketchup are you using?
Version 17.2.2555 64 BIts :oops:
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

Okwa wrote: Thu Apr 13, 2023 9:15 am
Support wrote: Thu Apr 13, 2023 7:26 am Which version of Sketchup are you using?
Version 17.2.2555 64 BIts :oops:
19.2 is needed!
Your support team.
https://SoftByteLabs.com
Okwa
Posts: 486
Joined: Mon Feb 27, 2023 1:34 am

Re: Raylectron v5.2 animator

Post by Okwa »

Support wrote: Thu Apr 13, 2023 11:18 am
Okwa wrote: Thu Apr 13, 2023 9:15 am
Support wrote: Thu Apr 13, 2023 7:26 am Which version of Sketchup are you using?
Version 17.2.2555 64 BIts :oops:
19.2 is needed!
When you asked about the version, I knew immediately that my Sketchup is too old. :D
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

It's using the older exporter, slower and can't take advantage of instancing. Sent you a PM.
Your support team.
https://SoftByteLabs.com
Okwa
Posts: 486
Joined: Mon Feb 27, 2023 1:34 am

Re: Raylectron v5.2 animator

Post by Okwa »

Support wrote: Thu Apr 13, 2023 11:37 am It's using the older exporter, slower and can't take advantage of instancing. Sent you a PM.
Problem solved, as requested. :)
But now another question. :shock: :
When I press "Save Animation", two AVI files are saved. The first video shows the spaceship at the starting point of the animation, the second video at the end of the animation. But it does not move, it is a pure still image!
Could this be because the "Performance Mode" is active? I can no longer find the "Performance mode" in the new Raylectron version.

P.S. Got it! "performance mode" is now "draft mode"! Silly me. :D

The problem with the animation saving cannot be due to the fact that draft mode is active. I have switched it off.
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Raylectron v5.2 animator

Post by GateGirl86 »

I can't to see what you come up with @Okwa as for me, that will take a while as I have to purge one or several of my models of a whole bunch of unneeded geometry that essentially can't be seen (such as interiors) and get them down to a much smaller file size. The number of materials also seems to affect the performance.
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

Okwa wrote: Thu Apr 13, 2023 1:27 pm
Support wrote: Thu Apr 13, 2023 11:37 am It's using the older exporter, slower and can't take advantage of instancing. Sent you a PM.
Problem solved, as requested. :)
But now another question. :shock: :
When I press "Save Animation", two AVI files are saved. The first video shows the spaceship at the starting point of the animation, the second video at the end of the animation. But it does not move, it is a pure still image!
Could this be because the "Performance Mode" is active? I can no longer find the "Performance mode" in the new Raylectron version.

P.S. Got it! "performance mode" is now "draft mode"! Silly me. :D

The problem with the animation saving cannot be due to the fact that draft mode is active. I have switched it off.
oh, the second one is suppose to be an mp4 video, much smaller than the uncompressed avi, but, I may have forgotten to include the files that convert the avi to an mp4 :oops:
Your support team.
https://SoftByteLabs.com
Okwa
Posts: 486
Joined: Mon Feb 27, 2023 1:34 am

Re: Raylectron v5.2 animator

Post by Okwa »

Support wrote: Thu Apr 13, 2023 2:19 pm
Okwa wrote: Thu Apr 13, 2023 1:27 pm
Support wrote: Thu Apr 13, 2023 11:37 am It's using the older exporter, slower and can't take advantage of instancing. Sent you a PM.
Problem solved, as requested. :)
But now another question. :shock: :
When I press "Save Animation", two AVI files are saved. The first video shows the spaceship at the starting point of the animation, the second video at the end of the animation. But it does not move, it is a pure still image!
Could this be because the "Performance Mode" is active? I can no longer find the "Performance mode" in the new Raylectron version.

P.S. Got it! "performance mode" is now "draft mode"! Silly me. :D

The problem with the animation saving cannot be due to the fact that draft mode is active. I have switched it off.
oh, the second one is suppose to be an mp4 video, much smaller than the uncompressed avi, but, I may have forgotten to include the files that convert the avi to an mp4 :oops:
Well, that's not a big deal. :D
However, the question remains, why is a 10 second video saved with only one image? Why is nothing rendered? :?: In the preview animation (draft) the ship moves as desired. I was almost proud of myself. :D
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

Okwa wrote: Thu Apr 13, 2023 2:23 pm Well, that's not a big deal. :D
However, the question remains, why is a 10 second video saved with only one image? Why is nothing rendered? :?: In the preview animation (draft) the ship moves as desired. I was almost proud of myself. :D
Draft mode or not, it saved what you see, I'm not sure why it didn't. Did you run the AVI and it was only a still picture? Can you send me both, the AVI and MP4?
Your support team.
https://SoftByteLabs.com
Okwa
Posts: 486
Joined: Mon Feb 27, 2023 1:34 am

Re: Raylectron v5.2 animator

Post by Okwa »

Support wrote: Thu Apr 13, 2023 2:27 pm
Okwa wrote: Thu Apr 13, 2023 2:23 pm Well, that's not a big deal. :D
However, the question remains, why is a 10 second video saved with only one image? Why is nothing rendered? :?: In the preview animation (draft) the ship moves as desired. I was almost proud of myself. :D
Draft mode or not, it saved what you see, I'm not sure why it didn't. Did you run the AVI and it was only a still picture? Can you send me both, the AVI and MP4?
Oops, the second one is really an MP4. Not seen, my mistake. :oops:
I'll try to send you the files.
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

got them, and they are ok as videos but like you said, not moving!!! Did you downloaded the update that I sent yesterday of the first one?
Your support team.
https://SoftByteLabs.com
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

I sent a PM to you and GG saying "Fixing one thing breaking another" with the downlaod link.
Your support team.
https://SoftByteLabs.com
Okwa
Posts: 486
Joined: Mon Feb 27, 2023 1:34 am

Re: Raylectron v5.2 animator

Post by Okwa »

Support wrote: Thu Apr 13, 2023 2:38 pm I sent a PM to you and GG saying "Fixing one thing breaking another" with the downlaod link.
I had loaded the second installation file.

I will uninstall Raylectron again and install the second file you sent yesterday. Maybe I got mixed up. Because I had downloaded both versions. But actually I had deleted the "broken" one.

P.S. I can only tell you tomorrow whether it worked. My family wants attention for the rest of the evening :D
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

Yes, because the first one I sent did not save the animation, just a still picture, so you must have installed the first one by mistake, since the download link is always the same file name!!!
Your support team.
https://SoftByteLabs.com
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: Raylectron v5.2 animator

Post by Support »

I just discover a bug, you have to enable the camera in the Animation for it to save rendered correctly. even if you don't animate the camera, I fixed it however but in your version, you need to do this.
Your support team.
https://SoftByteLabs.com
Okwa
Posts: 486
Joined: Mon Feb 27, 2023 1:34 am

Re: Raylectron v5.2 animator

Post by Okwa »

Support wrote: Thu Apr 13, 2023 11:05 pm I just discover a bug, you have to enable the camera in the Animation for it to save rendered correctly. even if you don't animate the camera, I fixed it however but in your version, you need to do this.
Three thumbs up. Works. A short 3 second video as a small proof. :D :salute

https://sta.sh/0kbud9lgqnl

Another small, bad video, but with all the trimmings. Background, god rays etc. Sorry, I'm not on Youtube. Hence the link to DeviantArt. That was the quickest way to get the video online. :D

https://www.deviantart.com/okwa/art/Ani ... -958002688
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Raylectron v5.2 animator

Post by GateGirl86 »

A quick question. How do you rewind back to the start?
Image
"Come with me if you want to live."
Sarah Connor
Post Reply