Page MenuHome

Dithering is not applied for Texture Baking
Open, NormalPublic


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.



Event Timeline

Robert M (robertm) added a project: BF Blender.
Robert M (robertm) set Type to Bug.
Robert M (robertm) created this task.
Robert M (robertm) raised the priority of this task from to Needs Triage by Developer.

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

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

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

@marc dion (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.

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

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

@Alexey (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.

Aaron Carlisle (Blendify) closed this task as Archived.

Blender Render has been removed in Blender 2.8.

@Aaron Carlisle (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.

Brecht Van Lommel (brecht) reopened this task as Open.

Right, this is not Blender Internal specific.