Page MenuHome

Added Bake Method "Light Map"
Closed, ArchivedPublic


I find that in games we often want to bake textures and lighting separately so we can have different resolutions for each map among using other techniques such as merging real-time in-game lights/specular/shadows with baked light maps before multiplying to the texture maps.

This patch provides a new bake method "Light Map". This bake mode produces a map which is essentially the same as RE_BAKE_ALL, but the texture color is set to white. This allows the resulting map to be directly multiplied to the texture color for a result that is very close to the same as RE_BAKE_ALL. I believe the ever-so-slight discrepancy is due to the fact that each "apply" (for example when applying ao, env, or indirect) when compositing the final color multiplies against the texture color as they are applied, where this patch multiplies against 1.0 and expects the user to multiply against all the accumulated light all at once later while in-game rendering. The math theoretically should be the same as far as I can tell, but there is possibility of floating point rounding or difference in sample locations of AO.

Although this is a NEW bake method for 2.68a, it uses a #define which already existed named "RE_BAKE_LIGHT" (defined as '0'). I assume the original intent of this definition is the same as what this patch is doing, though perhaps it was either never fully implemented or for some reason removed.

I have attached 5 files:
bake_FULL.png - example of scene rendered with RE_BAKE_FULL to compare against
bake_LIGHT.png - example of result of this patch using RE_BAKE_LIGHT or "Light Map" mode.
bake_TEXTURES.png - so you can multiply the LIGHT pass against this pass to compare to FULL
bake_diff.png - difference between FULL and LIGHT*TEXTURES with the brightness set to +100 and contrast +65 in Photoshop (Not a noticeable difference without the amplification)
bake_setup.blend - the text file set up and ready to bake

Note: the images I am attaching came from a build of Blender which also has patch #37015 (raytraced indirect lighting). Images with only this patch will be darker than the test images supplied.



Event Timeline

I would like to see this patch included in trunk. +1

+1. Very useful for baking in games

Like this. Old post but still helpful! Although, I have real flashlight and working on a program that will automatically switch on and off.

Aaron Carlisle (Blendify) closed this task as Archived.Jun 29 2019, 2:42 AM
Aaron Carlisle (Blendify) claimed this task.