How to sample angular environmental map?

Practical and theoretical implementation discussion.
Post Reply
shiqiu1105
Posts: 138
Joined: Sun May 27, 2012 4:42 pm

How to sample angular environmental map?

Post by shiqiu1105 » Thu Nov 27, 2014 9:21 pm

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 :)

MohamedSakr
Posts: 83
Joined: Thu Apr 24, 2014 2:27 am

Re: How to sample angular environmental map?

Post by MohamedSakr » Thu Nov 27, 2014 9:32 pm


shiqiu1105
Posts: 138
Joined: Sun May 27, 2012 4:42 pm

Re: How to sample angular environmental map?

Post by shiqiu1105 » Fri Nov 28, 2014 2:03 am

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.

koiava
Posts: 47
Joined: Thu Apr 24, 2014 8:18 am
Location: Tbilisi, Georgia
Contact:

Re: How to sample angular environmental map?

Post by koiava » Fri Nov 28, 2014 8:19 am

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 );
}
Colibri Renderer

Post Reply