Hello,
This is maybe due to fatigue but I do not understand the code of the REFRACTION part of the playground.
To be more specific: it is linked with this specific block of code
// 1
else if (closestObject == SphereObj) {
inside = !inside;
// 2
float ior = inside ? 1.0 / 1.33 : 1.33;
cam = refractRay(cam, normal, eps, ior);
}
I tested and see the impact of replacing
inside = !inside;
by
inside = true;
Which I would be confortable with. I see it does not work. But I cannot figure out why.
I think it is linked to my inaccurate understanding of ray marching.
Indeed, for me the ray is “stopped” when in contact between the ray and the object is triggered.
So why can we switch and memorize inside
for further I would feel loops.
You can see. I am confused with this part.
Do you have any Idea of which (I hope small) part of the book I should read to try to have a better understanding of this part…
Thank you and take care.