Dithering is not applied for Texture Baking #41185

Open
opened 2014-07-25 23:28:53 +02:00 by Robert M · 25 comments

System Information
Debian amd64, Radeon HD with fglrx

Blender Version
Broken: current GIT, also many previous versions were affected in case of BI Baking

Short description of error
Dithering is not applied for Texture Baking, resulting in banding artefacts.
Cycles Baking and BI Baking are affected.

Also when saving a 32 bit float image as 8 bit PNG, no dithering is applied (despite Dithering was set to 1.0, and "Save as Render" was activated).

Exact steps for others to reproduce the error
A .blend file is attached. Click on "Bake" and wait a few seconds. After baking is finished you should see the banding artefacts in the dark-gray regions.

Thanks

**System Information** Debian amd64, Radeon HD with fglrx **Blender Version** Broken: current GIT, also many previous versions were affected in case of BI Baking **Short description of error** Dithering is not applied for Texture Baking, resulting in banding artefacts. Cycles Baking and BI Baking are affected. Also when saving a 32 bit float image as 8 bit PNG, no dithering is applied (despite Dithering was set to 1.0, and "Save as Render" was activated). **Exact steps for others to reproduce the error** A .blend file is attached. Click on "Bake" and wait a few seconds. After baking is finished you should see the banding artefacts in the dark-gray regions. Thanks
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @robertm

