Questions tagged [smoothstep]
11 questions
13
votes
3 answers
How to implement a smooth clamp function in python?
The clamp function is clamp(x, min, max) = min if x < min, max if x > max, else x
I need a function that behaves like the clamp function, but is smooth (i.e. has a continuous derivative).

Roko Mijic
- 6,655
- 4
- 29
- 36
6
votes
2 answers
what is the case for edge0 greater than or equal to edge1 for smoothstep function glsl
I am looking into smoothstep(edge0, edge1, x) function.
docs say results are undefined if edge0 >= edge1.
In a shader there is a line:
smoothstep(radius + SIZE, radius + SIZE / 1.2, dist);
this means edge0 >= edge1 it still works fine, how is that…

eguneys
- 6,028
- 7
- 31
- 63
5
votes
3 answers
XNA MathHelper.SmoothStep? How does it work?
I have a car and when accelerating i want the speed to increse "slowly"..
After looking at a few sites i came to the conclusion that the SmoothStep method could be used to do that?
I pretty much know how to move textures and stuff, so an example…

Moulde
- 3,438
- 4
- 29
- 38
3
votes
1 answer
Smoothstep function
I'm trying to get some results to plot on a graph by using the Smoothstep function provided by AMD which was fount on this Wikipedia page Smoothstep. Using the;
A C/C++ example implementation provided by AMD[4] follows.
float smoothstep(float…

Moynul
- 635
- 1
- 8
- 30
3
votes
4 answers
Inverted Smoothstep?
I am currently trying to simulate ballistics on an object, that is otherwise not affected by physics. To be precise, I have a rocket-like projectile, that is following an parabolic arc from origin to target with a Lerp. To make it more realistic, I…

Tuxedomask
- 53
- 2
- 6
2
votes
2 answers
Drawing a circle using smoothstep() with dot() or length() produces different results
Consider the simple shader below (head over to shadertoy.com/new and paste the code to try it out).
Basically, I'm trying to figure out if it is possible to tweak the dot() version to get the exact same result for these two function…

l33t
- 18,692
- 16
- 103
- 180
2
votes
1 answer
'smoothstep' : no matching overloaded function found
I am going through the Book of Shaders tutorial on GLSL and I attempt to use the smoothstep function but I get this error. You can see it happen when I changed the step to the smoothstep function below.
// Author @patriciogv - 2015
//…

jumbopap
- 3,969
- 5
- 27
- 47
1
vote
1 answer
How to use smoothstep function using renderscript in android
How can we use the smoothstep function in renderscript to smoothen a mask image (already blurred using gaussian blur with kernel size 3 or 5) and make its edges smoother. I tried the following code in other frameworks and they worked as…

anilsathyan7
- 1,423
- 17
- 25
1
vote
1 answer
How to optimize this smoothstep function ? Is there any alternative?
In one of my projects, I use the following smoothstep() function :
float smoothstep(float a, float b, float m, int n)
{
for(int i = 0 ; i < n ; i++)
{
m = m * m * (3 - 2 * m);
}
return a + (b - a) * m;
}
It works great,…

tigrou
- 4,236
- 5
- 33
- 59
0
votes
2 answers
Smoothstep function in java opencv
Is there an equivalent of 'smoothstep' function in opencv (java)?It is commonly used in opengl/glsl and is available as a standard built-in function in many other standard image-processing libraries.May be we can implement it using combination of …

anilsathyan7
- 1,423
- 17
- 25
0
votes
2 answers
General smoothstep equation
I saw this in Wikipedia: Generalization of higher-order equations
My code when I tried to implement it:
function generalSmoothStep(a, x) { //Generalized smoothstep
var result = 0;
for (var n = 0; n < a - 1; n ++) {
result += binom(-a,…

Trung0246
- 689
- 1
- 10
- 21