Page MenuHome

Cycles: Improved sampling for sphere lights.
Needs ReviewPublic

Authored by Stefan Werner (swerner) on Apr 12 2019, 4:08 PM.
Tags
Tokens
"Love" token, awarded by lordodin."Love" token, awarded by cerebral_malfunction."Love" token, awarded by juang3d."Love" token, awarded by bnzs.

Details

Summary

It is now sampling point/sphere/spot lights with regard to its solid angle, as opposed to
the previous disk approximation. This yields similar results to an emissive mesh sphere.

Following the example of our rectangular area lights, this is a one-sided emitter.

The code is based on/copied from the PBR book:
http://www.pbr-book.org/3ed-2018/Light_Transport_I_Surface_Reflection/Sampling_Light_Sources.html#x2-SamplingSpheres

Diff Detail

Repository
rB Blender
Branch
cycles_sphere_sampling
Build Status
Buildable 3317
Build 3317: arc lint + arc unit

Event Timeline

There is a slight performance hit from the more complex sampling.
Haven't done extensive benchmarking, but a test scene I measured went from 58s -> 59s CPU render time.

I have an alternative implementation where it switches to disk sampling when the light is small/far away, unfortunately that results in an abrupt shift in brightness.

If desired, I can also change it to make the sphere a double-sided emitter by switching to uniform sampling when the shading point is inside the sphere (this is what PBRT does).

If desired, I can also change it to make the sphere a double-sided emitter by switching to uniform sampling when the shading point is inside the sphere (this is what PBRT does).

Think double-sided emitter is more natural for artists. Also think mesh lights are doublesided?

Some other random points:

  • Is it just me, or the result is somewhat more noisy? What is the expected outcome noise-wise?
  • The performance impact doesn't seem to be too bad to me.
  • On a code topic: would encourage using more const qualifiers, but guess can also happen later if someone feels strong.
intern/cycles/kernel/kernel_light.h
164

Am i missing something, or cases when it is not finite are handled by the conditions above and in uniform_cone_pdf ?

Think double-sided emitter is more natural for artists. Also think mesh lights are doublesided?

Mesh lights are, area lights are not. I can take a look at other renderers (Arnold, RenderMan, ...) to see what they do.

Some other random points:

  • Is it just me, or the result is somewhat more noisy? What is the expected outcome noise-wise?

Less noise for surface illumination. With regards to volumes, I suspect we have a problem when we try to combine equiangular sampling and solid angle sampling, but that's a different topic (and hopefully a patch).
I added the volume to this scene to make the shape of the light more visible, it's hard to tell otherwise.

  • On a code topic: would encourage using more const qualifiers, but guess can also happen later if someone feels strong.

I'm with you there. I'll be more than happy to sprinkle this code with const.

Both RenderMan and Arnold have sphere lights that emit to the outside only.
RenderMan render:

  • Cycles: Added const to some variables.
Harbormaster completed remote builds in B3329: Diff 14734.