Bump map node question

Hi, I’m interested to know the cause of the bump map node creating stepping artefacts if something is connected to it’s height input:

The height input data is smooth:

But the resulting normal results in stepping artefacts, even if the strength is set so low the bump is barely visible:

which of course ends up with a terrible end result:

Does anyone know the cause of this? Perhaps the bump node’s normal output is insufficient bit depth?

Maybe I misunderstand something, or you mean something else, but are you not just seeing the discontinuities in the height you put in? you take the fractional part of the UV x coordinate. That goes from 0 to 1 and then jumps abruptly back to 0.

edit: Oh I see you probably mean something else. Aren’t the things at the red arrows just the edges of the polygons of the mesh? Are you sure it’s shaded smooth?

edit2: I do see the discontinuities when I plug the normal into the base color. But when I just plug in into the normal and set my mesh to shade smooth it looks perfectly smooth, except for the discontinuities in the sawtooth of course.

The bump node layers the normals calculated from it’s input over the existing normals of the mesh. Which are discontinuous.
Setting shade smooth averages the face corner/edge normals to make it smooth, but that happens just before rendering, later in the pipeline.

BTW: wouldn’t this question be more of a ‘support’ question for the #support channel on blender.chat?

1 Like

Hi, I’m actually interested in what’s going on in the code to cause this rather than instructions of how to overcome it with technique (as I don’t think that’s possible).

The artefacts aren’t discontinuities in the height map caused by uv repetition, because as you can see in the first image, the height map that’s generated by those repeating frequencies is seamless. I’m guessing it has to do with the calculation inside the bump map node. Perhaps it has to do with insufficient bit depth? Or maybe the true normal being used for calculation rather than the smoothed normal as seen here:

smoothed sphere’s true normal:

smoothed normal:

edit: I must apologize. because I tried reproduce this again on mys desktop. And it turns out that setting shade smooth doesn’t work as soon as you put in this bump map after all.

I don’t really understand because I tried recreate this node tree on my laptop this afternoon, and then it looked like it was smooth. But whatever I try I can’t reproduce that anymore.

This is it. But I’d expect it to happen before the bump node …

very strange. On my laptop it works like it should! I’ll investigate more tomorrow.

1 Like

Not at the PC at the moment, but I wonder if it’s using a different library dependant on whether rendering is performed by cpu or gpu? Although I thought all of the pre-render calculations were performed on CPU. Maybe intel vs amd?

No, I looked at it again. And it turns out it happens at my laptop as well. It’s just that it’s monitor was turned down in night mode and was a lot harder to see.

It’s not that the smooth shading doesn’t work. Because shade smooth makes it a lot smoother. What I think happens is that a new ‘virtual’ surface is calculated from the real geometry + the bump map. And the normal from that new surface is mixed with the smoothed normal according to the strength. Because the ‘virtual’ surface is based on the real geometry, it contains the discontinuities. Now that I think of it I can’t really think of another way to do it efficiently, so I think it’s an inherent limitation of the bump mapping technique.
(disclaimer: I didn’t look at the source, this all just based on the behaviour I see)

A normal map doesn’t have this problem. So you could first bake a normal map from a flat plane with your bump input and use that to add the detail to your final model. But I don’t know about a procedural way to do this. It should be possible to generate a normal map from a bump map without baking. Mathematically it isn’t really hard, maybe someone else knows a way?