KiRec3D: Record animations/videos from the 3D View

As I am a content creator (Or at least I like to share my projects from KiCAD) I miss one option in the 3D View of Kicad to define some path to follow by the board. In addition, some record options should be nice to have. Example:

GIF-230810_194444

So I am starting to play around with Python. I will document all the project and I will try to update with any suggestion you may have. What’s your opinion? Do you think this option should be nice to have in Kicad new versions?

The script is pretty simple, as it simulates a mouse and keyboard to keep moving the X-axis of the board, and use the “export png picture” of the 3D Viewer to record thousands of images if requested

9 Likes

KiCad’s 3D viewer is mostly meant as a quick review thing.

For more elaborate things, such as making a scripted demo you can use software such as Blender. I have seen beautiful renders of KiCad PCB’s in Blender, as it can add colors, textures, multiple lights and thus shadows and much more. And Blender of course also do excellent animations. The biggest downside is that it has it’s own learning curve. Blender has it’s own and quite unusual way of doing things. It’s not easy to learn, but it is optimized for usage by people who know how it works and have a full time job of working wit it. I’m also quite certain that scripting LED animations is also doable in Blender.

And also, don’t underestimate the old fashioned way. Just put the real thing on a rotating platform and point a camera at it.

1 Like

I do agree that Blender is the way to go. After an hour I was able to do this image:


and after cca two more hours I managed to do this animation:
https://cdn.publicwire.eu/weas63rd

6 Likes

Worth mentioning because several Kicad users also use FreeCAD (and it’s StepUp Workbench)…

FreeCAD includes a Turntable so, user can Load Kicad PCB/Pads/Tracks/etc…

I did these (Parts) in FreeCAD and used the Turntable and ScreenShot-Video recorded them…
I didn’t bother for High Res of video (more interested in speed of getting them done…)

Example:
Teensy40

1 Like

My opinion is you should keep this as an external program. Once it gets into the main KiCad program, any improvements/fixes will slow down to the cadence KiCad releases. Your program will also be valuable to others as a starting point for their ideas, which is more likely to happen if it’s a small Python program instead of being embedded in some monstrous C++ project.

2 Likes

Thanks for all the posts! Yeah I know Blender or FreeCAD is the way to go for exquisite renderings&animations. Nevertheless, they require their own learning curve… So for the moment I would go for this until I am more confident with them.

Thanks!

2 Likes

In an hour?

  • Import.
  • colors.
  • Materials
  • Textures.
  • Lights / shadows.
  • Reflections.

That probably means you’ve worked with Blender before.
I also like the animation of the PCB assembly you made.

A quick search also finds tutorials for the Blender / KiCad combination:

https://duckduckgo.com/?t=h_&q=blender+kicad+tutorial&ia=web

A long time ago I spend a few days on learning Blender. It was a bit of a struggle, but not as much as FreeCAD. After a few days I began to appreciate the way Blender works, but I did not continue because my main interest is highly accurate mechanical CAD with parametric drawing. So I switched back to FreeCAD, which was not very capable and very buggy back then, but FreeCAD is slowly becoming better over the years.

I had a very minimal experience with Blender before. But I cheated a little (I mean big style :slight_smile: ).
I am using KiBot for KiCad outputs automation and they added an Blender render and export via PCB2Blender. There were some installation issues into the blender 3.5.0 but I managed to get it working.

So basically all things you mentioned was done by the PCB2Blender plugin. I just came to a finished scene and was able to play/experiment with it. I only had to tweak the PCB colors (which is simple using the plugin) and play with the lights etc… So I did just play around with it and managed to rotate camera, lights, etc…

And then I watched an tutorial on animation and key framing. And as this concept is not new to me, it was not that difficult.

7 Likes

“Cheating” is perfectly OK for such things. I won’t even call it chating. I see it more like “Standing on the shoulders of the Giants before you”. Making a writeup with details and steps of how you did it and turning it in a FAQ article for this forum would be a nice way to “give something back” to the KiCad project. It may also help makingdevices directly. (And others of course).

1 Like

I will try to write something up. But the most important idea is that you need to have the plugin installed in your Blender as it does not only export the PCB from KiCad into a Blender file but it also helps with the rendering itself in the Blender…

2 Likes

Installing such plugins in Blender (and their origins) is of course part of such a tutorial / faq article.

But don’t feel too much pressure. Writing good tutorials is an art in itself, and quite often no tutorial is better then a bad tutorial that seems plausible.

having something easy and native in kicad would be very nice… Altium has this function internally.
I remember I asked something at the forum years ago…
Edit:

I did this Video awhile back. It uses Kicad’s 3D-Viewer.

In the video, I’m repeatedly clicking the Icon show, BUT, I just now set a 3D-Viewer Hot-Key to Rotate - thus, only need to hold the Hot-Key down… Works great!

I plan to enable GLTF export (it’s already there as part of opencascade we just aren’t using it), which will allow easy import into Blender.

Also FYI, python has no ability to access the 3d viewer to do anything

2 Likes

Yes I know unfortunately…
It seems that @kammutierspule didn’t get a chance to add anything…

For simple movements it’s also doable to just use screen recording software, move your model in KiCad’s 3D viewer and then later edit the video. Just keep the interesting parts, render out the mouse cursor and such.

Screen recording is how I do it (QuickTime is built into the Mac) and I have Launch icons to do this stuff (I screen record many, many movies from the 1940’s this way then, re-encode them to MP3 using HandBrake and do the same thing for the Vid’s I post here… (otherwise the files are Gig’s…)

the focus is in script the movement, not in recording the play (which is achievable in many ways).

Oh, ah yes…

Also, in reading the first post again, he is not asking for help, but stating that he already wrote a python program do generate such scripted movements by feeding keystrokes into KiCad. Not elegant, but simple and functional.

Yes, but AFAIK only for win…

Moreover some function to interact with 3d viewer inside kicad would be a plus IMO.