[Bf-cycles] Lightprobe importance sampling

Brecht Van Lommel brechtvanlommel at pandora.be
Sat Dec 31 16:26:18 CET 2011


Hi,

On Fri, Dec 30, 2011 at 9:43 PM, Mike Farnsworth
<mike.farnsworth at gmail.com> wrote:
> I got a new light type up and going (I had to hack it into
> BlenderSync::sync_objects() for now so it would happen after the light
> map gets cleared, although I'll find a more explicit/suitable way to
> sync the environment light before I post a patch), and have it doing
> generic infinite-area light sampling, and just using the
> light_distribution texture's vanilla importance.
>
> Adding the additional importance information to light_distribution
> seems...not like a good place, though, so I'm experimenting with
> putting out a new texture or two (one with the marginal and one with
> the conditional CDF values).

I'm not familiar with the terms marginal/conditional CDF, but my
impression was that this method used a CDF as already in
light_distribution for mesh lights and regular lights? My original
idea was to stuff all light sources in one big CDF and always sample
that, but maybe it's not possible.

> I'm running into some difficulty in
> extracting the environment texture from the shader graph, though.  I
> have the dichotomy of a background shader graph, and an infinite-area
> light shader graph, and I need to make the two agree, and have the env
> light CDF texture get built based on that.
>
> I was hoping I could actually suck values at a fixed resolution out of
> an arbitrary background shader graph, so that it doesn't matter if you
> are using an image, the sky shader, or anything else; it'll importance
> sample them all.  How do I query the shader graph at arbitrary color
> results from vector directions or UVs?

Sampling the background with at a fixed resolution should be fine yes.
Ray differentials aren't used properly by all textures yet, but once
that is added it should work quite well for shaders that are higher
frequency than this resolution too.

I've refactored the code a bit now in svn to shader evaluation for
this possible, is a bit tricky with kernel/device changes. Attached a
patch that will dump the background to an image as an example.

Brecht.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cycles_dump_background.patch
Type: application/octet-stream
Size: 2719 bytes
Desc: not available
Url : http://lists.blender.org/pipermail/bf-cycles/attachments/20111231/e183c32b/attachment.obj 


More information about the Bf-cycles mailing list