Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New higher continuity polynomial in article #2

Open
keeffEoghan opened this issue Dec 4, 2019 · 0 comments
Open

New higher continuity polynomial in article #2

keeffEoghan opened this issue Dec 4, 2019 · 0 comments

Comments

@keeffEoghan
Copy link

IQ has added a new version of the polynomial smin to the article, could it be added here?

EDIT 5 years later - I have learnt that Media Molecule used the polynomial smin() presented here for their game "Dreams" (credited to Dave Smith), although their rewrote it in an equivalent but more efficient form to look like this: ...
As noted by Shadertoy user TinyTexel, this can be generalized to higher levels of continuity than the quadratic polynomail offers (C1), which might be important for preventing lighting artifacts. Moving on to a cubic curve gives us C2 continuity, and doesn't get a lot more expensive than the quadratic one anyways: ...

Code for the latter:

float smin(float a, float b, float k) {
    float h = max(k-abs(a-b), 0.0)/k;

    return min(a, b)-(h*h*h*k*(1.0/6.0));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant