Announcements | Projects | Lectures | Syllabus | Gallery | Tutorials

Creating a basic starfield in maya

Joshua Javaheri

Setup:

  1. Download the starfield generator from highend3d.com located here: http://www.highend3d.com/maya/downloads/mel_scripts/dynamics/2942.html

  2. Navigate to your Maya installation folder and open the scripts subdirectory. Paste the .mel file that you downloaded into this folder. Keep this folder open.

  3. Startup Maya and create a new scene. Name it “starField.ma” or something recognizable, and save it somewhere for future use.

  4. In your new blank scene, go to the layer editor and create a new layer. Name it stars. Give it a recognizable color. I like yellow because its bright.



  1. We are now ready to begin creating the starfield.


Creating the Starfield:


  1. On your new scene, drag the starfield generator (.mel) script directly into your scene from explorer. Close explorer.




  1. I don't know why this works, but I was unable to call the function in the script without first dragging and dropping it directly into the scene first. Once you have done this, go to the command line (normally bottom left hand corner) and type “starField” without the quotes. Hit enter.




  1. A window should pop up with a few settings. Change them to those on the image below and hit “Generate Stars!”





  1. This will generate a particle system object that randomly places particles within the minimum and maximum radii specified. Once it finishes generating, add the object to the layer you created earlier. You should see something like this:




  1. If your views clipping plane does not allow you to see the stars when you zoom out, either scale the particles down or adjust each camera view's (accessible through the outliner) “far clip plane” attribute to something massive like 100,000. If you are doing a massive space scene, you might as well learn how to do that because it will be a problem in the future if you don't.

  2. Now that we can actually see our particles, its time to play with the settings. Before you do anything else, lets give the particle object a good name. Call it “dullStars” or something like that in the outliner.

  3. If you notice, the script creates particles of type “point,” which is only renderable in hardware shading mode. Since I don't like hardware rendering for what I need, I need it to render in software mode. In the “channel box / layer editor” highlight the dullStars shape and scroll down to the “Particle render type.” Change it to “clouds (s/w).”





  1. If you noticed, our points are now little circles. Open the hypershade editor and double click on the default particleCloud shader to access it's attributes. Change the attributes to match mine in the image below:



  1. Select the starfield that you just created and with the hypershade editor out, right click and hold on the particleCloud shader you created and select “Assign material to selection.” I don't think simply dragging the material onto the stars work.

  2. Center your perspective camera at the global origin and render the image at any angle. The stars show up and a post process glow effect is just slightly noticeable. This is your basic starfield!





  1. I would suggest making a few different starfields and overlaying them on top of each other to get a variance of color and size. By playing around with the radius attribute in the particle's settings you can make all of your stars larger or smaller. With a combination of stars and paint effects, you can get something pretty realistic and breathtaking. If you have any questions about creating a starfield, email me at jjavahe@admin.ufl.edu or just ask me in class. Good Luck!

 

© Brent Rossen • 2012, All rights are reserved