Page MenuHome

Image Based Lighting: Diffuse prefiltered
Closed, ArchivedPublic

Description

This is part of some work that I'm doing in HDRIBL. It implements the method described in 'An Efficient Representation for Irradiance Environment Maps' (http://graphics.stanford.edu/papers/envmap/), prefiltering a high dynamic range environment map, storing the results as spherical harmonics coefficients and then looking up a normal vector in them to get lighting info.

The UI appears in a new panel in world buttons. This allows you to easily set up an image to use for lighting, that doesn't necessarily have to be the result of background sky textures. It supports HDR environment maps in either the angmap or spherical panorama (latlong) formats. This just lights the models as any usual light source, with no shadows.

As well as this, there's another option in the AO settings that uses the prefiltered IBL to get the AO colour, rather than a sky texture etc. This will use the same IBL image settings as set in world buttons, whether or not image based lighting is switched on. This will look smoother, and give you shadows, though of course using the image based lighting version, you can combine it with whatever kind of lighting you like, eg. plain AO on 'subtract' mode, or shadow buffers, or whatever.

The function that gets the colour is a bit ugly since I can't think of a nice way to easily add/multiply colour vectors without using lots of VECCOPY etc. The paper (and sample code) describes a matrix form that seems a lot simpler - basically just involves setting up a matrix from the coefficients and multiplying it, but I couldn't get it working. Perhaps someone more familiar with that sort of thing might be able to help here..?

Todo:
• I'd like to try storing 'bent normals' in AO, and using that for the normal that gets sent to IBL
• I have some code for importance sampling an environment map, to use in a raytraced option in the image based lighting panel. Will investigate this...

Details

Type
Patch

Event Timeline

Updated this patch a bit:

* Now, when using IBL as an AO source, rather than averaging samples, it calculates the bent normal (average unoccluded vector), and uses that in the IBL colour lookup. This generally gives much nicer results.

* Supports Approximate AO too (bent normals were already there, yay!)

* Started a very basic, but not so good and only partially working importance sampling method. This will be an alternative 'accurate' technique that can give shadows via raytracing, and nice variable shininess.

The plan for this one is to get a good importance sampling method for light points (this current random one is a bit so-so, maybe median cut will be nicer if I can get that going), and also importance sample the BRDF of the material, blending between the two based on shininess. Easy enough for a Phong BSDF, dunno about the others.

I consider the diffuse prefiltered implementation to be pretty complete (though an easy way to rotate the virtual image dome would be nice), however I'm still quite uneasy about the UI. I fear we're running into a very messy situation quickly with this, AAO, potential indirect lighting via AO and AAO, and other future GI methods. We really need a nice logical framework to deal with various approximation/gather methods. Vray's not too bad here... http://www.spot3d.com/vray/help/150R1/render_params_gi.htm

And since files don't attach properly:

the patch
http://mke3.net/blender/devel/rendering/ibl03.txt

some recent example pics:

quick tests I did with home-made HDRI light probes + AAO/bent normals
http://mke3.net/blender/devel/rendering/diffuse_sh/annst.jpg
http://mke3.net/blender/devel/rendering/diffuse_sh/ibl_approxao.jpg
http://mke3.net/blender/devel/rendering/diffuse_sh/ibl_approxbent_studio.jpg

qmc ray ao/bent normals
http://mke3.net/blender/devel/rendering/diffuse_sh/ibl_qmc_bentnor.jpg

Updated the patch for post-2.46 SVN. Find it attached!

Fixed up that 06 patch, it didn't have ibl.c in it, and also had my cmakelists.txt. oops.

For me it seems all very cool stuff. Nice for Brecht to take a look at too.

I tried this patch and it works great.
I had to resolve a few conflicts in DNA_world_types.h by hand, though.
The results are beautiful!

Bastien Montagne (mont29) closed this task as Archived.Aug 10 2014, 1:19 PM
Bastien Montagne (mont29) claimed this task.

Time to archive.