I think itās a floating point precision issue as the orbital ranges you have vary from 0.0001 to 100000, which would cause rendering glitches scene wide. It probably explains why planets arenāt showing at those scales either, but when 100000 is changed to 1000 everything works (planets and greased line orbits). I see now the planet positions exceed camera.maxZ so thatās why they donāt show at those extreme ranges, but I still think youāre hitting a hardware floating point precision limit.
You might need to consider scaling everything down and/or implementing floating origin and/or breaking geometry up into tiles.
Thanks for investigating! I am making a 1:1 scale space game so those precision issues are often a challenge ^^ What I donāt get is why the simple lines work while the greased lines are glitchy: I would expect the lines to have the same issues.
Even if the scale is large, space is mostly empty so z-fighting is not an issue for the orbit lines, so I still have hope!
This PG already has the camera at the origin so floating origin will not improve the precision further unfortunately Breaking the geometry into tiles might be the solution if I canāt fix greased lines yes
Guys, sorry for the late reply Iām quite busy these daysā¦
So, @inteja is absolutely right. Itās all about loosing the correct vertex positions due to precision loss in the vertex shader. float32s has only 23 bits mantisa so every value beyond 10^7 gets only 1 unit precision at the end.
The solution would be the floating origin approach proposed by @inteja and if I can recall it correctly, you already posted some question about this technique.
The problem is the vertex positions are too far from the camera origin. You could rescale the positions and/or use a separate dybamically positioned camera for the orbit lines.
Surely it will introduce complexity to your code but unfortunately I canāt come up with any other solution.
I used Babylon 7.21.4 at the time so there might have been a regression since then. I will try to narrow the version range a bit so itās more useful
Unfortunately thatās not really possible if I am making a 1:1 scale solar system, the camera might be around some planet and should still be able to see the orbit lines of planets far away.
For now, I will keep things simple and stick to thin lines
It fixed the issue with rendering lines really close to the camera. Unfortunately, it also unleashed the bug you sensed in the Force. Sorry about that, my fellow Jedi.
Iāll be off on a brief retreat to a distant system for the next 10 days, but once I return, Iāll face this bug head-on and bring balance to the PR.
Your vigilance has not gone unnoticed, thank you for reporting this disturbance in the codebase. The Dark Side respects such keen observation!