Page MenuHome

Cycles: Save a few instructions in area light sampling
ClosedPublic

Authored by Lukas Stockner (lukasstockner97) on Jul 13 2018, 4:00 AM.

Details

Summary

Just basic algebra - because all vectors have the same z coordinate, a lot of terms end up cancelling out.

Not exactly a massive improvement, but it's measurable with Branched PT and a high sample count on the lamp.

Diff Detail

Repository
rB Blender

Event Timeline

intern/cycles/kernel/kernel_light.h
78

sqrt() promotes this calculation from float to double. Is that intentional? If not, sqrtf() should be faster I think.

Looks good to me. The test renders I did didn't show any differences.

Looks good, but change sqrt() to sqrtf() as suggested.

This revision is now accepted and ready to land.Jul 14 2018, 12:54 PM
intern/cycles/kernel/kernel_light.h
79–82

Nit-picking: space around operator. Same in nz calculation.

Lukas Stockner (lukasstockner97) added inline comments.
intern/cycles/kernel/kernel_light.h
78

nz and diff are float4, so this uses the overloaded sqrt() in util_math_float4.h.

This revision was automatically updated to reflect the committed changes.