Page MenuHome

Visible wireframe artifacts after baking normal map with bevel shader (2)
Confirmed, NormalPublicBUG

Description

System Information
Operating system: Windows 10 Pro
Graphics card: Radeon(TM) RX 460 Graphics

Blender Version
Broken: 2.81 (sub 16), branch: master, commit date: 2019-11-20 14:27, hash: 26bd5ebd42e3, type: Release
Worked: do not know

Short description of error
Wire-frame like artifacts on the baked normal map when using bevel shader node

Exact steps for others to reproduce the error

  1. Open provided .blend file
  2. Select the half_sphere object
  3. In "Render Properties" panel in the "Bake" section press "Bake"
  4. Replace the normal input of the Principled BSDF node with the newly baked normal map
  5. Preview the normals on the half_sphere and plane objects

Long description of error

It seems to me that the bevel shader node is affecting the normals across the all shading points on the surface and not just at the place where there is beveling,
which produces easily visible artifacts that follow the mesh wire-frame, especially when using high gloss values.

In the image bellow and in the blend file normal map is shown on a plane to see the issue more easily:

But the issue is visible on the model itself and persists when working with other models and blend files:



Normal map exaggerated with levels in PS for illustration:


Clearly visible artifacts in the places where normals should be flat (pointing up) and shouldn't be affected by the bevel node.
This is why i think (i might be guessing too much) this is the same issue as in https://developer.blender.org/T61916. But the OP never responded to clarify the issue.

As i tried to work around this issue i also found out:

  1. Artifacts are also visible when baking with low-poly, high-poly and averaged cage setup
  2. Artifacts are not visible when baking object space normals

Which is really not a viable option since there is no multi-sampling when baking in blender, and we get other kind of artifacts where normals should simply be flat.
Below is object space map rebaked to tangent space map

  1. When i subtract world normals from geometry node with world normals from bevel node i saw this:

Which at first seems as expected result, but when i added gamma node after the vector math node:

Result above suggest to me (i am just guessing as a layman) that the range of bevel shader node effect on the surface normals is quite wider then it should be. Setup i used is provided in "Collection 2" of the blend file.

So is this a bug, an unavoidable side effect of bevel shader, or it can be improved so this effect is masked and doesn't affect places where normals should remain flat?!

Event Timeline

Little update:

Using uncompressed tiff format seems to give better results.

png bake

tiff bake

and with using setup like this one can get rid of most of the artifacts

Tho they are still somewhat present when i tested with other models

Philipp Oeser (lichtwerk) lowered the priority of this task from 90 to 50.Nov 29 2019, 12:27 PM

The baking issues where mentioned in comments from D2803: Cycles: add bevel shader, for raytrace based rounded edges. as well and in T61916: Visible wireframe artifacts after baking normal map with bevel shader (which just died because of inactivity).

Not knowing the internals well, I am not even sure if one get around this issue [other than your proposed node setup workaround], interesting point though about tangent vs. object space.
Will confirm for now, maybe cycles wizards can shed some light on this?

CC @Brecht Van Lommel (brecht)
CC @Stefan Werner (swerner)
CC @Lukas Stockner (lukasstockner97)
CC @Sergey Sharybin (sergey)

I am having a similar issue with baking the normal from the bevel node to be used in a real time engine. The wireframe becomes very visible when the normal map baked is plugged to the principled shader with no roughness and the metallic input set to 1.

I have the same result when I bake from the latest development version of 2.79 and 2.81a.

Here is the difference between a normal map baked and displayed in Eevee and the result from Cycles (10 samples in the viewport).



Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".Feb 6 2020, 9:38 AM

Still unsure if this should be called a bug or a Known Issue (and still havent looked at internals...)
But since Cycles itself is able to render this without artifacts, will dare to call this a bug for now...

@Brecht Van Lommel (brecht): do you think this could be resolved?

But since Cycles itself is able to render this without artifacts, will dare to call this a bug for now...

This is wrong @Philipp Oeser (lichtwerk) .
edit here: Might have misunderstood: Yes, it renders fine, but it bakes with issues

I was the one who made @Marko Tatalovic (Fuxna) aware of this issue in the first place - and I did render my maps in Cycles in 2.8 as well as 2.81, all with the bug.
And I can also reproduce it every single time. On some faces the wireframe isnt as visible as others, but they are there and do compromise the normal map.

Here is another picture of a normal map from a production asset baked with Cycles and the Bevel Shader in 2.8

So far I had this on every model I ever worked on. Question isnt "could this be resolved" - It really should be "how should we resolve this", cause it quite literally is breaking the workflow to bake normal maps with the Bevel Shader.

Not too sure how complex it would be to solve but it is true that this workflow with the bevel node is currently not viable in Blender. The wireframe is "baked" on the normal map as soon as faces are not perfectly flat.

What I meant was that Cycles ( no baking) does not suffer from those artifacts.

What I meant was that Cycles ( no baking) does not suffer from those artifacts.

Yes, Cycles is perfect :-) which tends to show that the baking process has a bug.

What I meant was that Cycles ( no baking) does not suffer from those artifacts.

Yeah I know, my brain had a hiccup at that moment hence my edit later.

But it really needs to be looked at. Its painful to get a good, clean bake.

Hello everyone, I have the same problem with the unclean baking result.
I'd like it to be fixed cause I really want to use Blender in a production environment, but like the others, the bevel baking methon is unusable

I'm having the same problem with baked normals.

However, instead of using the Bevel Node, I was using the Bevel Modifier. I'm not sure how these things work (maybe both the Node and the Modifier function similarly), so I just tested doing a bake without using anything "bevel".

I used the Subsurf Modifier on the high-poly cube, and edge loops at the corners to create beveled edges. The normal map baked from it also had these artifacts.

Also, I think this may not be connected to the mesh wireframe. While it also happens sometimes, I've had a case were the artifacts are completely crazy, nowhere similar to the wireframe.


Image: The artifacts on the right side seem to follow the wireframe, but the center ones are an absolute mess.

Also worth noting, I can swear it wasn't happening, and then it suddenly began. I may have gone crazy since then because of this issue, but I wasn't back then.

I was doing the baking for my model and the reflections were not that distorted everywhere, I only had a few artifacts in some areas (these ones appeared related to the wireframe), but then, suddenly, they began. All while in the same session of blender, without even reloading the file or something.

According to the first screenshot I have of this bug, it began in the 7th of January. This post clearly shows that this has been happening since at least November of last year, however it was fine (or much less noticeable) for me in the 7th of January and, IIRC, some days before. This makes zero sense to me.

@Gabriel Maio (BioDestroyer)

However, instead of using the Bevel Node, I was using the Bevel Modifier. I'm not sure how these things work (maybe both the Node and the Modifier function similarly), so I just tested doing a bake without using anything "bevel".

Bevel Node and Bevel Modifier have absolutely nothing in common. Bevel shader does not modify the geometry, rather its shading effect that modifies normals on render. And please if you already have decided, to take time to share your problem with us, and devs, make sure its on actual bug report that is relevant to your problem. IMO your problem and our problem here are not related. Simply because, this issue is tied to baking with bevel shader as title says, and we didn't have any problems with baking geometry in general.

Your problem maybe of other kind. Not baking properly, or using formats with low bit depth. If your models are going to be shiny and reflective refer to https://polycount.com/discussion/148303/of-bit-depths-banding-and-normal-maps. This might solve your problem.

Anyway, for sake of solving this particular bug (Visible wireframe artifacts when baking normal map with bevel shader), for which this ticket is made for, for the sake of developers time, regardless if your problem is connected or not, finally for the sake of solving your problem, make sure to describe what you did, and steps taken to get to your issue. You haven't informed us on your baking workflow, on the format used for baking, how do you preview normals. Are artifacts visible on the normal map itself(when looking at the image in PS or similar, as we have)? And you haven't attached your blend file.

Sorry if i am dramatizing, but i really care about this issue being solved. And its not going so well so far.

@Marko Tatalovic (Fuxna)

I used low-poly, high-poly and cage objects to bake the normal map (which was mentioned in the task's description). The artifacts are visible in GIMP after messing with the color levels. I didn't mention these things because it's just like what other comments said, I only said what I did different, but perhaps I should have had mentioned everything.

I didn't attach a Blend file because it happens with everything, even a very basic setup (and I described one attempt in my original comment).

But I'll look at what you suggested and search more about it, maybe there's something for me there and it's truly a different problem.

@Gabriel Maio (BioDestroyer)

Well, if that's the case, it might be that baking in blender is totally broken. But then, how this issue wasn't raised before. I am sure people would rage about it. Cause baking geo is done much more often than baking bevel shader. I think people use bevel shader mostly for rendering effects, which works without any problems, so that's why this bug went unnoticed until now. Also being that artifacts are often subtle and only visible on glossy reflective materials didn't help.

So, after extensive testing and research, I've come to many conclusions. I was actually having two problems, and the first one may be related to this one.

My first problem, the artifacts unrelated to the wireframe: Increasing the bit depth (selecting 32 bit float) when creating a new image through the texture node fixed it. (Doesn't explain why it wasn't happening before, but whatever, it's fixed).

Now, the potential connection to this problem: Later, when I was testing your problem, I noticed your normals also had the pixelated-like artifacts mine had, besides the wireframe ones. Then, I checked the color levels of the image in GIMP, and I noticed one thing: The image created in your setup is 8 bits.

If you create an 8 bit image ('32 bit float' not selected), the color level scale is 0-255, however, in a 32 bit image (16 bit, after saving as PNG), the scale is 00,00-100,00. What the actual difference is, I don't know.

I created a new node, then a new image with 32 bits. The bake made in it didn't have the wireframe artifacts. (Note: I also deselected 'Alpha', I believe that shouldn't affect things, but deselect it, just in case. And you can test if it does, just to know.)

So, while our problems were technically different, they appear to be both caused by baking the normals into 8 bit depth images.

My second problem is unrelated to this, so I won't go into depth here, but just in case anyone is curious: It is the normals of the high-poly model itself that get distorted in certain areas after smooth shading. Sometimes increasing the bevel disguises it well, sometimes it doesn't. Here is an image with examples, just to sate any curiosity:

Left: 3 images showing the reflections, and the normal map with color levels modified in GIMP applied as color below them.
Right top: A mesh with bevel modifier levels of 2-6-12 showing it can still be visible with a roughness of .25 (and I've had even worse cases than this).
Right bottom: 3 different copies of the same mesh with different manual bevels applied.

I'll search more about this, but if I don't find a fix, I'll post it here as another task.

Yea, you can look at my second post (click on show older changes to see it) where i did bake with uncompressed TIFF. Tho it gives better results, wireframe is still visible, at least in my test case, and several other guys that did tests on their own have confirmed the same issue. Not having clear reflections and wireframe artifacts might be separate issues, at least from my experience as a 3D artist (which in this case means very little). Having banding issues with lower bit depth is common and known, in other 3D softwares also.

As for "pixelated noise", yes. Tho those only showed if i bake with bevel shader. Not in general - when baking geometry. That's why in my first post i raised the question why is bevel shader affecting normals that are flat or nearly flat.

@Gabriel Maio (BioDestroyer) Also your example with "manual bevels" is a problem(not a bug) with vertex normals - which also has nothing to do with issue discussed here, but anyway, if you want clear reflection why not use custom/weighted normals?

defualt smooth shading:

Weighted normals modifier

Or set normals from face to get absolutely clear reflection

Also please, lets not clutter this discussion with unrelated topics, anymore. Cheers

Min (Nominous) added a subscriber: Min (Nominous).EditedFeb 25 2020, 9:56 PM

The duplicate by Max (Raytraced) that was merged to this report forgot to mention that he experimented with increasing the bevel shader samples past 16 (512+) by using a custom OSL node, which seems to solve wireframe artifacts in the normal map bake: https://polycount.com/discussion/comment/2701351/#Comment_2701351 Maybe that would be a good path toward solving this problem?

Edit: I just did some test bakes and the OSL node above with 512 samples produces quite clean results on an object that had wireframe artifacts when using the regular bevel shader.

Regular bevel shader (1k image res, 16 bevel samples, 16 render samples):

OSL Node (1k image res, 512 bevel samples, 1 render sample):

This can be tested on the ProbCube1 object in this blend file. I made both image textures 32-bit and non-alpha for each bake:

@Min (Nominous) Maybe, but for me computation time was insane.

Anyway, PLEASE fix this bug. Its SO annoying to see non-useable normal maps.

Once again this is a model with a normal map baked in Blender with Bevel Shader

15 - 30 min for baking bevel is not a right solution. Question is why are normal of the non beveled edges affected in the first place. Can't they be masked and mixed with original normals? All we got on this ticket are distractions, and no response from devs at all. Is it a bug, do we don't understand how to use it, is it a known limitation bla bla bla...

@Sebastian Schneider (Redphoenix) @Marko Tatalovic (Fuxna) The OSL node took me about a minute to bake on an i5-3570k (4.4 GHz, 4 threads total) using the settings I listed above in that blend file. The most important thing is to set the render sample to 1 in the render properties tab. Setting it higher slows the bake down drastically, but it's unneeded. I still think unlocking the bevel samples in the default bevel shader would be a good experiment and I think the OSL node is a good workaround for now.

@Min (Nominous) Just tested, it seems OSL node gives better results. Thanks!

Did some tests:
@Min (Nominous)
@Philipp Oeser (lichtwerk)

OSL bevel shader(512 samples, 12 render samples):

OSL bevel shader(512 samples, 1 render sample):

Blender's bevel shader(16 samples, 12 render samples):

Blender's bevel shader(16 samples, 1 render samples):

It seems baking with render samples >1 introduces artifacts, both OSL node with 512 samples, from file that @Min (Nominous) supplied, and blender's default bevel shader with max 16 samples give pretty much same result in regards to artifacting.

Blender's bevel shader 12 vs 1 render samples (16 samples for bevel shader):


I tested with the OSL node from @Min (Nominous) with 512 Samples - still the same errors.

Please, please do not ignore this....

Even tested with Blender 2.82.7 - Just one Rendersample but 512 OSL Node Samples. Same result


Checked again with the scene from @Min (Nominous)

Also after talking with @Marko Tatalovic (Fuxna) we found out that it only happens if you bake on an angled surface.

See:

And flat:

Here's a .blend file with steps to reproduce the issue.

  1. Select the mesh named "high" first, then select the mesh named "low" second.
  2. In the Render properties tab, scroll down to the Bake rollout and click Bake. The file is already set up for "Selected to Active" baking with a cage mesh (the most ideal and realistic scenario for a normal bake in production).
  3. Observe the normal map on the low poly in Eevee and Cycles has artifacts.

The artifacts are twofold - some follow along interior edges, and some are speckled along boundary edges. Both make this an unusable production workflow, as results vary greatly based on geo when they shouldn't. The meshes used are completely practical for a production scenario.

I sincerely hope this bug gets some attention. This has potential to be an insanely useful workflow, but currently cannot be relied upon for production.

Images of artifacts in question:




Any news on fixing this? This shouldn't take ages and could be as simple as unlocking the samples in the default bevel shader.

Bumping this thread as I am really waiting for this bug fix as it could really speedup my production.

For now I am just taking my assets with creases through zbrush and making the bevels there but thats kinda slow process.

Also I am not sure how to open this custom OSL node with unlimited samples in default blender. Is it even possible?

Bumping this thread as I am really waiting for this bug fix as it could really speedup my production.

For now I am just taking my assets with creases through zbrush and making the bevels there but thats kinda slow process.

Also I am not sure how to open this custom OSL node with unlimited samples in default blender. Is it even possible?

For now you can use the solution posted by sqrRedwend on Polycount at https://polycount.com/discussion/214315/blender-2-8-bevel-shader-normal-map-baking-artifacts-on-flat-surfaces.
I used this to bake at 1024 bevel samples and it got rid of all my artifacts.