How to bake transparent AO with Cycles

Hello,

is there any way i could bake AO map with cycles so white would determine transparency? In other words - there would be no white, just black with harder or lighter transparency.

Thanks

You don’t need to. The material’s nodes could be designed to get whatever effect that you are trying to get using merely a black and white map.

well, this is not needed for use in blender but to be exported to other engine. So is there a way to do it? Anyone?

well, this is not needed for use in blender but to be exported to other engine. So is there a way to do it? Anyone?

well, this is not needed for use in blender but to be exported to other engine and exactly as described in my initial post. :slight_smile: So is there a way to do it? Anyone?

Bake AO as you usually would do resulting in a b/w 0 to 1 ranged image and then use this image to drive/set alpha or converted black levels as needed in Blender’s Compositor (if you do not want to use photo editing in different software).

You are trying to convert a black and white image to a black and transparent image. It can be done in Blender’s node editor, either for materials or for compositing (as eppo says). It can be done in GIMP. It can be done in Photoshop. There are many different ways to do this.

It can be done with 3 clicks in GIMP. In the menu:

  1. Layer>Transparency>Color to Alpha
  2. The transparent color should be white by default. So, you just click OK.

If you must do it in Blender, you just do the following:

  1. Create a new Blend file
  2. In the Properties Window > Render Tab > Post Processing, Compositing should be checked
  3. In the Properties Window > Render Tab > Output, RGBA should be selected and the file format should support transparency, like PNG
  4. In the Properties Window > Render Tab > Dimensions, set the dimensions to that of your baked AO image
  5. Render the scene (press F12) if you haven’t already (it only needs rendered once)
  6. Change a window to the Node Editor
  7. At the bottom of the window, click the Render Layers icon and check Use Nodes
  8. Delete the Render Layers node
  9. Add an Input>Image node
  10. Choose the baked AO image from your HDD in the Image node
  11. Add a Color>Invert node (RGB should be checked)
  12. Connect the Image node’s image output to the input of the Invert node
  13. Set the Composite node’s input image color to black with an alpha of 1.0
  14. Connect the Invert node’s output to the Composite node’s alpha input

If you must do it in Blender, you just do the following:

I must do it in Blender.
When it comes to game art, if you can bake out alpha, you definitely want to, if you are doing dozens or hundreds, or in my case, thousands of textures.
Not only does unity use the alpha map for its alpha shader, it also uses the alpha map for the metallic factor in it’s standard shader.

Is there a REAL way to simply bake all four RGBA channels in Cycles?

Not currently; for now, you’ll need to bake two different passes, and then combine that data into the image channels in the compositor. The 2.80 will be able to do it in one pass using AOVs.

Thank you. It’s a relief to hear it will be in 2.80.

(also, I could not get Austin’s solution to work, although, I later found, for what I needed, Unity can’t cast shadows on partially transparent shadows anyways, so I just did a cutout alpha bake, which Blender can do.)