Occlusion and Luminance Transparency Solved!!

This had me crying long hours into the night for a rather extended period. Then I found the solution in the amazing blog of David Johnson in a post about surface shader transparency. And life has been better since.

Ive looked all over the web looking for a way to render occlusion and luminance for transparent objects properly and the only ray of hope seemed using some more mr nodes (something like fg occ or something ) and doing some more connections to get a transparent occ. As if life with mr wasnt complicated enough! VERY STRANGE then that I didnt find this simlpe and obvious solution (once you start using it) anywhere else!!

Anyways, here goes. For transparent occlusion – you create a maya layered shader. Put a surface shader as its only layer. Disconnect the transparency connection that happens automatocally once you plug the surface shader. Now connect your transparency file to the transparency channel of the alpha shader [ if your image has inbuilt alpha like a tiff or png, then just plug in the same image or plug in a black n white transparency map and check alpha is luminance]. Finally, on the surafce ahder you will have a compositing flag. Set it to layered texture instead of layered shader. So this is your occlusion shader with transparency. Of course, you need to connect the mib amb occ node to the actual surfce shader. Now apply this layered  shader to your transparent objects instead of applying the surface shader directly and presto, ull see occluion respecting transparency! Maybe it sounds a bit more complicated than it is coz of all the text im using but try it, its the most straightforward thing in the world.

The principle behind getting transparent depth pass is exactly the same. Create a new render layer..go to attributes and select luminance depth preset. now remove material override from the layer and reapply the newly created surface shader ( this is done so you can assign a different shader to the transparent objects). Now do exactly as above. Plug in the surface shader into a layreed shader, map appropriate transparency and apply this layered shader to the transparent objects ! bingo! perfect transparency with luminance pass :) (to know more about setting up the luminance pass, read my previous post)

If you want to know the reason behind this, read on.So this is the part that I learnt from David’s blog.  Lets take the case of transparency with luminance. Why cant we plug in transparency into the surface shader directly? Well, because a surface shader’s colour channel behaves pretty much like ncandacence. So it first calculates the transparency an dthen calculates the surface colour and blends it on top of the transparency. so if you have a full black surface colour, your transparency will behav corectly, if you have a fully white surface colour, the transparency will be completely gone and if you have anything in between, some of the transparency will be gone. By plugging the surface shader to a layered shader, you pass the colour info from your surface shader into the latter and since here, colour behaves as colour (not incandencence), transparency is calculated after the colour information is calculated and hence you get correct results. Whew!

Hope this helps some hapless soul like me :)



34 thoughts on “Occlusion and Luminance Transparency Solved!!

  1. Trying to render out a zdepth for my interior using this technique. I have a table in the middle of the room thats made of a few glass panes which does not use a file texture. Or do I connect my glass mia_material to it? Not sure how to make this work? A few example images of perhaps a sample scene would be great! Anyway you can supply me with one? Thanks.


    • Hi Michael,
      I could supply you with a sample scene, but would need your mail id for the same:)
      Btw, I didnt quite understand what you are trying to do. This technique is for geting occlusion on objects where you use alpha maps to create cutout shapes (like in leaves and hair). Normally Maya would give you an occlusion for the whole object without creating a cutout as is done in the beauty pass. This process allows you to create a cutout in your occlusion using the alpha map.


  2. WOW!!!!! I don’t know how to thank you!!!!!!!!!!! You made my day!!!!! Take a bow!!!!!!!!!!! This is the fastest occlusion technique for transparent objects I have ever come across….. This is a million times superior to the more popular FG-occlusion technique!!!! Thanks a million, mate!


    • Ok. I see your problem now. The method I describe here is for getting the depth map (or ocllusion) to take into account alpha maps of objects which you use as cutouts (they are called billboards i think). In your case here, itd be the leaves. While your beauty pass has leaves in the proper shape, your depth pass has flat planes instead, ignoring the alpha map youve used to create the nice leaf shape. So when you use this depth pass to create dof on ur beauty pass, itll create wrong blurring around your leaves, revealing the shape of the actual planes. The method I describe allows you to get the depth pass where the leaves are the same shape as in your beauty pass, thus avoiding this problem.

      It however, dosent do anything differnt for fully modelled objects whose shape dosent depend on alpha maps, as is the case with your wall and shower glass. I do not though understand why you would need any change in the shower glass area of the depth pass. If you are going to use it for a dof effect, then its only right that the glass is the same flat color as the wall. They both being at the same distance frmom the camera, need to be blurred the same amount, and hence it works. IF you need to remove the glass from the render , simply hide it from the render.

      Hope it helps :)


  3. You are exactly right. I was just thinking the same this morning about the wall and glass being the same shade in depth. My mistake. Thanks for the help!


  4. Are you sure that’s a noticiable problem? I am not able to check it on Maya right now. But occlusion shadow is generally pretty blurred at the edges and itd be difficult to notice the edges of shapes. Could you mail me a screenshot at lipuster@ gmail.com?



    • hi thanks for the quick replay.
      Well, its not that visible, maybe I can get around in some situations.
      But im crearting poligonal hair with alpha textures, and in some areas is more noticeable than others, but one way around it is to make the end of the poligonal planes more small, with the alpha texture and all, but more small in the end.

      The fg oclusion is the best way to go if you are triying to get just the tipical black and white ambient oclussion pass, its not that dificult to set up, but it needs final gather turned on, and the quality of the aoc depends on the settings of the final gather.
      But what I need is to use ambient oclussion for ambient lightning purposes, giving color to the aoc. And in this case, I need to use the tipical aoc because it let me use color.

      The aoc shadow will be more noticeable if you are rendering for example a plane with a checker pattern mapped to the transparency, and just bellow that plane, another plane for the ground. There you will see, the complete shadow of the aoc. The plane will be cut with the transparency, but the shadow dont. In this case, the fg AOC will be your salvation.


      • Oh Yeah, now that you mention it, I too had run into the same problem when doing hair that falls over the temple of the head. Mine was a still image, so i had painted over it. Thanks for that info about fg occlusion. Had found it a bit complex so hadnt trie it yet. Will give it a shot in my next project. Also, that’s an interesting technique, using aoc for ambient lighting. You using it as a replacement for fg? If so why, with fg being pretty fast now. Cheers:)


      • Yeah aoc for ambient is to fake fg.
        Fg its pretty fast, yeah, but for animation you can get flickering, so you have to crak up the settings, the fg rays, etc.
        With AOC for ambient you have a lot of control, you can even plug ramps to control the look of the aoc.
        For example you can have a room, with red, green and blue ambien light coming from the top to bottom, Plus your key light coming from a windown as a sun light, and a couple of bounce lights.
        Or you can have a ibl node with a sky ramp sort of texture, and a couple of portal lights, plus the aoc for ambient.
        I have seen these techniques in a digital tutors dvd, and also in the gnomon master classes 2011. So if these guys are teaching this, it sould be good stuff!

        Lets say its just another technique, you could light a scene with fg, and then try to mimic the looks with this other technique, and see if its good for you, for your particular needs.


  5. Yeah Ive always tried to avoid these techniques mainly because of the setup time,etc. So far havent got noticiable flickering though. I hope things carry on that way. :) Thanks a lot for the detailed explanation.


  6. THANK YOU!!!! You just saved my entire film. I’ve been trying out complicated solutions that don’t work for a week and a half This is simple and looks great. It’s seems true that it doesn’t take the alpha into account for AO, but mine is soft enough it doesn’t really matter. For luminance depth pass it works perfectly as far as I can tell.


  7. thanks a lot!! I would take days to figure it out, or even weeks! I just lost my morning till I found your solution! Great great great!!! and today is friday, so I will raise a glass for you!


  8. Hi, i don’t know whether is it too much of a request, is it possible to do a video tutorial on AO transparency?
    I’m still very confused, i still can’t get the AO alpha on my tree leaves to work.
    Please help me, is it possible to send me your .ma file too?
    Thanks a million. : )


  9. Hi Moyoshima..this is a very old post….I currently have the ma files stacke din some old disk..difficult to locate. Try going through the post again..ive tried to outline the process pretty clearly..if there is anything in particular that you have difficulty following, let me know and id be happy to help. The process works PERFECTLY and Ive used it in all my projects.



    • I’m having difficulty following how to connect the shaders together. Is it possible to do a step by step screenshot? Please help me, I’m a slow learner.
      Thank you so much for your reply. Im happy to hear from you. : )


      • I agree, the information needs a lot more detalining, no idea what you meant by “alpha shader”, and if you mean the “transparecy connection” as the green layer that its always there in the layer shader? Its great info, but I beilieve the way you explained it was a little bit lacking of actual step by step, perhabs to people not used to work with that method.

        I personally have no idea of the steps and exact places where to connect since your text is not very clear.

        I believe this “tutorial” could be solved if you’d make a better step by step or just, as many other requested, 4 images, cause it seems like this is done in like 4 steps. I hope you can read this and reply, as this is a very good usefull and unique information (have failed to find any tutorial o related information on this on the web)


      • Hi Daniel and Mayoshima,

        I agree this needs an elaboration with few images..working on that now. Ill out it up in some days.
        Thanks for pushing me towards it:)


  10. 4 long years of avoiding this issue have finally come to a wonderful and harmonious end after reading your blog. From the bottom of my heart I thank you mate.


    • Hi Alex,

      Messgaes like yours really make it worth the effort of making and posting stuff like this. Its been really long since i posted this but its amazing how its helping someone even today. Thank you very much:)


  11. Hi, thanks for posting, the theory has solved my problem rendering depth passes with transparency. The layered texture tip is super handy for depth passes and mattes.

    However the occlusion technique does not work. It solves the colour but not the shadowing. If anyone is looking for a simple solution to this, try the puppet shader ‘p_MegaTK’. It does the trick.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s