After a month of hard work, the procedural stars became more or less decent.

Implementation details

  • Hierarchical octal tree, 10 levels, nodes of level 0 contains the brightest stars, level 1 - weaker stars, ..., level 9 - dim red dwarfs.
  • The density distribution of stars at the nodes corresponds to a typical luminosity function for the vicinity of the Sun.
  • Generation of stars according to the shape of the galaxy, taking into account subsystems (spiral pattern, disk, bulge, halo), exponential decrease in density with distance from the center and disk plane, and distribution of stars by type (there are many bright young blue giants in spiral arms).
  • Generation and removal of nodes and stars in them on demand during flight through the galaxy; thus, if you fly around the entire galaxy, you can count hundreds of billions of stars.
  • When star in a node is being generated, a unique seed is assigned to it, so the same stars are always created at the same places.
  • Nodes of the lower level (dwarf stars) are repeated many times, but since the highest nodes are unique, you can't see "the same constellations" anyway.
  • You can fly to any star, click on it and search it by typing its "name" (a unique set of numbers consisting of the galaxy index, tree level number, node number, and star index in the node);
  • Pictures

    The starry sky is somewhere in the disk of the Milky Way galaxy. Nothing fundamentally different from our own sky:

    Spiral arms, the brightness of the stars is increased:

    Some procedural star:

    In general, the performance seems to be not bad, considering that about 100 VBOs are rendered in each frame with a total number of stars of about 300 thousand. The search for a nearby star - a candidate to be added to the renderlist of planetary systems - performs very bad. There are no planets yet, but the star model should be added to the renderlist anyway. In short, this search has to scan through 300,000 stars, and it is performed on CPU. As a result, it slows down performancr to 150 fps, while it could be 300-400.

    The generation of stars is quite fast, you can safely fly at a speed of 1 kiloparsec per second (the diameter of the Milky Way is about 30 kiloporsecs): everything has time to be generated without noticeable brakes. If you fly faster - then yes, there will be "seams" (empty blocks of space). So far, I've added a cheat: if the camera speed is too high, the tree recursion depth decreases, so the lower nodes, which contains the most of the stars, are not generated. Although this looks somwhat glitchy, as if the density of stars is suddenly decreasing.

    And finally: WIP motilon blur of stars: