Procedural galaxy and streaming

That’s an interesting system! But I think a simpler approach can be beneficial.

For my own project I use a dynamic floating origin: the camera can move but if it gets too far from the origin (let’s say a few kilometers), I translate everything back in place.

This way I get maximal precision where the camera is, and it plays more nicely with physics engine than having the camera always at the origin.

I think it is also simpler to manage as the logic is simpler and no hierarchy is required :+1:

as @crashmaster already mentioned:

Good ressource! I just feel this one is a bit weird because we have to create entities for everything somehow? I just take all the root nodes of the scene and translate them by the opposite of the camera position and it works nicely ^^

1 Like

yep, I am already using that. I think I will have to a make “planet root origin entities” as well.

This probably means I then cannot leverage BJS local/world/absolute coordinates (on an orbit) and have to compute that myself.

I have an idea, but not sure what the best way would be to:
1 take a node rotation vector (rotation was previously set using mesh.rotation.x|y|z)
2 from this vec3, build two normalised vectors normal to it, but also normal to one another

For precision issues maybe storing rotations as quaternions can be an improvement as well. If you have the position and the rotation, then it is not far fetched to use your own coordinate systems :slight_smile:

I also wondered, did you use a LineMesh for the orbit rendering? Your orbital lines looks really nice :ok_hand:

Yep simple line meshes

FYI, on my slow poke machine, line meshes (as in MeshBuilder.CreatelLine) are very slow. I use them for debugging and do get fps hits with only a few lines active. GreasedLine (or TubeMesh) is a good replacement.

ho :frowning: and have you tried flying around a galaxy? Did you experience crap perf?

GreasedLine - the non camera facing version is the best option, I believe. One thing is especially helpful here:

const position = BABYLON.GreasedLineTools.GetPositionOnLineByVisibility(
  planet.lineSegments, planet.orbitLength, planet.planetOnOrbitPosition

Yes, it’s like yours, just wanted todo it myself too: :slight_smile:

1 Like

Sorry for the confusion. No slow downs yet. Just a heads-up!

This looks really nice :ok_hand:

Thanks but Nope! :smiley: This looks very basic! :smiley: just playin’ around