I suggest to replace step() by my softstep() -> soft egdes for lighting and shadowing

I suggest

float softstep(float f,float x,float edge) {
float y = edge - x;
return 1.0 / (1.0 + exp(-f * y));

I have an application for this, but I am not allowed to post links here.

Thorsten Kiefer

There is a smoothstep function [STRIKE]since GLSL 130[/STRIKE]

That man page is wrong; smoothstep() has been there since the very beginning (100, 110 and 120.)

…and it’s no good unless it’s implemented in hardware. Otherwise you may as well just write the function in the OP and use that instead.

So if you use the smoothstep function you have a chance that some implementations support it in hardware and some others at least generate efficient
code as it is a builtin compiler intrinsic in their GLSL compiler, but when you use your own function it will always be implementend in software, which
makes the builtin function more desireable than writing your own.

But IMO that’s not the point of the OP. As I understood it, the GLSL step function should be replaced with their smother setep function.

I tried a few combinations of both the “softstep” and smoothstep function above in wxmaxima+gnuplot and I see no problem approximating the behaviour of the former by
using the later.

Therefore I suggested to look at the manpage of the smoothstep function as I thought the OP might not know about it.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.