Author Topic: Shadow Map baking in Substance  (Read 6486 times)

You can bake simple shadow maps in Substance.

It does require a bit of pre-processing of your model.
Besides exporting a regular version of your model, you'll need...

An export of your model rotated to align the light direction to the Y-axis. Bake the World Space Normals, extract and adjust the levels on it's Green Channel to get the lighting (without cast shadows) from the light.

An export of the model with all its Normals pointing straight up.

From this we'll use these Height Map bake settings (use the object itself as its own high definition mesh)...

To get this height map...

Might not look like much, but every surface exposed to the light is 50% grey, every surface blocked from the light is lighter. So, invert and adjust it's levels to get...

Looks a little rough, but multiply with our lighting map and you have the light and shadows from a single directional light...

Not bad, personally I like faking bounce light by adding an inverted Green Channel from the World Space Normal map of the regular version of the export, using an AO bake as a mask.

Much better, you can also add a bit of color using a Gradient Map node.

Substance Graph...

You can only bake a directional light shadow map, no point or area lights. Also, no advance lighting features like global illumination, color bleeding, etc.

I also have yet to find a really good way to fade the shadow intensity as you get further away from the shadow casting object.

Still, very handy for quick light bakes. You can also use the shadow map as a mask to improve the accuracy of things like sun bleaching, or use it on a snow substance for example so areas blocked don't accumulate snow.

A copy of the Substance file and object exports.
Last Edit: November 30, 2014, 12:59:24 am

Thats a cool experiment! Neat results too, i can imagine for mobile games especially this might be interesting.

That is very cool! Thanks for posting.


Head of Substance Demo Art Team
Twitter: The3DNinja

Thanks Käy.Vriend, a mobile game is actually exactly what we're using this for.

Even though we are only doing a very simple shadow bake, doing it in Mental Ray was taking us around 5 mins to set up and bake on even the simplest objects.

The pre-processing for this technique might seem time consuming, but it's very easy to automate. Using some simple python scripting and the Substance bake tools, our light bake now takes less then 5 seconds, and is a single button push.

That sounds awesome, in the end that will save tons of time i guess. If and when ready, I (and probably the rest of the forum visitors :D) would love to see some screenshots :).