A quick question, is there a way to get the position in global space of the brightest point of a pointLight? Also, is there a way to get the radius in global space units, of the area of effect of a pointLight? I’m terribly sorry if this is a question with an obvious answer (say, by fiddling with the attenuation coefficients), but it doesn’t appear to have been explained that well by looking at the available documentation.
Well, that should just be the position of the PointLight object itself, as a PointLight is brightest at its centre, I believe.
This is tricky: after all, what is the “area of effect” of a PointLight?
That is, I believe that a PointLight technically has no bounds on its effect–its illumination extends off to ostensible-infinity. The only question is that of at what threshold of light you consider it to be “attenuated enough” to be deemed “no longer effective”.
Once you know that value, you should be able to calculate the relevant distance from the light-attenuation equation. (Which should be available somewhere online; I presume that our equation is just the standard one.)
In my scene, the source of the light isn’t at the centre, it appears to come from the periphery and is being cast forward. I’m not sure why this is. Is there a way to get and change the point from which the light is being cast?
Just to add: it seems that the point from which the light is cast changes as the pointLight moves. In my scene, the nodepath connected to the pointLight follows the player around and I notice that it seems the origin of the light changes with the position of the pointLight itself. This is how I move the nodepath connected to the pointLight around:
I updated my response, please take a look at it if it’s not too much to ask. I noticed that the position of the pointLight seems to modify the point from which it is cast. I am not using a custom shader or anything fancy at all.
No: The light is always cast from the centre-point, but the entire light can be moved.
Let me illustrate: Here’s a modification of the scene in the screenshot that I posted above, in which I now move the light via a call to “setX”:
Note that the “pole”, which is again attached to the light via “reparentTo”, remains at the centre as the light is moved; the light always emanates from the location of its NodePath.
You know, looking again at your screenshot, I note that the landscape falls away into the distance. I’m wondering whether it’s not just the effect of that drop in elevation that we’re seeing:
After all, the higher the landscape, the closer its surface is to the light, and thus the smaller will be the circle of light cast on it. (As a result of the angle between surface and incoming light more-quickly becoming obtuse.) Conversely, as the landscape becomes lower relative to the light’s position, the larger will be the circle of light cast on it.
That is, on a landscape that falls away as does this one, the parts of the landscape “uphill” from the light will have a smaller circle of light, and the parts “downhill” from it will have a circle of light larger the lower they are. Thus there will be more light “downhill”, and so we will see what appears to be an offset in the light’s position–even though the illumination is actually still emanating from the centre of the light.
So, what happens if you make your landscape flat? Do you see the same apparent offset?
Maybe something else is causing this (could it be the normals?), that I’d have to look more into. It’s not that big a deal anyways, it’d just be more convenient if I always knew where the centre of the pointLight was. I’ll look into it more later, thank you so much for your insights.