2
$\begingroup$

I am attempting to recreate the Eevee point light within Cycles using nodes (using Drivers to get the light info). I have the basics working, but I cannot figure out how exactly the Radius and Power are used because the radius has some sort of attenuation/falloff, and the Power is in Watts by default and needs to be converted.

I have looked at the Source Code and have found the appropriate section in lights_lib.glsl. And they reference the pdf "Moving Frostbite to Physically Based Rendering", which is where the distance_attenuation and light_attenuation functions come from. Page 32 Listing 4 is the relevant section (they call the functions smoothDistanceAtt and getDistanceAtt). The link in the source is dead, but this is the pdf.

I have recreated the distance_attenuation and light_attenuation in Cycles nodes, but I cannot figure out what the inv_sqr_influence input is (aka, ld.l_influence.) From what I can find googling around, there is some sort of function being done that involves the inverse square of the Radius, but I cannot figure out what. Additionally, there is something being done with the Power before multiplying it with the light's Color (which is then multiplied by the shading and attenuation.)

I believe pages 30-32 of the PDF are talking about these things, but they do not give a code example, and I do not understand how to read the formulas. I've tried to find more in Blender's source code, but I've had no luck there either. I cannot find where the Power/Strength of the light is applied.

My current node setup does mostly work, it just does not match the same behavior in Eevee. I believe it is because Power/Strength is in Watts and needs to be converted to Lumens or something. And the Radius inverse square part is supposed to have some more going on. enter image description here

If anyone can tell me what the math is, or point me towards a code snippet or the relevant part of the source code, please do!

$\endgroup$
2
  • $\begingroup$ This might help you understand how light typically behaves: en.wikipedia.org/wiki/Inverse-square_law $\endgroup$
    – quellenform
    Commented Oct 22, 2022 at 15:16
  • $\begingroup$ @quellenform thanks. I've found a lot of info like this about how light behaves. But what I need is to know exactly what's implemented in blender itself. And what I've learned from looking at the source code is that this is all tied into the diffuse shading too. So to get a match I need to recreate both the light and the diffuse behavior. I have most of that now, but I still don't have Power and Radius behaving correctly. There seems to be some conversion on Power going on other than what is in the obvious places in the code. $\endgroup$
    – Ascalon
    Commented Oct 23, 2022 at 20:10

0

You must log in to answer this question.