I’m developing a cinematic animation in Babylon.js following ʻOumuamua, the first known interstellar object discovered passing through our Solar System in 2017.
The scene visualizes its journey past the Sun, with planets and their orbital paths in the background. As ʻOumuamua moves away, its 3D model gradually transforms into a glowing point with a luminous trail.
The issue
I wanted ʻOumuamua, including its 3D mesh, glow and trail, to render in front of the planets’ orbital paths while still disappearing naturally behind the Sun during its flyby.
However, changing rendering groups sometimes caused unexpected results. Elements either appeared behind the orbital paths or incorrectly rendered in front of the Sun.
What I’ve tried
I eventually achieved the desired result using:
-
Rendering group 1 for the orbital paths.
-
Rendering group 2 for ʻOumuamua, its glow and trail, and the Sun.
This works visually, but getting there involved considerable trial and error.
My question
Is this the recommended approach in Babylon.js, or is there a better way to manage rendering order while preserving correct 3D occlusion, especially when combining opaque meshes and transparent effects?
I’m interested in understanding whether my current solution follows Babylon.js best practices or if there are potential issues I should be aware of.
You can see the sequence here - ʻOumuamua — Interstellar Passage