Stars Component

The Stars component provides physically-based animated resolution-independant distant stars.

Stars are rendered as billboards that have a white center that fades out to the star color on the edges. The billboards are projected onto the far plane, and the brightness of each star changes over time to create a “twinkle” effect. The orientation of the entire star field is controlled by the Transform component of the entity that contains the Stars component so that you can rotate the star field to simulate the rotation of the earth.

An example of the star field that this component generates

Provider

Stars Gem

Properties

stars-component-base-properties

PropertyDescriptionValuesDefault
ExposureSpecifies the exposure to use when rendering the stars in the scene so you can control how bright the stars are.0.0 - 32.01.0
Radius FactorSpecifies the factor to multiply every star width and height by so you can set the size of stars.0.0 - 64.07.0
Stars AssetThe Stars binary data file to use for every star position, color and brightness.default.stars
Twinkle RateSpecifies how frequently stars twinkle.0.0 - 10.00.5

.stars binary data file format

The engine includes a default.stars asset that you can use to create a star field. To create your own custom star field asset, you need to generate a binary .stars file with the following data:

FieldDescriptionTypeValue
File Type TagThe first entry in the .stars file must be the “STAR” taguint32_t0x52415453
File VersionCurrently only one version is supporteduint32_t0x00010001
Number of starsThe number of stars in the fileuint32_t
StarsPer-star data structures (see below)Star

The Star binary type is a structure in the following format:

FieldDescriptionType
AscensionRight Ascension in degrees (0.0 - 24.0)float
DeclinationDeclination in degrees (-90.0 - 90.0)float
RedRed amountuint8_t
GreenGreen amountuint8_t
BlueBlue amountuint8_t
MagnitudeStar magnitude (brightness) amountuint8_t