I have a simple scene with only two objects. I want to bake shadow of one of them, but for some reason it ignores self shadow and bakes only shadow cast by other object. Have i missed something in baking or material settings?
The issue here is the Shadow Bake Type doesn't seem to include the shadows cast by the object on itself. I experimented a bit, and I found a way to make it work, but it is a bit convoluted.
The steps are:
- Bake diffuse with all lights set to cast shadows.
- Bake diffuse with all lights set to not cast shadows.
- Divide the first by the second as shown in the screenshot.
- If the nodes are connected as shown in the screenshot, bake emission to another image to get the shadows.
Please note that the color of the surface and the light properties will affect the output. You will obviously need to avoid black surfaces. If you prefer, you can add a Color Ramp to customize the output.
Update: It seems that OP wants to bake lightmaps in Blender. To do that, the Diffuse Bake Type should be selected making sure to exclude Color contribution under Influence as shown in the screenshot below. This will bake direct and indirect light which can then be multiplied by the Base Color in the game engine to get a fully lit scene without needing active lights.
For this simple scene, light baking shouldn't be too hard, but for normal or complex scenes, more steps need to be taken. I suggest to refer to this YouTube tutorial for more information.