Inaccurate results when saving MaterialIDs to OpenEXR and loading them back into Blender #53381

Closed
opened 2017-11-23 11:17:49 +01:00 by Rainer Trummer · 8 comments

System Information
Windows 7, 64 bit, Quadro 4000

Blender Version
Broken: 2.79 and following
Worked: unknown

Short description of error
I have a demo scene with around 3000 different MaterialIDs. When rendering the MaterialID pass and saving it out to OpenEXR Multilayer, and then read back in the file, the IDs between a Float (Half) and Float (Full) image are different. It seems like there are rounding errors. We did not notice such behavior when using a lower number of different IDs so far. I'm not sure if this really is a bug or a technical limitation, but I thought that Float (Half) should be able to store 65536 different IDs per channel no problem.

Exact steps for others to reproduce the error
Download the .blend file. Open it and hit F12 to render. Now, the image nodes should read the rendered EXR files back in. In the Image Editor, hold down the Mouse Button to see the Material Index Values. When previewing the floatHalf one, you'll notice that uneven indicies are mostly missing. The floatFull offers all of them.

blend file:
PassIndexProblem.blend

**System Information** Windows 7, 64 bit, Quadro 4000 **Blender Version** Broken: 2.79 and following Worked: unknown **Short description of error** I have a demo scene with around 3000 different MaterialIDs. When rendering the MaterialID pass and saving it out to OpenEXR Multilayer, and then read back in the file, the IDs between a Float (Half) and Float (Full) image are different. It seems like there are rounding errors. We did not notice such behavior when using a lower number of different IDs so far. I'm not sure if this really is a bug or a technical limitation, but I thought that Float (Half) should be able to store 65536 different IDs per channel no problem. **Exact steps for others to reproduce the error** Download the .blend file. Open it and hit F12 to render. Now, the image nodes should read the rendered EXR files back in. In the Image Editor, hold down the Mouse Button to see the Material Index Values. When previewing the floatHalf one, you'll notice that uneven indicies are mostly missing. The floatFull offers all of them. blend file: [PassIndexProblem.blend](https://archive.blender.org/developer/F1178781/PassIndexProblem.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @RainerTrummer

Added subscriber: @RainerTrummer

Added subscriber: @zeauro

Added subscriber: @zeauro

I can confirm the problem on ubuntu 16.04 with 2.79 and master f2842ac .

Float(Half) is storing uneven number until 2045. There is one cube corresponding to 2046. Then, 2 cubes corresponding to 2048,2050, 2052, etc...

I can confirm the problem on ubuntu 16.04 with 2.79 and master f2842ac . Float(Half) is storing uneven number until 2045. There is one cube corresponding to 2046. Then, 2 cubes corresponding to 2048,2050, 2052, etc...

Added subscriber: @brecht

Added subscriber: @brecht

Half floats can store maximum 65536, but definitely not all integers in between. I think we should always store ID passes with full float precision, regardless if the half float option is used.

Half floats can store maximum 65536, but definitely not all integers in between. I think we should always store ID passes with full float precision, regardless if the half float option is used.

See also "precision limitations on integer values" here:
https://en.wikipedia.org/wiki/Half-precision_floating-point_format

An extra problem in this .blend is that it's using a file output node, and that currently doesn't have a way to specify the channel output type (XYZ, RGB, ..), so we can't auto detect it. It would be good to add that, but regardless, best not to try saving IDs as half float. When saving a multilayer EXR directly from the render we can detect it though.

See also "precision limitations on integer values" here: https://en.wikipedia.org/wiki/Half-precision_floating-point_format An extra problem in this .blend is that it's using a file output node, and that currently doesn't have a way to specify the channel output type (XYZ, RGB, ..), so we can't auto detect it. It would be good to add that, but regardless, best not to try saving IDs as half float. When saving a multilayer EXR directly from the render we can detect it though.

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Brecht Van Lommel self-assigned this 2017-11-23 17:41:38 +01: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
3 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#53381
No description provided.