Spacescape is a tool that uses Ogre to create / generate space scene skyboxes. The way it works is a camera sits inside a number of user defined layers / shells. Each layer can be a bunch of point sprites ( for stars), or a noise field (for nebulas/haze etc.) You can define how many stars you want and the color based on distance. In the screenshots I'm posting there are 7 layers. 3 of the layers are regular blue/white stars, 1 is a few red stars, 2 layers are ridged fbm noise of different colours and the 3rd layer is regular fbm noise used as a mask to make stars cluster by darkening regions of space.
This has been a really fun tool to make and I still have a lot left to do like the GUI. At present it reads in xml config files or you can use the plugin api to manipulate the skybox via code. Did I mention this will be an Ogre plugin too? I plan on releasing the plugin and tool as soon as I get a GUI and finish refactoring the save to file code.
How it works
Making a bunch of point sprites is easy. I use an Ogre::ManualObject for that with pointSprites enabled on the material.
For making the haze I create an inverted unit sphere and use a glsl shader on it that implements fbm and ridged fbm noise using Perlin's improved noise (not simplex noise). Lintfordpickle at britonia-game.com has a good explanation with code samples about how fbm and ridged fbm noise work
To create the skyboxes I just create a camera with FOV set to 90degrees and render to texture the six images of the skybox. I have it set up to render to texture the mipmap levels too, so if a user wants to save a dds file with mipmaps they can, or they can just save out the six individual images. With the Ogre plugin it will also be possible to not save out the file but just tell the plugin to create a skybox with a given config file and use it in your own application.
Here's some more images (click to enlarge - you'll need to in order to see the stars better):
A note about dithering:
I've had a tough time figuring out what to do about gradient banding with dark colors in the space backgrounds. Without some kind of dithering or noise the gradient is very obvious. You can see the banding clearly in all the videos and screenshots I've posted prior to this post. The skybox I was using before was generated with blender and spiced up in photoshop, but there was no dithering on the haze so it's really ugly. To get around this with Spacescape, I provide the option to dither a noise layer by a controllable amount and this seems to make the banding issue go away.
The plan is to use this plugin in MyFirstPlanet to let users design their own space skyboxes easily too.
Hopefully, I'll have a demo and some source code posted in the next week or so.
3 comments:
Very useful! At the moment I am still just scattering point sprites to generate a star field, but nebulas are a must.
Re the banding problem, couldn't it also be solved by moving to a deeper colour representation? Either floating-point, or HSLL (HSL with the L component encoded across both the blue and alpha bytes).
Thanks! Those are good ideas for me to try with the banding issue. I'm not certain it will help in every situation though, because if the user wants to save out their skybox in .jpg or .png format (which will probably be common) - the nice luminance values will be rounded to 32 bit rgba representation and the banding will return. I haven't tested to make sure, but that's my theory. Also, I could be wrong, but I think I'm already using floating point values in my glsl noise shader where I'm seeing the banding (in the darks). It's only obvious in the dark areas so really I should only dither the dark areas - gamma related?
I'll post results if I get it working with the HSL.
Awesome tool, thanks :)
Post a Comment