What happened to PointLight.Range and PointLight.Fallof?

Aug 24, 2008 at 2:07 AM
Hi Bruce :)

In the latest revision, PointLight's Range and Fallof(f?) properties are missing. Could you let me know what happened to them? :)

Thank you :D
Aug 29, 2008 at 12:13 AM
Hi Brian,

It's Bruno! =P
Well... Actually I need to remove these variables and the fallof code to make the effect simpler and be able to compile it using Shader Model 2.0. It was necessary because many people reported problems running it on ATI cards.
Aug 29, 2008 at 7:38 AM
Oops! I meant Bruno! I really did! :)

The thing is that if you remove those variables, we won't have the fine control we need over the point lights. A point light without range or falloff value is pretty useless. Plus, since you don't have directional lights, I use point lights to "emulate" the directional lights by setting Range to 100000 along with a bit of other trickery.

So I think you should keep these variables in. Maybe there's a better way to solve that ATI issue than to cut this essential functionality?
Aug 31, 2008 at 11:06 PM
Edited Aug 31, 2008 at 11:10 PM
Hi Bryan,

The idea of the SkinnedModelBasicEffect was really to provide a basic effect for the users. The old effect provided more control over the point lights with range and falloff parameters but it required much more shader instructions and does not work in videos cards that supports shader model up to 2.0. To fix this I reduces the effect size, allowing anyone that could run XNA to be able to run XNAnimation as well. And to reduce the effect size, I removed the range and falloff parameters.

Anyway, you can found the old effect on the XNAnimation repository but it will not work on old video cards. And you don't need these parameters to emulate a directional light.
Sep 1, 2008 at 8:58 PM
Hi Bruno!

You have a class called PointLight. It is missing the properties Falloff and Range because you removed them. Thus, PointLight does not represent a point light any longer. It now represents a _broken_class_.

The C# code is now broken. Breaking the C# code does not save on instruction count in the shader.

If you wish to forgo implementing falloff and range in the shader in order to save on the instruction count, just dummy that functionality out in the default .fx file. You can do that while perfectly preserving the behavior in the C# code.

If you do it that way, then I can provide my own custom .fx easily and it will *just work*. Otherwise, I have to revert changes to the C# code as well - which should be totally unnecessary.

IMO, you should do one of the following -
1) restore the properties in the PointLight class.
2) delete the PointLight class.
3) rename the PointLight class to DirectionalLight and make it work like one.

Thank you!
Sep 1, 2008 at 11:54 PM
Hi Bryan,

I removed the fallof and range properties because these parameters where removed from the shader as well. People will think that something is broken if they could modify these properties but nothing happens in their application (like a dummy behavior). Keep in mind that there are a lot of parameters that you need to simulate a real point light, and point light does not even exists in real world.

I can change the point light for a directional light and it is probably the right way to do that but I will only able to change it in a further update. Can you add this item in the issue tracker, please? Thanks!
Sep 14, 2008 at 7:48 AM
Hello Bruno!

It turns out that this issue is incorrect. I now understand how the current implementation can represent a point light WITHOUT having a range and a falloff. It is a point light by the fact that it has a static position in 3D space :) It is different from a directional light in that a directional light has a normal instead of a position.

Now, since a directional light is more generally useful than a point light (in my mind, anyhow), it might still be good to provide a directional light instead of a point light.

But ya, sorry for the misunderstanding on my part. Your code wasn't broken; my understanding of the issue was :)