Added subscriber: @robertm
Author
[baking_dithering.blend](https://archive.blender.org/developer/F99570/baking_dithering.blend)

Added subscriber: @mont29

Added subscriber: @mont29
Dalai Felinto was assigned by Thomas Dinges 2014-08-06 01:42:10 +02:00

Added subscriber: @ThomasDinges

Added subscriber: @ThomasDinges

Dalai, can you please check maybe? It's not strictly Cycles Baking related though, so maybe someone else should check. :)

Dalai, can you please check maybe? It's not strictly Cycles Baking related though, so maybe someone else should check. :)

Possible fix in D714

Possible fix in [D714](https://archive.blender.org/developer/D714)

Added subscriber: @MarcClintDion

Added subscriber: @MarcClintDion

here's the result from the patch, it works to clear up the banding however it does leave noise that increased samples can't fix, increasing the texture dimensions helps clear this up. These two screen captures are for Cycles bake, the first one is at 1024x1024 same as the posted .blend, the second one is rendered at 2048x2048. For both, Dither is set to 1.0

dither.png

dither_2048.png

Not sure I'd want this to be the standard method for baking since it may cause seems to show.

here's the result from the patch, it works to clear up the banding however it does leave noise that increased samples can't fix, increasing the texture dimensions helps clear this up. These two screen captures are for Cycles bake, the first one is at 1024x1024 same as the posted .blend, the second one is rendered at 2048x2048. For both, Dither is set to 1.0 ![dither.png](https://archive.blender.org/developer/F101633/dither.png) ![dither_2048.png](https://archive.blender.org/developer/F101635/dither_2048.png) Not sure I'd want this to be the standard method for baking since it may cause seems to show.

I tested with BI, banding is the same with or without dithering.

I tested with BI, banding is the same with or without dithering.
Author

I think the solution for this problem is not a Cycles specific fix, but a general fix for the export routine for byte images.
So when you save a float image to a byte image, dithering should be applied (as is done when you render).

Or alternatively, if you chose to bake to a byte image, nevertheless always bake to a float image internally and then auto-convert with dithering to a byte image, and get rid of the float image to save RAM.

I think the solution for this problem is not a Cycles specific fix, but a general fix for the export routine for byte images. So when you save a float image to a byte image, dithering should be applied (as is done when you render). Or alternatively, if you chose to bake to a byte image, nevertheless always bake to a float image internally and then auto-convert with dithering to a byte image, and get rid of the float image to save RAM.

It doesn't bother me to have this for an option but to auto apply this to everything would be bad news. Dithering is noise and I would not want that applied to anything I do unless I had a situation where I actually wanted it. It would ruin normal and height maps and it could force people to render at super high resolutions that many CPU's can't handle very well.
There is also a good chance that dithering will make seams more visible for baked models since it's a post process algorithm and this means that it can't be tiled very easily across the UV islands.

You could do something like this manually by applying a very subtle noise using materials. For BI I would use the Clouds texture and for Cycles I would use the Noise Texture node which looks pretty much like the BI Clouds.
This way, the dithering would be scalable using a Vector-> Mapping Node so you would not have to render at higher resolutions to shrink the dither artifact size. You'd also have much more control over the contrast and brightness of the dithering.

Textures with high frequency detail like stone and wood act as naturally dithering for both banding and Cycles noise. They can make the difference between rendering at 1000 samples or 250.

For the case you presented, I would use wood for the floor and since wood has a lot of subtle high frequency noise it would act as dithering. For the walls, I would use a faint noise texture to simulate the small, subtle splotches we see that are created by a paint roller. This would also act as dithering.

It doesn't bother me to have this for an option but to auto apply this to everything would be bad news. Dithering is noise and I would not want that applied to anything I do unless I had a situation where I actually wanted it. It would ruin normal and height maps and it could force people to render at super high resolutions that many CPU's can't handle very well. There is also a good chance that dithering will make seams more visible for baked models since it's a post process algorithm and this means that it can't be tiled very easily across the UV islands. You could do something like this manually by applying a very subtle noise using materials. For BI I would use the Clouds texture and for Cycles I would use the Noise Texture node which looks pretty much like the BI Clouds. This way, the dithering would be scalable using a Vector-> Mapping Node so you would not have to render at higher resolutions to shrink the dither artifact size. You'd also have much more control over the contrast and brightness of the dithering. Textures with high frequency detail like stone and wood act as naturally dithering for both banding and Cycles noise. They can make the difference between rendering at 1000 samples or 250. For the case you presented, I would use wood for the floor and since wood has a lot of subtle high frequency noise it would act as dithering. For the walls, I would use a faint noise texture to simulate the small, subtle splotches we see that are created by a paint roller. This would also act as dithering.
Author

@MarcClintDion
Of course dithering should be an option. My last post could be misunderstood.
Right now dithering can't be applied on "Save Image", no matter what options you choose.

By "auto-convert with dithering" I meant: float -> byte and optionally dither.

@MarcClintDion Of course dithering should be an option. My last post could be misunderstood. Right now dithering can't be applied on "Save Image", no matter what options you choose. By "auto-convert with dithering" I meant: float -> byte and optionally dither.

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Setting as TODO, this is a missing feature, not a bug.

Setting as TODO, this is a missing feature, not a bug.

Added subscriber: @Inwader77

Added subscriber: @Inwader77

dithering effect calculate after rendering - press F12 in your file and then (don't press Esc and don't go out image editor) move dithering set and look on result - we will see changing in render result

dithering effect calculate after rendering - press F12 in your file and then (don't press Esc and don't go out image editor) move dithering set and look on result - we will see changing in render result
Author

@Inwader77 I think what you describe is dithering after rendering, which is functioning without flaws (Dithering is applied on the "Composite" Node).
What I mean here is dithering the texture after texture baking.

@Inwader77 I think what you describe is dithering after rendering, which is functioning without flaws (Dithering is applied on the "Composite" Node). What I mean here is dithering the texture after texture baking.
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Member

Blender Render has been removed in Blender 2.8.

Blender Render has been removed in Blender 2.8.
Author

@Blendify please correct me if I'm wrong, but closing this issue because Blender Render was removed doesn't make sense to me, because you can perfectly use Cycles to bake textures.
But I'm ok with it because it is not a bug but more like a feature request.
For all interested in producing dithered textures, there is a workaround:
Newer GIMP versions support dithering when converting from 16 or 32 bpc to 8 bpc.
So you can bake 32 bit textures in Blender, export them as exr, open the exr file in GIMP, convert to 8 bit with dithering, export as PNG.
Not very streamlined but it works.

@Blendify please correct me if I'm wrong, but closing this issue because Blender Render was removed doesn't make sense to me, because you can perfectly use Cycles to bake textures. But I'm ok with it because it is not a bug but more like a feature request. For all interested in producing dithered textures, there is a workaround: Newer GIMP versions support dithering when converting from 16 or 32 bpc to 8 bpc. So you can bake 32 bit textures in Blender, export them as exr, open the exr file in GIMP, convert to 8 bit with dithering, export as PNG. Not very streamlined but it works.

Added subscriber: @brecht

Added subscriber: @brecht

Changed status from 'Archived' to: 'Open'

Changed status from 'Archived' to: 'Open'

Right, this is not Blender Internal specific.

Right, this is not Blender Internal specific.
Brecht Van Lommel added this to the Render & Cycles project 2023-02-07 19:07:34 +01:00
Philipp Oeser removed the
Interest
Render & Cycles
label 2023-02-09 13:56:49 +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 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#41185
No description provided.