Page 1 of 1

How to sample angular environmental map?

Posted: Thu Nov 27, 2014 9:21 pm
by shiqiu1105
I found a couple of cool hdr environmental map here: 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 :)

Re: How to sample angular environmental map?

Posted: Thu Nov 27, 2014 9:32 pm
by MohamedSakr

Re: How to sample angular environmental map?

Posted: Fri Nov 28, 2014 2:03 am
by shiqiu1105
MohamedSakr wrote:I think you are looking for this https://github.com/mmp/pbrt-v2/blob/mas ... finite.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.

Re: How to sample angular environmental map?

Posted: Fri Nov 28, 2014 8:19 am
by koiava
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 );
}