home about gallery publications education links contact

..::starfield (nebula 1/2)::..

If you really want to go for a totally realistic starfield background, it’s quite simple to produce - just slap on a black colour with nothing else on there. The reason for this is that a camera cannot pick out the small amount of light visible from stars without a long exposure; have a look at the Apollo images and any of the more recent shuttle orbit images and movies available online and you will see that there is not a single star visible. However, this looks seriously boring in film (although giving the audience a pretty heavy sense of unease and claustrophobia), so we try to simulate what the naked eye would see… a nice background with a bit of artistic licence of course!

As this Q&A covers two separate items - the starfield and the nebula, we will split it across two papers because of the complexity of each one, starting with the former. Looking at the night sky on a clear night, we notice that there is a variety of formations and constellations, plus dense clusters of stars in some areas and little or no (visible) stars in others. We also have some slight colour variation which would be interesting to add to break up the monotone black and white. Additionally, looking at several blockbuster scifi movies, we have extra detail with patches of dust clouds scattered across the heavens.

As you most likely know, there is a starfield filter that is accessible as a Video Post filter, however this outputs a uniform background that does not look realistic as we don’t have the clumping effects or enough star size and intensity variation that is required to produce a convincing enough result. Therefore, we are going to be using a heavy procedural map tree to generate the entire background so it renders in a single pass once applied to the environment background. By default there is no motion blur, but this can be enabled in the render panel.

The stars themselves will be created by using three nested Cellular maps using XYZ mapping on the environment so that we don’t get any map stretching or pinching; a large one to generate the few “hero” stars by amending the Spread and size, a medium one to populate the majority of the environment also with a different spread and size, and small ones which are masked out using a couple of Noise maps to create cluster patches. This entire tree is masked using a nested Noise map tree of different noise sizes to generate irregular formations, and is also mixed with a slightly amended version of the Noise map tree to create dust clouds where there are collections of prominent stars. These dust clouds have additional detail added by amending its sub-map to subtract intensity so we get some interesting dark patches in the map. To add a hint of colour to the large and medium stars, a couple of colourised Noise maps are included in the main Cell Colour slots of the large and medium star Cellular maps. Finally, this entire map tree is instanced to the environment background. The construction process is relatively straight-forward, however due to the amount of maps required to generate the desired result it is vital that we name each map accordingly so we do not get lost!

We can use the Panoramic Export feature in 3ds max’s Rendering pull-down menu to output a map, which can be brought back in and mapped onto a sphere with spherical UV mapping; the sphere can then be resized as desired without affecting the resulting texture map. Exporting the map also gives us the ability to edit it in a third party paint application such as Photoshop to tweak star placement and add voids and denser debris. However, this map should be high enough to get a nice result when mapped back on to the sphere and rendered else we may see artefacts and/or blurring due to distortion; it might be worthwhile producing additional decal detail textures to overlay on top of the procedural map tree to prevent this.

In the next paper we will finish off the scene with a detailed and colourful nebula effect that we can apply to our background by mixing it in with our starfield tree so it again renders off in a single pass.

Enlarge Screenshot Open up the Material Editor, create a new Mask map in a material slot and label it Stars. Add a Mix map to the Map slot and label it Star Dust Mix. Add a Cellular map to the Mix map’s Colour 1 slot and label it Star Big. Set the Cell Size to 4, Spread to 0.003 and Mid threshold to 0.9
Enlarge Screenshot Add a Cellular map to the second Division Colour slot and label it Star Medium. Set the Size to 1.5, Spread to 0.005 and Mid Threshold to 0.9. Add a Noise map to the Cell Colour slot and label it Star Colour Blue. Set the Size to 1, High to 0.401 and Low to 0.1. Set the Colour 2 swatch to RGB 185,254,255 and its Output to 2.
Enlarge Screenshot Copy the Noise map into its Colour 1 slot and label it Star Colour Red Yellow. Set the Phase to 10, Colour 1 to RGB 254,255,191, Colour 2 to RGB 255,173,173 and set the Output Amount to 1. Instance the Star Colour Blue map into the Star Big’s Cell Colour slot so that both Cellular maps have the coloured Noise maps in their Cell Colour slots.
Enlarge Screenshot Add a Mask map to the Star Medium’s second Division Colour slot and label it Star Small Mask. Add a Cellular map to the Map slot of the Mask map and label it Star Small. Set the Size to 0.5, Spread to 0.03 and Mid Threshold to 0.9. Add a Noise map to the Star Small Mask map’s Mask slot and label it Star Small Patches. Set the Noise Type to Turbulence, Size and Levels to 10, Low to 0.15 and Output to 2.
Enlarge Screenshot Copy this map into its Colour 2 slot and label the copy Star Small Patches Breakup. Set the Size to 5 and Low to 0.1. Back at the top of the map tree, add a Noise map to the Stars map’s Mask slot and label it Star Large Mask. Set the Noise Type to Turbulence, Size to 100, Low to 0.3 and Levels to 10. Swap the colours, open the Output rollout, check on Enable Colour Map and set the colour map as shown.
Enlarge Screenshot Add a Noise map to its Colour 1 slot and label it Star Medium Mask. Set the Noise Type to Turbulence, Size to 40, Levels and Phase to 10. Copy this map into its Colour 1 slot and rename the copy Star Small Mask. Set the Size to 10, High to 0.735, Low to 0.3, Phase to 20 and the Colour 1 swatch to RGB 15,15,15. (continued in the Tips column)
Enlarge Screenshot The end of the first part of this two-part Q&A gives a quite convincing natural background thanks to the large amount of procedural maps used which breaks up the effect.
Download the max file! Zip file to accompany.


Copy the Star Medium Mask map into the Star Dust Mix map’s Mix Amount slot and rename the copy Dust Cloud Large. Swap the Noise map in its Colour slot 1 into Colour slot 2. Go into this sub-map and rename it Dust Cloud Detail. Set the High to 0.75 swap the colour swatches and set the Colour 2 swatch to black.

Add an Output map to the Star Dust Mix map’s Colour 2 slot and rename it Dust Strength. Set its Output Amount to 0.5 and instance the Dust Cloud Large map into its Map slot. Open the Environment panel and instance the entire Stars map tree into its Environment Map slot. Set up a camera animation, open the Render panel, go to the Renderer tab and enable Apply to Environment Map. Render off the animation.

The end result is quite convincing, but we can adapt it further by adding a few additional mask maps to control the intensity of the distribution. For example, try adding in a Gradient Ramp map set to Spherical Environment mapping (you will have to rotate the gradient 90 degrees around the Z axis) and design the gradient so that it fades in and fades out from the central flag (black to white to black). This can then be used to mask out the entire map tree so we have more prominent star distribution around the “equator” of the environment which simulates the dense star formations around the Milky Way. The gradient should be quite noisy and clamped to create patches so we don’t get any intensity difference in the stars, just a reduction of the amount of stars present as we get further towards the “poles”. We can further control this by adding sub maps in the gradient’s flags, and also having a separate gradient ramp mask setup to control the dust cloud distribution.

Initially published: 3D World magazine, Issue 59, December 2004.

Copyright Pete Draper, December 2004. Reproduction without permission prohibited.