leios / simuleios

Simulations for LeiosOS
https://www.youtube.com/user/LeiosOS
MIT License
198 stars 45 forks source link

A few refraction index functions #16

Open zsparal opened 9 years ago

zsparal commented 9 years ago
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:

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);
leios commented 9 years ago

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 commented 9 years ago

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

leios commented 9 years ago

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!