Skyshop - Image-Based Lighting Tools

I’ve been working on bringing Marmoset Toolbag shaders into Unity, and along with it, a suite of tools for processing HDR skies into IBL data.

Introducing: Marmoset Skyshop!

Skyshop takes sky images (panoramas, crosses, or cubemaps) as input and will generate diffuse and specular IBL cubemaps from them.

Web-Player Demo: http://marmoset.co/skyshopdemo/

Mipmapped Gloss-
The specular cubemap also stores varying gloss levels in the different mip-map levels, allowing for blurry specular reflections and gloss-maps in the IBL shader.
A custom cubemap importer saves and loads these mip levels from sub-assets of the cubemap for now. Eventually I want to use DDS cubemaps for everything.

Sky Objects -
The IBL cubemaps can be stored and managed by a custom Sky object in your scene. Sky objects are treated as ambient light-sources in your scene and work along-side Unity’s direct lights. They also take care of binding all cubemaps, skyboxes, and exposure settings to our IBL shaders globally, making swapping out skies and messing with exposure through scripting very easy.

HDR(!) -
High dynamic range skies are handled with a .pbm importer and turned into RGBM textures. All the shaders handle RGBM cubemaps as well, allowing for super light-weight HDR without floating-point textures or any hardware restrictions really; HDR that’ll run on a phone!
I plan to write more file formats later, .pbm was just one I had code for already.

Gamma Correct-
Much care is taken to do all the fancy maths and light convolution in linear color-space. All the output textures will work in both Linear and Gamma color-space so both Pro and Free versions of Unity are supported.

Shaders-
Along with the IBL tools, Skyshop will come with all the permutations of shaders and material types you’ve come to expect from Unity:
diffuse, Blinn-specular, normalmaps, and transparency. The IBL overhead for a shader is really just two cubemap lookups so adding new shader types is easy and I plan to do more of it.

The shaders I’ve written so far conform to what Toolbag uses and include parameters for:

  • Diffuse Color
  • Diffuse Intensity
  • Specular Color
  • Specular Intensity
  • Specular Exponent
  • Specular Fresnel

And channels for:

  • Diffuse map (RGBA)
  • Specular (RGB) Gloss (A)
  • Normalmap (RGB)

Support-
Edit: Skyshop now works in both free and pro versions of Unity 3.5 and 4.

So exciting to see Marmoset finally make its way to Unity! Looking great so far :slight_smile:

That’s fantastic, I’ve been searching for exactly this sort of toolset.

This is KICK ASS!!! I have custom shaders I made a while back…and I wonder if my shaders will work with this… and how much is this?

Thanks!

I’m sure it will, using IBL cubes in a shader is not hard, once you have the data. Generating the data and making sure Unity does not eat your mipmaps along the way can be tricky though. We’ll be polishing and selling the whole workflow, if that makes sense.

Do you have an ETA for release?

Well, the shaders were made in Strumpy… but if your shaders are flexible, this should not be a problem… My shaders do accept cubemaps so this transition will be painless. Also will this work with Beast?

This is all well and great but we need screens!

Cant wait:smile:

Whoa Firefox does not display my attached screenshots, fixed! I’ve also put up a webplayer demo at http://www.reinot.com/skyshop/

ETA is in the coming weeks, its close :).

I am very impressed with the webplayer…it definitely has the quality I am looking for too… how is it under strain during game play… and will this work with Light Probes, Beast, and skinned meshes? I have custom shaders that will accept cubemaps, and this will be a great addition… keep up the good work :slight_smile:

Quick update: Unity 4 support, hazaa!

I’ve also cleaned up the UI quite a bit and added an overlay of little bulb icons for all the directional lights in the scene. Very handy for positioning a direct light-source for the sun. You can even color-pick the hue and intensity of the light from the input image.

Fantastic work :slight_smile: Being able to visualize the placement of a light for the sun will make it worth using over the default skybox!

Is it possible to rotate the skybox without going through the trouble of setting up another camera? I’d love to be able to do that, but for some weird reason, there’s no skybox rotation with the default setup.

Yes, actually! The skybox and lighting orientation is hooked to the Sky object transform. So if for example you wanted to make the lighting environment spin around your model, you can script the Sky object transform to spin.

Not as important for full games perhaps, but an IBL environment spinning slowly makes for great turn-table presentations, for example:

Oh wow, this is perfect for a project we’re working on! You mention it working on pretty much any hardware; do you know if it’ll play nice with exporting to Flash?

Good question, I tried it out in 3.5 this afternoon and Unity Flash has trouble even with the cubemap skybox. It will need a little more love before I can say we have Flash support, I’m afraid.

One last pre-GDC update, I’ve made sure light probing and mapping all works. I also wrote a little UI for adding HDR skies into the Beast Settings XML file. Now any time you bake lightmaps or light-probes and Beast’s raytracer misses your geometry, it samples your sky panorama!


Beastly light-probing, featuring Joe Wilson’s boss little Vespa

p.s. We will be showing off Skyshop and our IBL Unity shaders at GDC13, albeit informally, like nomads on the expo floor. Look for scruffy fellas in “Marmoset Toolbag” T-shirts and say hello :).

Looks great, I don’t suppose it’d work on mobile very well?

In my own 4.0 tests, I’ve found Flash able to handle pretty much anything shader-related as long as you don’t go above 4 texture lookups. Cubemaps work fine from what I’ve tested, so if your IBL technique only uses two cubemap lookups, then that’ll leave 2 texture lookups left for whatever else :slight_smile: