Modular electric urban vehicles
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Modular electric urban vehicles
One more.
- Attachments
-
- Perspectiva_composicoes_06.jpg (132.39 KiB) Viewed 1946 times
Re: Modular electric urban vehicles
That's impressive, as always
Re: Modular electric urban vehicles
Thank you!
By the way, could anybody help me to create a macro to run the animation and automatically save the respective images rendered by povray?
And/or would anyone know how to export to povray including the animation sequences produced in FC?
Re: Modular electric urban vehicles
Hello,
Nice renders, really!
This Python statement will trigger rendering and eventually return the path to the rendered file:
(given that project is a variable pointing to your project...)
So, if you can loop into your animation, you could render at each step and save the output. Something like that:
Just take into account that Render will reuse the same output_file from a rendering to another, so you'll have to generate a specific filename at each step...
Nice renders, really!
Not sure it's possible. As far as I am concerned, Pov-Ray is not designed for animation, neither Render WB. Your first approach (animate in FreeCAD and render at each step) seems better.would anyone know how to export to povray including the animation sequences produced in FC?
I'm not skilled in animation in FreeCAD, but I can give you a hint with Render.could anybody help me to create a macro to run the animation and automatically save the respective images
This Python statement will trigger rendering and eventually return the path to the rendered file:
Code: Select all
output_file = project.Proxy.render(wait_for_completion=True)
So, if you can loop into your animation, you could render at each step and save the output. Something like that:
Code: Select all
import Render
project = App.getDocument("YourDocument").getObject("YourPovrayProject")
for <something looping into the animation>:
output_file = project.Proxy.render(wait_for_completion=True)
<save output_file into a specific location with a specific filename>
Re: Modular electric urban vehicles
Pov-Ray has its own Screen Description Language (http://www.povray.org/documentation/3.7.0/r3_0.html) that fully supports animation. You would have to write a FC script that understands the FC animation language and translate it into the Pov-Ray animation language.howetuft wrote: ↑Fri Oct 14, 2022 8:19 am Hello,
Nice renders, really!
Not sure it's possible. As far as I am concerned, Pov-Ray is not designed for animation, neither Render WB. Your first approach (animate in FreeCAD and render at each step) seems better.would anyone know how to export to povray including the animation sequences produced in FC?
Re: Modular electric urban vehicles
Thank you, howetuft, for the feedback!
I would like to better explain the two suggestions.
1. Perform the animations rendered within FC.
2. Perform the animations rendered outside of FC.
For isolated rendered images, performing them within FC is much more practical and faster, as all project changes are already updated in the next render. However, as animations are generally time-consuming (hours, and sometimes days), performing them independently, and if possible in background, seems advantageous.
What, in my view, would be necessary to carry out the steps described:
I would like to better explain the two suggestions.
1. Perform the animations rendered within FC.
- 1.1. Create the render project (Povray Project, for example) by configuring it and defining the name and destination folder of the created images (they would be automatically numbered, as created and saved);
1.2. Create the animation sequence (with ExplodedAssembly, for example);
1.3. Select the render project and animation and click the render animation button.
2. Perform the animations rendered outside of FC.
- 2.1. Same as 1.1.;
2.2. Same as 1.2.;
2.3. Select the render project and animation and click the renderer export button (Povray, for example).
2.4. Open the exported file in the corresponding program and perform the animations, they would be saved automatically according to the settings made in step 2.1.
For isolated rendered images, performing them within FC is much more practical and faster, as all project changes are already updated in the next render. However, as animations are generally time-consuming (hours, and sometimes days), performing them independently, and if possible in background, seems advantageous.
What, in my view, would be necessary to carry out the steps described:
- Steps 1.1. and 2.1. - The option to define the folder and file name is already present in the render project's property window (although I haven't managed to use it successfully yet), it would be necessary to add the possibility of automatic numbering of the created images;
Steps 1.2. and 2.2. - For a rendered animation, you would have to create an instruction indicating that at each step of the animation (Animation Step) the render would be performed;
Step 1.3. - Totally new item. In your suggestion
Code: Select all
import Render project = App.getDocument("YourDocument").getObject("YourPovrayProject") for <something looping into the animation>: output_file = project.Proxy.render(wait_for_completion=True) <save output_file into a specific location with a specific filename>
I understand that for <something looping into the animation> would enter the instruction to perform each step of a given animation sequence, correct?
In <save output_file into a specific location with a specific filename> wouldn't it be possible to include an instruction to number the output files automatically?
Step 2.3. Partly new item. In this case, the animation instructions would be added when exporting the file to the renderer.
Step 2.4. In the case of Povray, as alexu mentions, the animations are possible.
Last edited by F_Rosa on Fri Oct 14, 2022 8:57 pm, edited 1 time in total.
Re: Modular electric urban vehicles
Well, your suggestions are interesting but they both require heavy development in Render (don't forget Render is not restricted to povray)... and I'm not really avalaible at now.
My suggestion is just to write a lightweight macro/Python script to do the job. If you need to make it run in background, you can use FreeCAD console.
To refine my code, I would propose (not tested yet):
I'll try to test it this week-end...
My suggestion is just to write a lightweight macro/Python script to do the job. If you need to make it run in background, you can use FreeCAD console.
To refine my code, I would propose (not tested yet):
Code: Select all
import shutils
import Render
project = App.getDocument("YourDocument").getObject("YourPovrayProject")
NUMBER_OF_STEPS = ... # Fill in the right value
<reset animation>
for i in range(NUMBER_OF_STEPS):
<move the animation one step forward>
output_file = project.Proxy.render(wait_for_completion=True)
shutils.move(output_file, f"path/to/target/file{i:05}")
Re: Modular electric urban vehicles
@F_Rosa Unfortunately, no good news: I couldn't get my idea above to work (I can't get the animation to take a fine enough unit step...).
There might be ways to make it work with some specific development in the workbench, but that would take a lot of time, and I'm already busy with another complex task (texture implementation)...
The conclusion is that, at this stage, Render is limited to its primary goal, which is taking snapshots.
However, if you really need rendered animations, there is an integration solution with Blender (Sverchok) that allows to take advantage of Blender's power and especially of its animation features, at the cost of a higher setup complexity: that may be a solution...
There might be ways to make it work with some specific development in the workbench, but that would take a lot of time, and I'm already busy with another complex task (texture implementation)...
The conclusion is that, at this stage, Render is limited to its primary goal, which is taking snapshots.
However, if you really need rendered animations, there is an integration solution with Blender (Sverchok) that allows to take advantage of Blender's power and especially of its animation features, at the cost of a higher setup complexity: that may be a solution...
Re: Modular electric urban vehicles
I understand and thank you for your effort. It would be necessary to create a subcommand to advance only one step at a time, perhaps derived from the PlayForward command of the ExplodedAssembly Workbench, for example.howetuft wrote: ↑Sat Oct 15, 2022 6:25 am @F_Rosa Unfortunately, no good news: I couldn't get my idea above to work (I can't get the animation to take a fine enough unit step...).
There might be ways to make it work with some specific development in the workbench, but that would take a lot of time, and I'm already busy with another complex task (texture implementation)...
The idea is to expand the representation of animations performed in FC, in general. As there are already workbenches for animations and rendering, the intention would be to integrate them.howetuft wrote: ↑Sat Oct 15, 2022 6:25 am However, if you really need rendered animations, there is an integration solution with Blender (Sverchok) that allows to take advantage of Blender's power and especially of its animation features, at the cost of a higher setup complexity: that may be a solution...
I know Blender well, but I've never used Sverchok. Thanks for the tip.
Last edited by F_Rosa on Mon Oct 17, 2022 3:35 pm, edited 1 time in total.
Re: Modular electric urban vehicles
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs