# Baking transparent decal always results in black oblique pixels

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.

When I bake, transparent pixels of A will always appear as black in C which is wrong!

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.

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

• When creating an image for your bake, did you check "use alpha" and "32-bit float"? Jun 16 '20 at 8:13
• @Christopher Bennett I didn't check, do you mean A or B or C or all? Jun 16 '20 at 8:18
• 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. Jun 16 '20 at 8:19
• @Christopher ... All textures (ABC) are 256*256, RGBA byte, Color space= sRGB, Alpha=Straight. Jun 16 '20 at 8:20
• 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. 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.

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.

And:

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.

• 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. Oct 1 '20 at 20:50