Parametric Geometry coordinates for point and area lights in Cycles
Needs ReviewPublic

Authored by Stefan Werner (swerner) on May 15 2016, 9:16 PM.

Details

Summary

This patch adds texture coordinates to point and area lights in Cycles. Using the Geometry Node/Parametric output, one can now apply procedural and image textures in planar mapping to area lights and in spherical coordinates to point lights.

Diff Detail

Repository
rB Blender
Stefan Werner (swerner) retitled this revision from to Parametric Geometry coordinates for point and area lights in Cycles.May 15 2016, 9:16 PM
Stefan Werner (swerner) updated this object.
Stefan Werner (swerner) set the repository for this revision to rB Blender.

Here is a before/after comparison with an area light:


The same shader on a point light:

Area light seems fine, point one has some questions..

intern/cycles/kernel/kernel_light.h
590

Not sure why we need texture coordinate at sample(). And even if we really need it, why it's only done for the point light?

intern/cycles/util/util_math.h
1499

ray_quad_intersect() was only used in a single place. Perhaps we can simply add u and v coordinates there as a return value and avoid having to practically identical functions one of which is not used?

This updated patch removes the now unused ray_quad_intersect() and ray_triangle_intersect().

Sergey Sharybin (sergey) requested changes to this revision.Jul 14 2016, 3:33 PM

Went out of my radars :(

Still very interesting feature. Do you mind updating it against latest master?

Other than that after closer look seems to be fine.

This revision now requires changes to proceed.Jul 14 2016, 3:33 PM

Here's an updated patch.

intern/cycles/kernel/kernel_light.h
590

Texture coordinates in sample are necessary for MIS. You are right though, it's missing for area lights - I thought randu and randv were sufficient, but we need to calculate it from the intersection point - see below.

intern/cycles/util/util_math.h
1499

Sure, we can remove it then and have one function do both.