toolbag banner

TUTORIAL: What is the Sky Tool?

The sky tool is used to generate custom lighting environments for use in Marmoset Toolbag. A variety of sky lighting presets are included with Toolbag, but the sky tool is useful if you wish to create your own. The tool is pretty quick and easy to use, and with it you can quickly create all kinds of interesting lighting environments. It accepts background panoramas in a variety of formats, and from these files creates the necessary diffuse and specular data to light a model.

In short, an image goes in, and light comes out!

Getting Started

The sky tool can be accessed in one of two ways – either hit the “Sky Tool” button under the “Light” tab in the main material editor, or exit to the main tools menu and select it from there.

To get started, you will need a panorama background of some sort. Toolbag can load panorama, horizontal cross, vertical cross, or column style layouts. The image can be in .psd, .pfm, .tga, or .dds format (note that the .tga format does not support HDR data). If you don’t have one handy right now, you may use this file for the tutorial (Appendix A: “Fudging It” may also be of interest):

Download Sample Cubemap – Vertical Cross (.pfm)

Click the “Open Image…” button, and select your background image file. Notice the “Open As” menu to the right, you may select the layout of the image from this menu, or let Toolbag take its best guess. You will notice there is also an option to “Open Shadow Image…”, but ignore that for now.

Background: Image Based Lighting

Toolbag uses Image Based Lighting (IBL) for sky lighting. This uses a single large panorama image to describe the lighting coming in from all directions. Each pixel of this image gets treated as a tiny light source, and rendered accordingly. This can be used to render with light captured from digital photos, or with any handmade or artificial backdrop. This technique allows for a lot of artist control, and an essentially unlimited number of light sources.

What is “HDR” good for anyway?

High Dynamic Range (HDR) images contain a higher range of brightness with greater precision than the ordinary 24 bit color images we come across every day. This is useful particularly for capturing things brighter than our monitors can display. A reflected image of the sun, for example, will appear correct when HDR images are used, but may look rather washed out and dirty otherwise.

HDR images are fully supported as input to the sky tool, and we recommend you use them if you have HDR data available to you. You will get better specular highlights and sharper lighting for many scenes. Many image editing programs, notably Adobe Photoshop CS3 and later, support the creation and editing of HDR images.

Once the image is opened, you will see it displayed in the background, and a series of lit spheres will appear in the foreground. In a sense you are already done – your image is now being used to light these spheres and we are witnessing IBL in all its glory.

Adjusting

These rows of spheres are useful for calibrating the brightness of your image. They are displaying a preview of what our diffuse and specular lighting will look like under the current settings. The top row shows specular reflection, and the bottom row shows diffuse. Each column has different brightness – for example the “100%” column shows what a perfect mirror and a white surface will look like in this lighting.

Adjust the “Brightness” slider until the spheres seem to look to your liking; ideally 100% should look fairly white, but 50% should look noticeably darker, and so on. You may also adjust the specular sharpness of the top row of spheres to preview different values – this will not affect the final output but it can be a useful preview tool. Camera controls are the same as the material editor; hold alt and left click drag to orbit the camera around.

Export

Once the lighting is tweaked to your liking, hit the “Export Sky…” button. You will be prompted to save out an .env file. Wherever this .env is saved, Toolbag will also write several other files that will be referenced by the .env, so it is good practice to make a separate folder for each sky that you create.

The exporting process involves the computation of some lighting data that will be used to light arbitrary meshes, and may take a minute or two. Use this brief delay to meditate on just how awesome you are for having made a sky in Toolbag.

Using the Sky

After you have an exported sky, go back to the material editor and load up a mesh (either re-launch Toolbag, or use the “Exit to Tools Menu” button). Go to the “Light” tab, hit “Open Sky…”, and select your .env file. If we’ve done our job at all well, you should now see your new lighting environment applied to your mesh. We know you have a choice in 3D rendering and we thank you for flying Marmoset.


Appendix A: Fudging It

You may be asking yourself “Okay, that’s great and all, but I don’t have any panoramic images sitting around. Can I still make use of the sky tool?”. The answer is yes – you can!

The panorama loader is quite flexible in converting images to the needed format. Perfect cross layout images are indeed rather hard to come by, and often require the use of other tools to generate them. However you may load any image at all as a panorama, even if it has seams or other issues, and it will be wrapped sphere-like around your sky box. You may get an ugly or nonsensical background, but the lighting its self may still be interesting and useful.

Appendix B: Advanced Options

The effect of shadows can also be created using the sky tool. You can select a second panorama to serve as the “shadow image”, which will be drawn on areas of the mesh that fall in shadow. Toolbag will automatically pick the brightest spot in your main light image to determine the shadow direction. This feature is best for backgrounds with a clear light source, such as a blue sky with the sun in it. The shadow version of this image would be identical except for having the sun edited out (painting out the sun is quickly done with Photoshop’s ‘Clone Stamp tool’, with a nearby color sampled). The end result in this case would be that light from the sun casts shadows.

The shadow feature is a bit capricious and can be tricky to get right, but if you’re willing to spend the time the results can be worth it.

For more HDRI content to experiment with, check out…

http://www.openfootage.net/

http://dativ.at/lightprobes/

http://gl.ict.usc.edu/Data/HighResProbes/

Further HDRI reading…

http://en.wikipedia.org/wiki/High_dynamic_range_imaging

Adobe Photoshop’s ‘Merge to HDR Pro’