(L) [2014/11/27] [tby shiqiu1105] [How to sample angular environmental map?] Wayback!I found a couple of cool hdr environmental map here: [LINK http://www.pauldebevec.com/Probes/]
It's all angular map though. Any idea how to sample them with ray tracing? Sample code would be helpful too [SMILEY :)]
(L) [2014/11/28] [tby shiqiu1105] [How to sample angular environmental map?] Wayback!>> MohamedSakr wrote:I think you are looking for this [LINK https://github.com/mmp/pbrt-v2/blob/master/src/lights/infinite.cpp]
I don't think that's what I need. pbrt uses rectangular env map, not the kind in the link I posted.
Thanks for the hint though.
(L) [2014/11/28] [tby koiava] [How to sample angular environmental map?] Wayback!as I guess you need something like this:
color envMap::GetColor( vec3 dir );
So, there is really simple math.
assumption is that those images is taken from infinite distance and viewing rays are parallel, for example (0.0, 0.0, 1.0)
color envMap::GetColor( vec3 R ) {
    const vec3 E( 0.0, 0.0, -1.0 );
    vec3 N = (E+R).normalize();
    //calculate (u,v) in [0,1) range
    float u = 0.5*(1 + N.x);
    float v = 0.5*(1 + N.y);
    return envMapImage.GetColor( u, v );
}