Light and Shadow

This post should have been my first screencast doing some texturing work, but alas as live plays, things have gone a bit different.

My intention was to finish one shot and then do the screencast. This specific shot is one of the very first, I had ready in my mind when starting out with my movie. So the attention to detail was maybe a bit higher then usually 🙂

The shot starts with a closeup on Ara’s face and I wanted the lighting to be without errors.  I have already pointed out in this post, that SSS needs extra attention when using it in offline post processing.

My goal is to have one layer for each light class with the shadow pass and/or AO pass separately. With this I have full control over the shot lighting in the compositor, which is a huge time saver in comparison to tweaking the lights in the shot itself.

You can see an example and breakdown in this post.

In previous shots ( especially closeups ), I already experienced strange shadow artifacts, coloring Ara’s face in undesired ways. I investigated this a bit but eventually gave up to find the cause and always found a way to adjust the lighting and do other tricks to minimize the effect.

This time the weird effect struck home with full force. No trick worked here and thats when I decided, I wanted to know what the real cause is.

First I show you an image where the problem shows very clearly. There are strange blueish edges along the nose.

No lets track this down.

Well, I knew that the problem has to do with the shadow passes and the way I use them.

This is a clay render with one light and the shadow pass included in the render.

I want to have control over the shadow and thus render two passes and multiply the (modified) shadow pass with the diffuse pass to get my result.

You see that I get the exactly same result as rendering it directly, but with the added bonus of being able to change the shadow’s attributes.

Using two lights ( one at each side of Ara giving 4 passes ) gives me this result.

This is still fine. The visible terminators have nothing to do with the way the shadow pass is included but with how blender renders the material.

Now lets have a look at the render setup I am using in my shots where SSS is used. To counter the fact that SSS takes all active lights into account, I have to use a separate scene for each SSS pass I need, which is usually two. Rendering out a single scene does all the one time preparation ( setting up vector blur, creating strands, calculating shadow maps etc) for each scene again. As soon as you have hair using a lot of screen space, you get huge times for this sort of preparation work.

In the past I came up with a solution to just render Ara and her dress in the SSS scenes ( without shadow included ) and do hair passes with the lights used in the SSS passes in the main scene (again without shadows). In the main scene I also added another renderlayer per SSS light with all clay material of Ara with dress and hair to get the shadow information for this setup.

In the compositor the hair gets ‘Alpha Over’ed over the SSS pass and the result gets multiplied with the shadow pass.

This setup saves me the scene render preparation for each SSS pass I need. I did measurements and in a typical shot this setup saved me ~25% render time compared to doing the hair in the SSS scene as well.

Well, I should have known then. Its not legal to use the shadow pass of a clay render with other materials than clay, especially not with SSS enabled ones. The shadow pass somehow includes information about other lights as well and thus modifies the intensity of the shadow areas. Using only one light would be ok with that, but when using SSS, you actually transport light through the object and thus have lit areas where no light hits directly. This is the cause of the strange marks on Ara’s face.

After realizing my error, I tried to render the SSS passes with hair and shadows included to do a quick test and this is what I get then.

If we compare the single components directly we can notice subtle differences, notably some of the shadow areas being abit brighter in the correct SSS version. See below for a comparison: left is SSS rendered without shadow and with clay shadow multiplied, right is SSS rendered with shadow:

Thats approach to render the shadow directly with the SSS is ok, but with one little fault. I have no separate shadow passes. As there is no way to include render passes from other scenes into one multilayer file, you have to create individual files for each such ‘external’ layers. If I want to have the shadow passes as well, this just adds more files to my workflow, which is something I wanted to avoid. So before extending the render setup I tried to see how I could use the shadow passes generated from an SSS run.

Well, below you see how a shadow pass looks like for he above example.

I have no idea how this is supposed to be used to generate correct images. This pass has even values way beyond 1. I tried several approaches, but in the end I just guess that this is simply not possible. It may have to do with the material being node based. Extracting the diffuse pass e.g gives me just the diffuse part of the sub material which happens to be selected in the node tree. And with 3 SSS materials mixed in the node setup I fear he shadow pass calculation gets messed up as well.

Another idea was to use a shadow material, where the OnlyShadow attribute is set. With this, shadows get rendered as alpha values. I could use then the alpha layer as my shadow pass. This works different but still has the same problems as the shadow pass approach

Ah, well. So it was a hard decision, but I will include the hair in the SSS passes as well and live with longer render times and forget about directly tweaking the shadow quality.

A slight advantage is that the compositor node setup gets a bit less complex …

Now, lets see, thats 12 shots so far where I already have applied the original approach, so back to work and restructure render setup and compositing …

 

Author: loramel

Test

4 thoughts on “Light and Shadow”

  1. I’ve encountered that before with the shadow pass, one of Blender’s many ‘quirks’. A solution of sorts I’ve come up with (although using compositing straight after render, not exr) is to mix the shadow pass and a diffuse pass with a material override, then adjust the levels a bit to get a useable pass out of it.

    The Sintel Lite files have the node setup to explain it better than I can with text. (Found on Blendswap.com) The node setup unfortunately isn’t all that straight forward, but you are obviously quite a competent Blender user. The composite nodes are within a group (first group in the 2.56 version, the group at the bottom in the 2.57 version). I can’t remember which version of Blender you are using but it should have the same effect in 2.4x as it does in 2.5x. Also, the effect is easier to see with just the one light on, so it will help to move the other ones to another layer for a bit.

    Feel free to email me if you have any questions, hope it helps you somehow. 🙂

    1. Thanks a lot Ben.

      After a first quick glance, I am not sure if this will solve my problem, but for this to see I have to study and experiment with the sintel lite setup a bit more in depth.

      There are quite some interesting approaches used in there 🙂

      I am using a mix of blender 2.49 and 2.57. 2.57 for sculpting, painting and compositing and 2.49 for the rest.

      I will try to use your compositing approach with my current setup and see how it works out.

      And I may come back to your offer about emailing you … 🙂

      1. No worries. I know it might not solve things exactly, but it does help soften the nasty terminators. I forgot to mention that the shadow buffer settings in that file are deliberately quite low for speed, putting them to 4096 and 16 samples shows off the smoother transition much nicer if you’re wondering.

        1. I now had a deeper look at the setup. The combination of the diffuse and shadow pass is an interesting thing. How did you come up with this ?

          Some ideas are applicable for me and I will try them in my project, but the core approaches on lighting/rendering are quite different between our two projects. I strictly follow a path where I have all the light contributions separated and use them as a type of lightgroups in the final compositing.

          From the sintel project files, I saw that you always directly fed the renderlayers to the compositor and created the final frame. I wonder if there is a deeper reason for this and not going through saved multilayer exr files and doing the compositing in a separate step. How did you cope with adjusting the lighting? It must have cost you quite a lot of time. But probably I am missing an important point here.

          During the work on my project the offline compositing saved me ( and still does so) countless hours of tweaking lights and rerendering.

          Anyway, thanks a lot for pointing me to your very educative node setup. Its always cool to see things done in a different way. It broadens one’s horizon 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *