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.

Differential D3540

Cycles: Save a few instructions in area light sampling

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

Details

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

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. |

intern/cycles/kernel/kernel_light.h | ||
---|---|---|

79–82 | Nit-picking: space around operator. Same in |

intern/cycles/kernel/kernel_light.h | ||
---|---|---|

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