[Bf-cycles] Environment/lightprobe importance sampling patch

Mike Farnsworth mike.farnsworth at gmail.com
Mon Jan 16 08:35:40 CET 2012


This patch includes a full implementation of importance sampling for
environments, including the MIS solution we talked about.  It adds two
items for the user to control: on/off switch for whether to treat the
environment as a light (off is old behavior), and a resolution control
for the importance map.  Here are a few notes about the patch:

* For environments that are a solid color (or very slowly changing),
turning on the env light machinery is overkill, and will actually
result in reduced performance.  For anything complex (textures, sky,
noise, etc) it produces noticeably less noise for the same number of
passes, so it should be a solid advantage.

* Any HDR environment textures are chopped down to SDR range by the
texture upload to device right now (nothing to do with my patch, of
course); this reduces the effectiveness of this new environment
sampling.  If we can fix that, the env light sampling will have an
even greater effect, not to mention potentially improved visuals in
general.  Just sayin'...

* The patch includes a change where the displacement device function
now outputs to a float4 buffer, not a float3 buffer, because on my
older GPU that was causing completely screwed up sampling of the
background when building the importance map.  So, displacement and
shader tasks now have a slightly larger output buffer, but it now
works on both my older GPU (GTX 260, sm_13) and my newer GPU (GTX 460,
sm_21).

* There is a commented #define that allows dumping the sampled
background and both parts of the importance map to /tmp for debugging
purposes.  Those sections of code can be removed, but they could come
in handy in the future.

I'm going to post some before/after images to morecycles.blogspot.com
tonight, so you can see the difference in quality.  I apologize for
this taking longer than I had anticipated.  I had left in a
__int_as_float(f) where I should have just had an (int)f instead, and
it manifested itself with a zero PDF for the environment light, just
causing noise.  It took a while to dig through it and find it.
Brecht, let me know if you have any issues with the code, and I'll try
to turn around any suggestions you make ASAP so this can be included
in 2.62.  I understand the deadline is the 22nd?

-Farny
-------------- next part --------------
A non-text attachment was scrubbed...
Name: env_mis.patch
Type: text/x-patch
Size: 34339 bytes
Desc: not available
Url : http://lists.blender.org/pipermail/bf-cycles/attachments/20120115/7a41a00b/attachment.bin 


More information about the Bf-cycles mailing list