Page MenuHome

[Bug] Normal map baking is broken
Closed, ArchivedPublic

Description

System Information
Operating system: MacOs Catalina and Windows 10
Graphics card: Intel Iris Graphics 6100

Blender Version
Broken: tested in 2.91 and 3.0.0

Short description of error
I'm trying to bake bevel to normal map and faced a problem. When you bake bevels in a blender, they look completely broken. I did some tests and compared them with 3ds max. As a result, I found out that blender exaggerates normal map contrast by about 2.5 times which breaks the chamfers on cube.

Next, I made a cube with very large chamfers to compare how the 2 algorithms behave.

Normal map baked by 3ds max:

This looks pretty good.

Normal map baked by blender:

Naturally i installed Non Color value. Problem is with the recording when baking. Blender Normal map looks grossly exaggerated,
and as you might have noticed, he cut off the corners of the cube.

I am attaching 2 normal maps that I got.
Normal map texture baked by 3ds max:


Normal map texture baked by blender:

I also tried to increase the contrast of the texture in Photoshop, and noticed that the Blender creates parasitic gradients on flat surfaces.

Exact steps for others to reproduce the error

  1. Make cube mesh.
  2. Make bevel cube mesh.
  3. Select Cycles
  4. Set bake settings -> Normal, Tangent, +X+Y+Z, Select to active
  5. Select meshes and create material with image texture.
  6. Bake

.blend file :

Event Timeline

This looks like same issue as T85475 maybe? Does it help if you enable cage option? It does produce better result here.

Richard Antalik (ISS) changed the task status from Needs Triage to Needs Information from User.Dec 10 2021, 10:01 PM

This looks like same issue as T85475 maybe? Does it help if you enable cage option? It does produce better result here.

It didn't work for me. You can see .blend file that I have attached. This problems are really similar, but here I have provided some more additional information.

In addition to enabling the cage option with no cage object selected, one more change will bring you very close to the baked 3ds max normal map you posted.
At the end of the bake settings reduce the Margin from 16 px to 3 px and bake again.
This will bring you as close as possible to your 3ds result without changing the models.
A 2.75 px margin would be even better but only integer values are allowed for the margin.
For extra precision you could also export the 2px and 3px margin maps and interpolate towards maximum 3ds likeness with a paint program or Python script that does the 3px*alpha+(1-alpha)*2px thing.

In addition to enabling the cage option with no cage object selected, one more change will bring you very close to the baked 3ds max normal map you posted.
At the end of the bake settings reduce the Margin from 16 px to 3 px and bake again.
This will bring you as close as possible to your 3ds result without changing the models.
A 2.75 px margin would be even better but only integer values are allowed for the margin.
For extra precision you could also export the 2px and 3px margin maps and interpolate towards maximum 3ds likeness with a paint program or Python script that does the 3px*alpha+(1-alpha)*2px thing.

I already tried experimenting with margin and cage. But this did not produce any particular results, edges are still tough. Send please blend file where it works for you, I will check it myself, and I will report the results.


Here is the blend file and the normal map generated from it with Blender 3.0.0.


Here is the blend file and the normal map generated from it with Blender 3.0.0.

I't works, thanks!

A 2.75 px margin would be even better but only integer values are allowed for the margin.

will this be fixed in the future?

I do not think that is a necessary feature. You can also get fractional margins in another way, 2.5px was even better than 3px.
Create a 4k texture, render with 5px margin and scale down by a factor of 2 to get a 2k texture.
It almost matches the 3ds one perfectly, you really have to zoom and enhance to see a difference.

Now I am not sure, should I close this or is there something that is bug? For example that color gradient? (can't reproduce that with buffer in memory, perhaps it is issue when image is saved)

Richard Antalik (ISS) closed this task as Archived.Feb 1 2022, 3:06 AM

I think I will close this report. Even if baking is not perfect out of the box, this doesn't mean it's a bug necessarily and seems to be rather request for improvement which we do not handle here. Also same goes for if the quality of bake is not matching other software. Bugs should be either regression from previous versions or code not working as it was meant to work.

For user requests and feedback, please use other channels: https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests
For more information on why this isn't considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug