Unity is a very powerful tool, as has easily been shown in several of my blog posts. You can use it for virtually any type of game, and create things extremely rapidly. One subset of Unity’s power is the asset store. The Unity community makes a vast quantity of assets for the engine that do a wide array of things. Some of them are simply rigged meshes of people walking. Others are UI enhancements and all kinds of other things. I am using one asset set in my game, the Space Graphics Toolkit, or SGT.
SGT is created and maintained by Carlos Wilkes. His primary website is here:
https://sites.google.com/site/carloswilkes/
It is available in the asset store for $75 USD. Honestly, it is perhaps the best $75 I have spent for any project I have worked on. I use a number of the components from it to create my scenes, elliptical starfields, nebula generators, shaders, atmosphere, cloudsphere, corona, prominence, and several textures and sprites. It took my graphics from primitive to awesome in about 5 days.
To give you an idea of what is going on here, I am going to explain how to create a really nice looking Earth.
- Create a new sphere game object in a new scene.
- Adjust the default scene’s light source to be emitting along either the X or Z axis.
- Add SGTAtmosphere as a component to the sphere.
- Add SGTCloudsphere as a component to the sphere.
- Change the material of the sphere to a material called “Earth” available in the free solar system pack. It should already have the default Earth textures applied to it. If it doesn’t, I recommend the 4096 pixel Earth main texture. The others should be fairly obvious from my series of screenshots.
- Change your sphere’s mesh to a geosphere (I used Geosphere40 in this example, the others have fewer triangles, so do what you need)
- In the SGTAtmosphere component controls, there will be a red alert. This is because a mesh has not been assigned to the atmosphere. Assign the SAME geosphere that you assigned to the planet.
- In the SGTCloudsphere component controls, there will also be a red alert for the same reason. Assign the SAME geosphere that you assigned to the planet.
- The SGTCloudsphere has one other alert. It needs a texture. Choose Earth_Clouds.
- Now you will see that your cloud layer is significantly outside your atmosphere. Reduce the radius on SGTCloudsphere to the SAME setting you have in your SGTAtmosphere’s height plus one. For example, the default atmosphere height is 0.1, therefore I decrease my cloudsphere’s height to a maximum of 1.1. I set mine to 1.025, which gives the impression that the clouds are inside the atmosphere.
- On both the cloudsphere and the atmosphere, under “Lights”, change the value to 1.
- Use the assignment button and assign your default scene’s light source for each of these.
- In the SGTAtmosphere component, turn on scattering, and ground scattering.
- Change the Color on SGTAtmosphere to a blue.
- If your atmosphere is thicker, you will want to set your inner renderer to the sphere’s renderer. I did not in this example.
Now, move your camera around your planet to see your handy work.
This example took me about 2-3 minutes total, and some of that was because I had to scroll through materials and meshes, plus pick a good spot for the camera.
Atmospheres look even better if you use a point light about the same relative size and distance of the sun instead of a directional light. This is what I do in my game.
For reference, here is the inspector for the final game object, and the material.
I hope you have enjoyed this blog entry, and have a nice weekend!