i've recently hit a wall trying to create a smooth stepped function.

Here is what i'm trying to replicate:

enter image description here

Where the rising line would represent a single float output.

I've found something on Math.stackexchange that i think could suit my needs, but my math knowledge is far too limited to try and convert what i've found there into a simple function that i can replicate with math nodes.

I've got a regular stepped function working, but the "switching" is a hard cut atm.

I'm trying to divide a color ramp in equal spacings, where the output color would be "clamped" to an increment, but not like "constant", it should blend to the next color so to say. The output would be remapped to fit the input value for the ramp. It obviously would be possible to do it manually, but i need it a bit more automated.

Hope what i'm trying to do is understandable.

Has anyone got an idea :)? Thanks in advance.


1 Answer 1


The basic idea is to use

$$\mathrm{floor}(x) + \mathrm{smooth}(\mathrm{fract}(x))$$


  • floor(x) is the floor, an unsmoothed step function
  • fract(x) is the fractional part of x
  • smooth(x) is the smoothing function of your choice, defined on the interval [0,1]. For continuity, we require smooth(1) = smooth(0) + 1.

or as nodes

Equation as nodes

where I used a Float Curve node to supply the smoothing function. This produces the following output.

As you can see, this is just a bunch of shifted copies of the smoothing function stuck together.

You can modify this by

  • Replacing the smoothing function to change the "shape" of the steps.
  • Scaling and shifting the input to change the width of the steps and the locations of the "jumps".
  • Scaling and shifting the output to change the height of the steps and the offset of the graph.
  • $\begingroup$ Thank you! Thats amazing, i was hoping i could use a visual way to change the "curve" :) Its far simpler then i thought! $\endgroup$
    – Chris
    Jul 17, 2022 at 11:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .