Closed KirilStrezikozin closed 7 months ago
_mikefr on Discord faces this too.
This bug is confirmed and a fix can be brought at any moment, no stalls.
The issue with wrong sRGB colors on baked images may not be caused by changes in image saving that BakeMaster 2.5.0 brought (which I was afraid of), but the way images with sRGB colorspace get saved by calling image.save_render(filepath)
. An example with dummy cubes below:
Baking 3 cubes onto one map manually: The two reddish cubes were expected to be red (RGB(1,0,0)).
Same baking setup, but not saving on the last baking iteration: The last baked cube (unwrap layout in the top part) has correct color.
From that, the conclusion is that image.save_render(filepath)
is the only cause for wrong colors on image save.
A possible proof 3's solution above is that since an image is in sRGB colorspace, using image.save_render(filepath)
converts image's data to display space, which is what View Transofrm stands for.
Contrast property makes a difference, below is Raw + Low Contrast bake:
And a slight miss in color when baking Diffuse + Color is resolved by baking Emit. This was proven in #73. On the baked image above, the sampled red color is slightly below 1.0 (around 0.984). On the image below, it is 1.0.
TODO:
check how ACES behaves here. (update) exactly the same.
That was interesting actually.
No need for migrations to public.
A fix was just to reset view settings practically on each image saving iteration. Interesting that I had commented that section out in 2.6.0 which fixed EXR bakes. Probably due to using sRGB and Standard view transform I didn't notice a significant color difference or I just didn't bake sRGB maps with several objects on one. This section had been behaving wrong prior to 2.6.0 (2.5.0 brought it) so I don't blame myself for one more 'not an update but a mess' badge for 2.6.0.
bake_scene_settings(...)
function has got some unused arguments, but I was kind of lucky I left them hanging there because it helps understand the context which bake_scene_settings(...)
is called in. This saved me time and I actually fixed this issue pretty quickly. It involved resetting view settings when color_manage
is False
(which is always like this unless apply_scene
and is_last
are both True
:
# In operator_bake, bake_scene_settings(...)
...
if not color_manage:
context.scene.view_settings.view_transform = 'Raw'
context.scene.view_settings.look = 'None'
context.scene.view_settings.exposure = 0.0
context.scene.view_settings.gamma = 1.0
context.scene.view_settings.use_curve_mapping = False
# for video editing
# context.scene.sequencer_colorspace_settings.name = ...
...
This bug report is:
Describe the bug I rewrote map saving back in BakeMaster 2.5.0 (I guess, needs testing). This rewrite was to properly save maps with configured bit depths and file format, but looks like it messes up colors on sRGB maps, especially making it darker with each next highpoly baked onto the map. This bug was noticed by @KirilStrezikozin for multiple highpolies, but together with soeinfeuerball we noticed that it also happens for simple sRGB maps without any highpolies. See the screenshots below for colors differences.
To Reproduce Steps to reproduce the behavior:
Expected behavior No color messing as this impacts the output image textures. That might lead to unexpected results when users use baked maps in another software or rendering and Blender when colors do not match the ones they initially set up.
Screenshots
Desktop (please complete the following information):