rendering pipelines

170 views
Skip to first unread message

James Baxter

unread,
Apr 18, 2023, 9:31:11 AM4/18/23
to ProjectChrono
Hello, I am looking to render some vehicle simulations I have made, and I am finding the built in Irrlicht renderer difficult to use and lacking some features I need (textures don't apply properly to things that aren't geometry primitives, exported frames are all black), so I'm thinking setting up a pipeline to a different rendering tool makes more sense.

I see that there is some work done on a pipeline for blender, but I'm having trouble finding any documentation. This page appears to be empty: https://api.projectchrono.org/development/blender_visualization.html

In general, is there a specific tool that you'd recommend as the lowest resistance path to being able to render vehicle simulations with full control over textures, lighting, etc; and is there any code / documentation you can point me to?

I have found the following, but would like to make sure I'm starting in the right place so I don't reinvent the wheel

Thanks,
James

Alessandro Tasora

unread,
Apr 19, 2023, 2:40:08 AM4/19/23
to James Baxter, ProjectChrono
Hi James

You are right, there is a Blender pipeline under development that could do what you need, and I am in charge of it. 

I was going to write the documentation about how to install and use the Blender add-in but I've been postponing it for two months.

I hope to write at least some basic guidelines in the next days. 

Best regards 

Alessandro Tasora 

--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email to projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/982b90cb-6381-4ed7-ba59-f39d7fbdaf7bn%40googlegroups.com.

James Baxter

unread,
Apr 19, 2023, 8:18:40 AM4/19/23
to ProjectChrono
Alessandro,

Thank you; I will plan to try out your documentation and code late next week and will be happy to provide feedback.

James

James Baxter

unread,
Apr 28, 2023, 1:47:23 PM4/28/23
to ProjectChrono
Hi Alessandro,

I will plan to begin working on this on Monday, have you been able to write any documentation? The page I linked earlier still appears to be empty.

Thanks,
James

Alessandro Tasora

unread,
Apr 28, 2023, 7:17:38 PM4/28/23
to James Baxter, ProjectChrono

Hi James,

I just sent my latest commits to GIThub containing the documentation (a sketch of it, I mean) for the Blender add-on.

If things go as expected, the CI system will trigger a Doxygen rebuild that will turn into an updated documentation at https://api.projectchrono.org/development/ , where you should find a new link to Chrono::Blender, one row below the Chrono::Solidworks link.

Now it is too late in the night for waiting the CI to finish, and I must sleep, tomorrow I will see if all was ok or the Doxygen pipeline had troubles.

regards

Alessandro

James Baxter

unread,
May 2, 2023, 9:21:41 PM5/2/23
to ProjectChrono
Hi Alessandro,

I have been trying this out today, and am very excited! It is going to be really something to take vehicle simulations from Chrono and render them with photo-realism.

I did have a few comments about bugs I ran into:
1. When enabling the Chrono importer add-on in blender, I received this error: https://archive.blender.org/wiki/index.php/Extensions:2.6/Py/API_Changes/#Restricted_Context. I was able to work past it by moving the following lines from register() to execute():
        # this is needed to avoid crashes when pressing F12 for rendering
        bpy.context.scene.render.use_lock_interface = True

        bpy.context.scene.ch_meshsetting_index = -1
        bpy.context.scene.ch_meshsetting.clear()

        bpy.context.scene.ch_glyph_setting_index = -1
        bpy.context.scene.ch_glyph_setting.clear()

I am very confident that was not the proper fix to the issue, but it prevented me from receiving the error. I had gotten the error with both Blender 3.5.1 and 3.4.1 on Windows. This allowed me to use it on 3.5.1. I did not try hitting F12

2: When running demo_POST_blender1.cpp, it crashed due to line 301 in ChBlender.cpp:
std::string abspath_pic_output = filesystem::path(base_path + pic_path + "/" + pic_filename + "_######").make_absolute().str();

I am running Chrono on Ubuntu, and it seems the filesystem::path::make_absolute() method requires the file to actually exist; I'm not sure if it is different on Windows. I was able to resolve the problem by creating the directory (anim/photo_######) manually.

Thanks again for releasing these updates; I'll let you know if I run into more issues when I try using them with my own vehicle simulations.

James

James Baxter

unread,
May 3, 2023, 3:04:20 PM5/3/23
to ProjectChrono
Hi Alessandro,

I tried with out with a vehicle simulation with good success. One more bug though and a question:

3. After clicking File -> New and using the chrono_import option I get this error. Closing and re-opening Blender resolves it.
Screenshot 2023-05-03 090948.png
However, to confirm, it appears that if I click chrono_import (after having already imported a simulation), it will clear the previous data as it loads the new? I do not need to fully close and re-launch the program to ensure it is using the new data?

Also, with my vehicle simulation (15 bodies in chrono_assets, none in chrono_frame_assets), I only get 5 FPS during playback. I expected it to be higher since I eliminated exporting bodies that change each frame (like springs) and used only bodies that need a new position / rotation. Is this expected behavior due to the CPU-bound task of instantiating / uninstantiating objects each frame?

Thanks,
James

Alessandro Tasora

unread,
May 3, 2023, 4:32:36 PM5/3/23
to projec...@googlegroups.com

Hi James,

Hi Alessandro,

I tried with out with a vehicle simulation with good success. One more bug though and a question:

