Added Bake Method "Light Map" #37081

Closed
opened 2013-10-15 02:17:50 +02:00 by Shaun Graham · 13 comments

%%%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.%%%

%%%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.%%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

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

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

%%%+1%%%

%%%+1%%%
Member

%%%+1. Very useful for baking in games%%%

%%%+1. Very useful for baking in games%%%

Added subscriber: @Swyter

Added subscriber: @Swyter
Member

Removed subscriber: @JorgeBernalMartinez

Removed subscriber: @JorgeBernalMartinez
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
OlightS1A commented 2018-05-09 11:48:18 +02:00 (Migrated from localhost:3001)

Added subscriber: @OlightS1A

Added subscriber: @OlightS1A
OlightS1A commented 2018-05-09 11:48:18 +02:00 (Migrated from localhost:3001)

This comment was removed by @OlightS1A

*This comment was removed by @OlightS1A*
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Aaron Carlisle self-assigned this 2019-06-29 02:42:50 +02:00
Livethelight420 commented 2019-09-24 13:22:05 +02:00 (Migrated from localhost:3001)

Added subscriber: @Livethelight420

Added subscriber: @Livethelight420
Livethelight420 commented 2019-09-24 13:22:05 +02:00 (Migrated from localhost:3001)

This comment was removed by @Livethelight420

*This comment was removed by @Livethelight420*

Added subscriber: @brecht

Added subscriber: @brecht
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
9 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#37081
No description provided.