sxyu / volrend

PlenOctree Volume Rendering (supports CUDA & fragment shader backends)
Other
608 stars 84 forks source link

what is dda_unit doing? #24

Open brabbitdousha opened 1 year ago

brabbitdousha commented 1 year ago
void dda_unit(vec3 cen, vec3 invdir, out float tmax) {
    float t1, t2;
    tmax = 1e9f;
    for (int i = 0; i < 3; ++i) {
        t1 = - cen[i] * invdir[i];
        t2 = t1 +  invdir[i];
        tmax = min(tmax, max(t1, t2));
    }
}

I may have trouble understanding it...could you help me..many thanks!.. It looks like the t1 is trying to go back to the origin...

liaohuanxuan commented 5 months ago

I had the same question. Do you understand?