As we let you all know in our last post, one of the main focuses of the next release was star picking. And now it’s here! The second focus was performance, and we teased the possibility of using immense star fields with millions and millions of stars.
The work that has gone into this has been one approach solving two problems at once. Turns out that both star field generation and star picking, both with high performance in mind of course, could be implemented using the same basic principles.
All stars are now segmented spatially into segments that can be quickly evaluated in a ray intersection test. This means performance in picking (although deferred to a separate thread in order to avoid hitches in smooth rendering), is quite high! With a good setting to spatial segmentation, picking usually completes within 20-50 ms. And it doesn’t even matter if you have 10 000 or 100 000 000 stars on screen at the time! Only when you star reaching the really high numbers will you see a degradation in performance here, and that is really only because very high values to spatial segmentation will eventually become a problem.
Star field performance
We said millions of stars will not be a problem, so how far did we get?
Well, on a standard PC we got it working without a noticeable performance degradation to about 100 trillion stars. Yes, 100 trillion (in the American system, mind you). That’s 14 zeroes, and we think that should be enough for anyone! If it isn’t enough for your use case, let us know and we’ll see what we can do!
So what kind of performance can you expect with the rest of your game running alongside this? Well, the only thing that limits you is your settings. The star field generation is split into bright and dim stars. The former are rendered all over the galaxy at all times and the latter are rendered only when required. Still, star generation and picking performance is largely dependent on your setup. If you need guidance with setting these values right, please refer to our support website or the documentation PDF included with the asset.
Minor tweaks and fixes
Last, but nonetheless important, are a number of little bug fixes and tweaks. The Galaxy volume will now fade down its exposure a bit when the camera enters it, in order to not wash out the image too much. We fixed a problem that would cause release builds to fail and we made sure that namespaces were up to date throughout the supplied code.
And the joker!
We had one of our users ask us the other day whether this asset supports Virtual Reality. Truthfully, we had only tried it quickly a few times and never thought to officially support it. Although we still don’t feel quite comfortable in saying that we officially support it, it turns out it worked almost out of the box! One little initial hitch, and they got it working just fine! How cool is that, eh?