Creating a Star Field

One of my favorite things is to fly through a star field in the dome. Its those particular moments when the dome seemingly disappears and your imagination takes over. Its truly a majestic and thought provoking experience. But how can you make a star field thats easy to manipulate and renders efficiently?

In the spirit of creating a star field that is reusable but still realistic, we chose to mimic the star distribution of a main sequence star field. Of course its all editable if you need. But for all practical purposes this template works beautifully for a flight between star systems. You just need to choose the density of stars.

We decided to go with four different star colors that are the foundation for all the star sprites. They are designed to simulate the look of Sky-Skan’s DigitalSky stars since we use DigitalSky for our star globe backgrounds. You would think that only 4 different star color images being repeated thousands of times on the star sprites wouldn’t be enough variability. But the truth is that within the dome its all about the immersion of flying among the stars. Everyone is focused on the grand sense of scale.

Each of the four star colors gets its own particle emitter.
There are two reasons for this:

1) We can easily control the amount and scale of the orange, yellow, white, and blue stars. Meaning that for each star color we can keep the emitter rate equal to the distribution of star types of a main sequence star field. We can also force an allowable range for the scale to be randomized. This means that the colors of stars can correlate to the average size of the star.
2) Mental ray doesn’t play nicely when the particle shape node has more than one texture. There are some hacky solutions for this, but this multiple emitter solution actually grants us more control of the spites since we can manipulate the star color groups individually. Sometimes you just gotta kiss it.

Star Field Stats
— Emitter1: Orange stars – 5000/sec – scale .8 to 1.2
— Emitter2: Yellow stars – 4500/sec – scale 1 to 1.5
— Emitter3: White stars – 600/sec – scale 1.5 to 2
— Emitter4: Blue stars – 300/sec – scale 2 to 4

Whats happening here?
Maya has an excellent particle system that is fisheye compatible. So we use a spherical volume emitter and adjust the ‘away from center’ to 0. This insures that particles are emitted randomly throughout the volume and stay stationary. We use sprites as the particle render type. Sprites are simply a special type of image plane that will always face the camera. We then map a texture onto the image plane. This texture is an stylistic image of a star; I created it from scratch in Photoshop. All of this is already setup in the star field template maya scene. I’m just sharing a bit of framework thoughts for those interested.

maya scene – star field template

(Either read below or see the tutorial to the right)
starfield-tutorial1) Open the StarFieldTemplate.mb maya scene file.
2) Make sure you have your scene project setup. Otherwise your initial state will get lost when you open up this scene again.
3) Choose density by ticking the timeline frame-by-frame. I always tend to need much more than I initially imagine. Try placing a test camera in the star field and doing some renders.
4) When satisfied, set an initial state for each of the 4 particle shapes.
5) Zero out the rate for each of the emitters. (but do not ever delete them!)
6) Delete the ppScale creation expression for each of the emitters.
7) Done! Now you can scrub the timeline and the sprites are locked in place. Try a test render!

Don’t Add Lights to the Stars
These stars don’t need to be lit with a light. They have incandescence that makes them self-lit. Any added lights should be light linked away or else it will contribute to lighting the sprites and make the stars brighter than expected.

If you have any issues rendering the sprites…
Go to the Render Globals / Quality / Raytracing / Acceleration / Acceleration Method: change to Regular BSP. Then try BS2.

Editing the Randomized Scale Range
1) Go to the sprite shape node in the attribute editor / Per Particle (Array) Attributes / right click on ‘Expression…’ next to Sprite Scale Y PP / click Creation Expression.
2) Edit the numbers in the last part of the expression text area: rand(.8,1.2)
3) When finished, click ‘Edit’ in the Expression Editor and then close.

Hide Certain Sprites within the Star Field
1) Set your particle lifespan to ‘lifespanPP only’.
2) Right click on the particles and enter component mode.
3) Go to Window > General Editors > Component Editor
4) Find the ‘Particles’ tab, then find the ‘lifespanPP’ field.
5) Now you can select the sprites you want hidden in the viewport. Then type in 0 for their lifespanPP in the Component Editor.
6) After finished, you MUST initial state (again).


One thought on “Creating a Star Field

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s