This behavior is highly configurable and you can reach several different types of results by tweaking these parameters. The star field generated is normally split into a bright star field (one which is always visible irrespective of the camera location) and a dim one which is streamed in and out on the fly during runtime. Here’s what the parameters all mean:

Star material

The material applied to each star generated. This of course includes the shader and hence brightness behavior of all individual stars.

Default: Stars (supplied with the package)

Total star count in Powers of Ten

The total amount of stars generated in the container will be ten to the power of this number. 4 produces 1 000 stars and 12 produces one billion stars.

Default: 8, resulting in one hundred million (100 000 000) stars

Color variance, R, G and B

Here’s where you define the color spread of your generated star field. The spread is defined as a random interval added to a base color. This implementation has a base color set to full white (1,1,1,1), meaning that a variance value of 0.5 puts the result in the range of ]0.5,1]. Setting the variance to 0 only produces white stars.

Default: 0.5, 0.35, 0.5

Bright star multipliers

Some values for the bright stars are calculated based on the dim stars as a baseline.


This value represents a multiple of the dim stars. If the dim stars have the baseline of 1 and this value is set to 50, the bright stars will be 50 times as bright (read big).

Default: 10

Part of total in Powers of Ten

One of the major points of working with both a bright and a dim star field is to allow for some stars to always be visible at great distances, making the galaxy feel more “alive” if you will. The value is a negative power of ten which is multiplied with the total number of stars to calculate the total number of bright stars.

For example, if the total number of stars is 10^6 and this value is -3, there will be 10^6 * 10^-3 = 10^3 = 1 000 bright stars and 1 000 000 – 1000 = 1 999 000 dim stars.

Another example may be putting this value at 0, letting the bright stars represent all stars. This deactivates the dim star generation completely. This may suite your needs if you don’t want an immense number of stars, but be careful with this if you want a lot of them! This basically bypasses the numerous performance optimizations that the dim star field provides and the bright star field does not.

Default: -3

Spatial subdivisions

In order for the star field generation to properly distribute stars across the full galactic plane, and at the same time allow for a number of optimization schemes, the galaxy volume is split into a number of “buckets”, each containing a number of stars. This value represents how many buckets the full space is split into along each axis. For example, a value of 10 yields a total of 10*10*10 = 1000 buckets.

The minimum is 1 and 32 for the bright and dim stars respectively but even for a small number of total stars it is not advisable to set this value too low. Partly because it limits the star distribution function to do its work properly and partly because enough stars in one bucket limits the picking functionality to do work properly. It also hinders star field generation performance.

Adversely, setting especially the dim star value too high – while allowing the picking function to run very quickly – prevents bucket lookup and generation from running in a quick fashion. Setting the bright star value too high will also cause the initial bright star generation to take more time, especially if the number of bright stars is high.

Bright stars

This value refers to the number of buckets the bright stars are divided into.

Default: 20

Dim stars

This value refers to the number of buckets the bright stars are divided into.

Default: 200

Hitbox size multipliers

The picking algorithm uses generated hitboxes to detect what stars are affected by a user click and returns the closest star that was found, provided it was not already selected. When stars are very small, the hitbox size should be small. When they are bigger, picking feels better if the hitboxes are also bigger. The same goes for few versus many stars. The more stars, the smaller the hitboxes should be in order for picking to feel like it’s working well.

Bright stars

The hitbox size multiplier for bright stars.

Default: 0.3

Dim stars

The hitbox size multiplier for dim stars

Default: 0.1

Star fade modifiers

When the camera moves towards and away from a given star, it’s brightness is calculated using a non-linear falloff function. This function is parameterized in a way to allow for custom brightness behaviors depending on your needs. The mathematical function itself is defined as the following:

Plotted, it looks something like this:

…where, in the behavior parameters, the mapping looks like
a = Near Falloff

b = Near phase

c = Far Falloff

d = Far phase

x = Distance from the star (normalized by the galaxy size)

Bright Near falloff

Default: 4

Bright Near phase

Default: 0.8

Bright Far falloff

Default: 0.5

Bright Far phase

Default: 2.3

Dim Near falloff

Default: 7

Dim Near phase

Default: 0.5

Dim Far falloff

Default: 0.8

Dim Far phase

Default: 1.5

Camera tracking

This bit controls the space which is taken into account when the camera view is evaluated in order to update the what dim star regions to add or remove to those that are currently rendering. Simply put, a hitbox is generated on the target camera, the bounds of which are then used to track what star fields go in and out of view. We use a box instead of a frustum, as it’s better fit when very roughly taking into account how the camera is able to move.

View distance multiplier

This value is a multiplier of 1 percent of the Euclidian galaxy size (the local scale of parent galaxy object), i.e the length of the localScale vector on that object. Be careful not to set this value too high as it, together with the spatial subdivision setting, can either make or break your star region generation performance. In the Demo Scene, this value is set to roughly double the distance of the camera star visibility range, given how the shader is configured.

Default: 1

Elongation multiplier

This value is a simple multiple added along the view axis (local z) of the camera hitbox. If you need the view distance to grow, this is the value for you. A value of 1 produces a cubic hitbox. A higher value elongates the hitbox and a lower value shortens it.

Default: 2