3. After clicking File -> New and using the chrono_import option I get this error. Closing and re-opening Blender resolves it. [...]
I will look at it when I find some spare time. Thanks for reporting bugs.

However, to confirm, it appears that if I click chrono_import (after having already imported a simulation), it will clear the previous data as it loads the new? I do not need to fully close and re-launch the program to ensure it is using the new data?

Yes, all times you perform the chrono_import menu, it clears the previous data and loads the new data.

Few caveats, anyway: it is not 100% sure that there will be "leftovers" at each call to chrono_import... to be on the safe side, you might run the Blender menus under  File/Cleanup/... that remove orphan objects that are not referenced anymore.

Also, here when I want to be completely sure to start from scratch, I really close and restart Blender.


Also, with my vehicle simulation (15 bodies in chrono_assets, none in chrono_frame_assets), I only get 5 FPS during playback. I expected it to be higher since I eliminated exporting bodies that change each frame (like springs) and used only bodies that need a new position / rotation. Is this expected behavior due to the CPU-bound task of instantiating / uninstantiating objects each frame?

Yes, this is the expected performance caused by Blender instantiating/uninstantiating objects, even if the adoption of non-mutable assets should make things speedier. I think that until it drops to 1 fps, it is still acceptable as Blender is used for hi quality renderings, rather then for interactive viewing. The problem is when it becomes even slower, so also the GUI of Blender starts to act as "freezing" and it becomes not so manageable.

best regards

Alessandro


James Baxter

unread,
May 4, 2023, 12:43:26 PM5/4/23
to ProjectChrono
Hi Alessandro,

Unfortunately, Blender is crashing for me when I try to render these scenes. I've attached the log for when I render the demo simulation.

It was able to render the first couple frames (saving to a series of images, not a direct video file) before crashing. My computer's total RAM usage stayed well below 100% the entire time. This is with all renderers (cycles, evee, workbench), and I have checked that I can render simple animations (a manually keyframed box that jumped around a bit) without crashing. I also ran the blender benchmarker and it didn't seem to have any problems.

Therefore, I believe the issue is caused by the chrono_import tool, not by inadequate hardware or a bad installation. Please let me know your thoughts.

Thanks,
James
demo.crash.txt

Alessandro Tasora

unread,
May 4, 2023, 5:07:16 PM5/4/23
to James Baxter, ProjectChrono

Hi James,

I got the same problem (crashing when rendering animations) but I fixed it by turning ON the "lock interface" feature.

Please check the menu  Render/Lock Interface: is it turned on or off? By default it is off.

Anyway, In line 1964 of chrono_import.py I added

    # this is needed to avoid crashes when pressing F12 for rendering  
    bpy.context.scene.render.use_lock_interface = True

and this means that the lock interface feature should be already turned ON as soon as you register the plugin...

This said, maybe the crash is caused by something else.

Let me know

Alessandro

James Baxter

unread,
May 5, 2023, 3:46:07 PM5/5/23
to ProjectChrono
Hi Alessandro,

I believe that was the issue. Earlier I mentioned that I had to move that line due to an error it was giving me with the most recent version of Blender.

"""
1. When enabling the Chrono importer add-on in blender, I received this error: https://archive.blender.org/wiki/index.php/Extensions:2.6/Py/API_Changes/#Restricted_Context. I was able to work past it by moving the following lines from register() to execute():
        # this is needed to avoid crashes when pressing F12 for rendering
        bpy.context.scene.render.use_lock_interface = True

        bpy.context.scene.ch_meshsetting_index = -1
        bpy.context.scene.ch_meshsetting.clear()

        bpy.context.scene.ch_glyph_setting_index = -1
        bpy.context.scene.ch_glyph_setting.clear()

I am very confident that was not the proper fix to the issue, but it prevented me from receiving the error.
"""

-James

Alessandro Tasora

unread,
May 5, 2023, 4:19:28 PM5/5/23
to projec...@googlegroups.com

hi James

-  effectively, I never noticed the "restricted content" error when enabling the add-on because I rather load the chrono_importer.py in the Scripting editor, then I press the  > button ("Run script")  all times I start Blender, because I use it for development so I want to keep it under my hands... And that error never shows up... I must check this issue asap because most people will use the add-on with the conventional installation procedure.

- I must say that the bpy.context.scene.render.use_lock_interface = True  statement (or the equivalent GUI menu Render/lock interface) should fix the rendering crashes, but I heard that some people still experience some random crashes when rendering long animations, in general when using Blender. Should this happen, please report.

thanks

Alessandro

Alessandro Tasora

unread,
May 5, 2023, 5:11:58 PM5/5/23
to James Baxter, ProjectChrono

Hi James,

I released a fix to the chrono_import.py Blender add-on, just 5 minutes ago.

- now you should be able to install and enable it without the "restricted content" error

- once installed there is the button that opens the browser to the documentation of the add-on on Projectchrono.org

- the "bpy.context.scene.render.use_lock_interface = True"  trick cannot be invoked at the add-on registration (again, the "restricted content" limitation), so I just moved it in the code that is called all times some simulation is load from disk. This should turn on the lock interface even more than needed, but this workaround is sufficient to avoid troubles.

NOTE: the new release is not in the main branch: currently you can find it in the features/geometry  branch, because I was in that context when I pushed the commit.  It will be merged with the main branch soon, anyway.

A.

Reply all
Reply to author
Forward
0 new messages