Cycles Baking - Highlights are not saved with Diffuse Direct/Indirect

I’m trying to use Cycles to bake lightmaps for a game.

So I’m baking Diffuse Direct and Indirect together, and then baking a Diffuse Color bake afterwards. I read that these can be safely combined in Photoshop by simply using the Multiply blend mode.

However when I do this it appears that Blender is not saving bright (bloom-like) areas of the environment to the lightmap. Because all I see are shadows in the end result - if any parts of the mesh were being brightened beyond their original color, I don’t get to see it using this method.

Strangely, when I bake Diffuse Direct+Indirect+Color ALL together at the same time, the highlights DO get retained. The lightmap looks exactly how it should this way. For example, I have a building where one side is in shadow, while the opposite side is being brightened a lot by the sun. By baking all 3 diffuse passes together simultaneously, these different shades of the building are baked properly in the lightmap texture. BUT when I bake DiffuseDirect+Indirect separately from Color, and then combine it manually in Photoshop with the Color pass, I end up with a lightmap where only the shadowed side of the building is baked properly, while the other side is completely missing the strong brightness from the sun.

And it makes sense that this would happen, since I’m using Multiply in Photoshop, which only darkens and doesn’t brightens. SO how on earth do I get that brightness to appear? What special voodoo is Blender doing with the 3 different passes when baked together vs baked separately and combined manually. I would rather bake Direct+Indirect separately from Color because I can bake the former with a much lower sample count and then just denoise it in Photoshop. By baking them all together I can’t denoise it because then the Color pass also gets scrambled and loses quality.

Thank you so much for your help.

Some small notes:
Highlights are a glossy result. You cannot see them just by baking the diffuse direct/indirect. You need to bake the glossy for that effect.

Which poses another problem. Glossy is a view dependent effect (I mean glossy direct and indirect; glossy color is ok to bake). It only makes sense to bake it when the final product has a fixed point of view; Move the camera and your glossys will look very strange, as sticked to the surface. For good results one normally bakes the glossy color and glossy roughness, and creates an environment map for being reflected.

For composition, you may want to take a look at rendering layers and rendering passes.

No I’m not using a glossy shader anywhere. Everything in the scene is diffuse and nothing else.

The highlights I am talking about are not the kind you might be thinking of. I’m not talking about phong or anything like that. The highlights are nothing more than a part of the mesh that has much more sunlight casting on it than other parts, causing the colors to brighten and appear more vibrant, like when you increase the exposure of a photo.

Here is an example.

Notice the right face of the roof of this building is brighter than the rest of the roof. This is not view dependent. I can see the difference in those two different shades on the roof no matter what angle I am viewing from.

When I bake all 3 diffuse passes together that right face with higher brightness is baked correctly. But when I bake only direct+indirect and then combine it in Photoshop with the color pass, the entire roof is the same shade and that bright face does not appear bright like it should.

Just did a small test here, and everything looks ok.

The house is baked, and the only light interaction in this image is the shadow on the green plane, as you can see by the low quality of the shadow behind the house…

Can you post a sample file of your scene (don’t forget to pack the textures)? And by the way, what kind of ‘combine’ are you doing in Photoshop (the tipical combine is just a multiplication between lightmap and color)?

I appreciate you trying to help, but you still don’t understand the problem. Your own image even demonstrates it. No part of that building looks truly white, it’s all clearly being darkened, not brightened. Even the brightest part of that roof still has a greenish grey on it.

Let me explain again. What I want is to produce lightmaps with Blender that not only darken, but also brighten. Because the lightmaps Blender produces right now are only meant to be used with Multiply in Photoshop, (which ONLY darkens), what I want isn’t happening.

Here is another example. This is a simple cube with a solid, dark blue diffuse color on it. In this screenshot, it’s using an Emission shader to demonstrate this.

Now here is the same cube, but with the Emission replaced with Diffuse. Now you can see lighting on it.

Now I’ve brightened that lighting, to the point where the original dark blues have become much brighter blues.

Then, finally, I baked that result, by baking only the Direct/Indirect diffuse passes. Then multiplied that onto the original dark blue color.

Notice the difference? The baked result is much darker than it should (and there is even no difference in shade between the top and front faces!!), because the Direct/Indirect-baked lightmap texture can only DARKEN the original dark blue. It can’t brighten it. Because again, it’s using Multiply! I want to know if it’s possible to produce lightmaps in Cycles that also brighten those dark blues, so the result looks identical to how it looks real-time in the 3D viewport. The result in that last image needs to look how it does in the image right above it. That is what I want!

Oddly, when I bake ALL 3 diffuse passes together simultaneously, Blender actually produces those brighter colors in the texture that I want. The baked result looks identical to how it looks real-time in the viewport when baked that way. By baking the 3 passes together, Blender is combining the 3 passes in a way that goes beyond just mere Multiply, because it’s also adding and brightening those hues as it should. I want to know WHAT voodoo it is doing there so I can combine them manually in the same manner in Photoshop.

I’ve tried Overlay, Screen, and Linear Dodge instead of Multiply, using that same Direct+Indirect baked texture, but they all look totally wrong.

You are forgetting to bake into an High Dynamic Range file (16 or 32bit)!

If your diffuse color is a [.2,.2,.8] blue, and in the bake you want to see a brighter color dued to scene illumination, than is logic to presume that the illumination values must be bigger than 1 (you can only get a result bigger than the original color if you multiply it by a value bigger than 1). Most formats clamp the values above 1, so you’ll loose that effect you want, and the brightest color will be the original diffuse color.

here’s an example, where I baked the ‘combine+direct+indirect’ into an exr (original blue color from the diffuse is #1A248B):

do you spot the differences?
(well, render times were 10s on the left, 3s on the right)

Thank you! That makes perfect sense.

Does the current Color Management setting in Blender affect this? (ie. SRBG, Linear Raw). Or does that not matter at all for this?

If using 32bit, the colors are stored without trasnformations and color space has no impact.

But it’s good to have the texture node set to Non-Color Data, when plugged into the emission shader.