Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shuttle example - export rendering as glb not working as expected #492

Open
amscosta opened this issue Dec 6, 2024 · 9 comments
Open

shuttle example - export rendering as glb not working as expected #492

amscosta opened this issue Dec 6, 2024 · 9 comments

Comments

@amscosta
Copy link

amscosta commented Dec 6, 2024

Hi,
Just adding the following piece of script at the end of the shuttle example:
glbdata = session.geometry()
with open("simple_example.glb", "wb") as fp:
fp.write(glbdata)

Results in .glb file like this:
Image

Wondering if somebody know how to make the glb including all the expected renderables from the shuttle example?
Best,
P.S. Actually, the legend is also not visible in the glb (only using the GUI and exporting as .AVZ)

@mariostieriansys
Copy link
Collaborator

Hi @amscosta,
you can export an AVZ file directly from PyEnSight, without the EnSight GUI.

You can do it with the following commands:

avz = session.show("webgl")
downloaded = avz.download("test_folder")

The first command will create for you a Renderable object, that JupyterNotebook will display for you automatically; otherwise, you can access avz.url to get a URL that you can browse to visualize the AVZ model

The second command, available as a method for the Renderable, allows you to download the file into the input folder. It returns the list of file names downloaded

As concerning the glb export, I believe the legend and the renderable missing (I assume you are talking about the streamlines, being the shuttle example) are not supported

@amscosta
Copy link
Author

amscosta commented Dec 6, 2024 via email

@mariostieriansys
Copy link
Collaborator

@amscosta

Standard glb file have no notion of a 2D rendering plane, so we cannot physically put stuff like legends, annotations, or any kind of overlay, differently from AVZ.
So, right away we cannot solve that, it is just a limitation of the glb format.

However, we are working on GLB extensions that will allow us to add these exports. There will be though the need of a renderer that can handle it.

Potentially in the future we might have a viewer that can handle these extensions.
Or, you will be able to load these GLB files and convert to USD format via the Omniverse pipeline we are designing, and using the VR headset on NVIDIA Omniverse should allow you to view these items (loading the USD format)

@david-bremer
Copy link
Collaborator

If the VR headset is running on the same machine as PyEnSight, PyEnSight can drive a headset directly. Set the environment variable CEI_INPUT=openvr in the shell before starting PyEnSight. If SteamVR is up and running, EnSight will display its scene on the headset. EnSight will draw annotations like the legend on a big rectangle floating in space, in the VR environment. There are some scene centering and scaling preferences you might have to set interactively (and save) from EnSight to make it look nice.

Alternatively, EnSight can export Jt scenes, and the Jt file contains a legend. If your VR viewer reads Jt, and displays legends from Jt files, that might be an option.

@amscosta
Copy link
Author

amscosta commented Dec 6, 2024

Thanks for the output. Thinking about using background (with legend picture) or a projected surface with the ordered legend colormap. As in the following pics:
Image
Image

@randallfrank
Copy link
Collaborator

@amscosta Just in case there was another aspect of this export we might have missed is that you may have originally been commenting about missing geometry? When exporting geometry from EnSight, it only exports the selected parts, so you may have to select all the parts before calling show. I did a: session.ensight.part.select_all() and generated the attached GLB file. rjf2.zip

If the original question revolved around not seeing all the objects you expected, try selecting all the parts before exporting the GLB file.

@david-bremer
Copy link
Collaborator

@amscosta Yes, saving the annotations as an image could work, if you're building something custom. You should be able to hide the triad and all parts, and save an image. With the png format, there is an option to save an image with a transparent background.

@amscosta
Copy link
Author

amscosta commented Dec 6, 2024 via email

@amscosta
Copy link
Author

amscosta commented Dec 6, 2024

Sharing some glbs (brake - from pyfluentvisualisation) and double (from pyensight).samples.zip.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants