16bitPNG breaks after Packing and editing #108866

Closed
opened 2023-06-11 20:48:26 +02:00 by Velland1982 · 5 comments

System Information
Operating system:Win10/Win10
Graphics card: RTX 3090/RTX2080

Blender Version
Broken:3.4/3.5
Worked: ?

I Created an albedo map based on a 16 bit PNG Texture, by texture painting.
I packed the Image for work on the move.
After reloading the Bledn file the Image got darker.

Reproduce Based on the default startup:
Pack a 16 bit PNG Image.
modify it with blender internal tools.
Save Image
Save Blend
Reload

The Images below show the Original and just 2 edit, save and reloads

**System Information** Operating system:Win10/Win10 Graphics card: RTX 3090/RTX2080 **Blender Version** Broken:3.4/3.5 Worked: ? I Created an albedo map based on a 16 bit PNG Texture, by texture painting. I packed the Image for work on the move. After reloading the Bledn file the Image got darker. Reproduce Based on the default startup: Pack a 16 bit PNG Image. modify it with blender internal tools. Save Image Save Blend Reload The Images below show the Original and just 2 edit, save and reloads
Velland1982 added the
Type
Report
Status
Needs Triage
Priority
Normal
labels 2023-06-11 20:48:27 +02:00
Member

This could be very likely due to wrong srgb conversion... Will take a look.

This could be very likely due to wrong srgb conversion... Will take a look.
Member

Can confirm this being an sRGB problem, where the file is saved as linear and read & displayed as sRGB.

Note that PNG specification never supported 16F/32F pixel format, it only supports up to 16I. Not sure what's happening here, likely a interface ambiguity where it shows the buffer format as 16F/32F but saves as integer. PNG R/W has a special sRGB tag and it should only apply to 8 bit images (http://www.libpng.org/pub/png/libpng-manual.txt).

I'm unable to extract the original png to inspect due to the very fact that it doesn't technically support 16F/32F, when unpacking the image, blender automatically uses exr format. @Velland1982 Do you have the original texture png file before packing?

From the look of it, it's likely that somehow the PNG is read to be assumed as SRGB while it's storing linear values, and a display transformation made it even darker.

By unpacking the file into an exr and repacking it, blender writes and reads the image correctly regardless of color space choices. So the problem is mainly about how this png ended up like this in the first place...

Can confirm this being an sRGB problem, where the file is saved as linear and read & displayed as sRGB. Note that PNG specification never supported 16F/32F pixel format, it only supports up to 16I. Not sure what's happening here, likely a interface ambiguity where it shows the buffer format as 16F/32F but saves as integer. PNG R/W has a special sRGB tag and it `should` only apply to 8 bit images (http://www.libpng.org/pub/png/libpng-manual.txt). I'm unable to extract the original png to inspect due to the very fact that it doesn't technically support 16F/32F, when unpacking the image, blender automatically uses exr format. @Velland1982 Do you have the original texture `png` file before packing? From the look of it, it's likely that somehow the PNG is read to be assumed as SRGB while it's storing linear values, and a display transformation made it even darker. By unpacking the file into an exr and repacking it, blender writes and reads the image correctly regardless of color space choices. So the problem is mainly about how this png ended up like this in the first place...
YimingWu added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2023-06-12 07:23:54 +02:00
Author

Here the original PNG.
I used GIMP to rescale it from 4096² to 2048² and then just loaded into the blend and started blocking out the areas in texture paint.
I always pack my external files to keep the projekt in one nice package.

Here the original PNG. I used GIMP to rescale it from 4096² to 2048² and then just loaded into the blend and started blocking out the areas in texture paint. I always pack my external files to keep the projekt in one nice package.
Author

Here the original PNG.
I used GIMP to rescale it from 4096² to 2048² and then just loaded into the blend and started blocking out the areas in texture paint.
I always pack my external files to keep the projekt in one nice package.

Here the original PNG. I used GIMP to rescale it from 4096² to 2048² and then just loaded into the blend and started blocking out the areas in texture paint. I always pack my external files to keep the projekt in one nice package.
Blender Bot added
Status
Archived
and removed
Status
Needs Information from User
labels 2023-06-12 18:16:36 +02:00
Blender Bot added
Status
Needs Triage
and removed
Status
Archived
labels 2023-06-12 18:16:43 +02:00
Member

Hi @Velland1982 , looks like GIMP here saved this as 16bit sRGB file, which is technically not a combination that matches PNG specification. It's actually a known issue with GIMP. You should manually change the image from sRGB to Linear in GIMP whenever you want to save a png that's not 8 bit.

identify -verbose Body_diffuse.png shows both sRGB rendering intent tag and icc profile, which is not generally used together, and can confuse some software.

  Rendering intent: Perceptual
  Gamma: 0.454545
...
  icc:model: sRGB
  png:bKGD: chunk was found (see Background color, above)
  png:iCCP: chunk was found

Will close the issue for now since it's not a bug with blender.

Hi @Velland1982 , looks like GIMP here saved this as 16bit sRGB file, which is technically not a combination that matches PNG specification. It's actually a known issue with GIMP. You should manually change the image from sRGB to Linear in GIMP whenever you want to save a png that's not 8 bit. `identify -verbose Body_diffuse.png` shows both sRGB rendering intent tag and icc profile, which is not generally used together, and can confuse some software. ``` Rendering intent: Perceptual Gamma: 0.454545 ... icc:model: sRGB png:bKGD: chunk was found (see Background color, above) png:iCCP: chunk was found ``` Will close the issue for now since it's not a bug with blender.
Blender Bot added
Status
Archived
and removed
Status
Needs Triage
labels 2023-06-13 08:43:55 +02:00
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
Interest: X11
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
2 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#108866
No description provided.