I have 3 mesh planes.

  • A's texture =transparent decal
  • B's texture =oblique texture
  • C's texture =result of baking

These 3 planes are places on top of each other.
enter image description here
When I bake, transparent pixels of A will always appear as black in C which is wrong!
enter image description here
How to bake it correctly? The result should be similar to the A+B image.

In real case, the objects are more complex than this, and I use shrinkwarp for A(decal) on B.

Related : Cycles bakes a transparent areas to black , Textures bake transparency as white

I prefer to not use any paid add-on.
I don't mind coding Python myself.

  • $\begingroup$ When creating an image for your bake, did you check "use alpha" and "32-bit float"? $\endgroup$ – Christopher Bennett Jun 16 '20 at 8:13
  • $\begingroup$ @Christopher Bennett I didn't check, do you mean A or B or C or all? $\endgroup$ – cppBeginner Jun 16 '20 at 8:18
  • $\begingroup$ Actually, now that I look at the file, I think you should also apply alpha-clip to the shadow mode in addition to the blend mode on the decal. $\endgroup$ – Christopher Bennett Jun 16 '20 at 8:19
  • $\begingroup$ @Christopher ... All textures (ABC) are 256*256, RGBA byte, Color space= sRGB, Alpha=Straight. $\endgroup$ – cppBeginner Jun 16 '20 at 8:20
  • $\begingroup$ And I meant C, but I can see that the alpha works on the edges, so I don't think that's the problem. I think what's happening is that you have an opaque shadow on the decal even though you clipped the alpha on the image. When you bake it, it's casting a black (shadow) box. I think if you change the shadow mode to alpha clip as well and bake again, it should work. $\endgroup$ – Christopher Bennett Jun 16 '20 at 8:22

I think this is not directly possible.

Though, a workaround is to use an intermediate surface which is glass, combined with emission (as this setting darkens the surfaces).

Then, bake (transmission) from it to the target plane.

enter image description here

A and B are inverted from initial setting

As (poor) explanation, my hypothesis about why it works is here:

The transparent BSDF shader is given special treatment. When a ray passes through it, light passes straight on, as if there was no geometry there. The ray type does not change when passing through a transparent BSDF.


Note that, while semantically the ray passes through as if no geometry was hit, rendering performance is affected as each transparency step requires executing the shader and tracing a ray.

So (maybe), from the raycast point of view (actual or calculated baking cage) the A surface keeps the ray black whilst going through it, except for the rays it diffuses itself.

Is it a bug or unmanaged situation, I don't know.

As opposite, the glass surface receives and keeps actual rays and can transmit them.

Additionnally, we could except that a setting where A is alpha driven mix between glass and diffuse should work (in the initial A on B on C case) but it does not.

Note: edited also because I was wrong thinking changing "film" parameters was needed.

  • 3
    $\begingroup$ That's a brilliant workaround! The image doesn't seem to get darker unless you disable caustics (and I distrust the mix with emission), but I haven't gone in with a magnifying glass. IOR probably ought to be 1.0, although in this case it doesn't matter (perpendicular rays.) Use of a refraction BSDF instead of glass ought to eliminate risk of specular for glancing rays as well. $\endgroup$ – Nathan Oct 1 '20 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.