Strange artifacts with Musgrave texture

I’ve been using Musgrave textures for years, but in 2.79, I am getting some ugly artifacts along the edges of the object. It doesn’t happen in the preview render, only in the final render. Is anyone else getting this? It can easily be recreated by simply connecting a Musgrave texture straight into a diffuse shader.

It could be recreated with an example .blend that you provide, which would also have denoising enabled.

Negative values in the texture and denoising produces the artifacts. Remove negative values from the texture or disable denoising.

If you plug musgrave into bump mapping, you’ll see that it will often have data that goes well outside the visible 0-1 range. I’ve made my own node group to help preview the output and help scale it back into the 0-1 range for color use. I wish it had a (auto) normalize switch built in, but I don’t think it’s feasible.

You can get everything into the 0-1 range by using the bright/contrast node and lowering the contrast value to about -0.750

In addition, just to be sure, you can first pipe the result through a color mix or math node and tick the ‘clamp’ box.

The musgrave controls should really be greyed out if they are not applicable to the currently selected musgrave mode (without disconnecting the inputs of course, even if they don’t do anything). Contrast might work in some cases, but in others (depending on settings you can get stupid high output values) I prefer my adjustment node where I can also preview clipping. With clipping preview enabled, I get black for n<0, white for n>1, and a grey constant for anything in between. Adjust measured values until all is grey, then turn off Clip Preview. Here is the node group setup: