These are chat archives for buddhi1980/mandelbulber2

Feb 2016
Sebastian Jennen
Feb 25 2016 19:46

i checked out the reference for reflection / refraction
and thought i give schlick approximation a try, maybe this could save render time:

double rSchlick2Reflectance(const CVector3 &normal, const CVector3 &incident, double n1, double n2)
        const double r0 = (n1 - n2) / (n1 + n2);
        const double r02 = r0 * r0;
        const double cosI = -normal.Dot(incident);
        double x;
        if(n1 > n2)
                const double n = n1 / n2;
                const double sinT2 = n * n * (1.0 - cosI * cosI);
                if(sinT2 > 1.0) return 1.0; //total internal reflection
                const double cosT = sqrt(1.0 - sinT2);
                x = 1.0 - cosT;
                x = 1.0 - cosI;

        return r02 + (1.0 - r02) * x * x * x * x * x;

but i ended up getting the exact same render times for all use cases i came up with. @buddhi is the difference in calculation time for the reflactance/refraction always negligible to the raymarching process, or could this take effect in some configuration?

Krzysztof Marczak
Feb 25 2016 19:48
The biggest amout of time is not consumed by reflectance equations but by ray-marching inside the fractal object
calculation of reflectance value is very fast because it's calculated once only when ray hits fractal surface
then ray is going forward outside or inside the fractal, but for this there are calculated fractal interations which are much more CPU consuming
Sebastian Jennen
Feb 25 2016 20:17
thats too bad, at least i finally understood the fresnel equations :)