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

A few refraction index functions #16

Open
zsparal opened this issue Oct 15, 2015 · 3 comments
Open

A few refraction index functions #16

zsparal opened this issue Oct 15, 2015 · 3 comments

Comments

@zsparal
Copy link
Contributor

zsparal commented Oct 15, 2015

diff = distance(lens.origin, p);
if (diff > 0.001){
    index = 1.0 / diff;
} else {
    index = 1000;
}

Try these in the diff > 0.001 part of the if branch:

  • index = exp(diff) / diff;
  • index = 1.0 / sqrt(diff);
  • index = 1.0 / cbrt(diff);
  • index = erf(1.0 / diff);
  • index = exp(1 / cbrt(diff)) * (1 / diff);
  • index = 1.0 / ((diff) / (diff + 1));
  • index = 1.0 / ((diff * (6.2 * diff + 0.5)) / (diff * (6.2 * diff + 1.7) + 0.06));
  • index = sqrt(length(p));

Doesn't fit on a list:

index = 0.5 * (fabs(0.5 * diff) + sqrt(1 - (pow(fabs(fabs(diff) - 2) - 1, 2))) -
        1 / 112 * (3 * sqrt(33) - 7) * diff * diff + 3 * sqrt(1 - (diff / 7) * (diff / 7) ) - 3) *
        ((diff + 4) / fabs(diff + 4) - (diff - 4) / fabs(diff - 4)) - 3 * sqrt(1 - (diff / 7) * (diff / 7));
index = fabs(index);
@zsparal zsparal changed the title A few cool refraction function A few refraction index functions Oct 15, 2015
@leios
Copy link
Owner

leios commented Oct 15, 2015

Haha, some of these look like loads of fun! I'll try a few of these on stream tomorrow, for sure!

Thanks again for all your help!

@zsparal
Copy link
Contributor Author

zsparal commented Oct 15, 2015

Most of them are fairly similar, but they still look cool.

@leios
Copy link
Owner

leios commented Oct 15, 2015

Yeah, I will certainly be checking them out. I never really thought about doing raytracing art before...

I also found the formula for the refractive index of the invisible lens, so I'll be trying that tomorrow too!

Super excited!

Thanks again!

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

2 participants