Replace 'compare' node with Color ramp in order to have faded edges

I’m making a volumetric shader, roughly based around Bad Normal’s Shockwave tutorial: https://www.youtube.com/watch?v=VYheukEYnaY

and part of it uses a Compare node to make a spherical shell, with a thickness determined by the epsilon:

and the good thing about this is that you can animate the value to increase/decrease the diameter of the shell while the thickness remains constant.

What I’d like to do is basically recreate the compare node with a color ramp so that I’m able to fade the edges of what would be the ‘epsilon’ area.

I think it’s going to involve a couple of map range nodes going into and out of the color ramp, but I just can’t quite figure it out.

This gets close, and I can animate the value node to expand/contract the shell but because it’s remapping the range of the color ramp, it ends up scaling the epsilon area:

Wouldn’t it help to place the Color Ramp before the Map Range node?

I think in theory, the generated coordinates only go from 0 → 1, so I thought you might be onto something, but remapping the output of the color ramp doesn’t shift the area that is within the light part of the color ramp, it just makes everything brighter, as it is making the areas that are ‘0’ into, say ‘1’

It would be helpful to see the whole node tree. I am not sure what exactly you are trying to do.

I think this is actually doing what I want o:

the map range ahead of the color ramp is remapping the start and end, so the range between min/max is still 1, just being shifted about, with the epsilon area staying constant.

Here’s the blend in case you are curious:
color ramp compare.blend (838.6 KB)

Don’t you lose the fading effect of the edges when you set your ramp to “constant”?

1 Like

Yes, this setup of the color ramp node was used just to get the exact same effect as the compare node so that I could better see that the range was constant when I remapped the color ramp