HI all,
I've currently got to problems with dynamic lights and am hoping for some insight as to what might be happening:
1) I have several dynamic lights that toggle on/off with a button. When I press the button, one (and sometimes more than one) light will not turn off. This light will always be the same each time I load the application. I then go into the editor, remove the light, and set up a new light to replace it. I then wire this to the same switch. This light now works but a different one of the set of lights now does not turn on/off even thought the code and the mesh name hasn't changed. Any ideas what might be happening?
2) Again, code that is turning lights on/off. This time, a completely different vehicle is being affected by code that never relates to it at all. When I turn a light on, or change a light's intensity, it then makes the other light become dimmer. Any thoughts here?
Thanks so much in advance,
Scott
What version and edition of SunBurn are you using?
If Pro version 2.0, could you tell us if you are using Deferred or Forward rendering?
Thanks
Philippe
Are you using components for this?
Are you sure that you are correctly bounds testing your loops when turning off all of the lights?
Hi Philippe,
We just recently upgraded to 2.0.18.7. Here are more details concerning the question regarding lights not turning off...
For the class where I am changing lights, these are the only references.
.
I believe our default is forward rendering and we made a global reference for it:
The button then makes a call to a static class to each group of lights to either enable/or disable. The class being called is static.
This static class then, very simply create a reference to the light and either enable or disable it. Below is an excerpt from the DisableMastLightsMethod():
Thanks in advance for any help!
Hi guys.
1) I'm probably barking up the wrong tree / stating the obvious but could you check that the light's UpdateType is set to Automatic (or Receives Updates in the editor).
2) As for one light dimming when another gets brighter... are you using a bloom effect at all? I'm just wondering if that could affect it in the way described????
I'm probably completely wrong but thought it was worth throwing in a couple of ideas anyway.
Hi,
Thanks for your input. The lights are set to receive updates.
Also, every time I remove the light that is not behaving correctly and then insert a new one, a different light then decides to become the one that simply dims whereas it was working fine before. This dimming effect is the same as the problem I am having in part two of my original question above. No blooming effects.
Sorry that didn't help much.
How many lights are there in the scene in total?
And secondly... what is the lightManager.Light() method? It's not something that is in the standard LightManager. Are you using a custom LightManager?
I'm not totally sure but if you are using Forward renderer, this might be the reason why you get the issue.
Forward rendering is a rendering pipeline that is very efficient if you have a low number of lights in a game because it uses directly GPU hardware lighting capabilities which is usually limited to 8 concurrent lights. SunBurn simply sends all the current scene lights to the gpu (except potentially spotlights and pointlights which may be culled depending on the camera view frutum) and let it handle light information passing to the shaders.If you therefore have more than 8 lights in a scene, there could be random behavior with your lighting in certain situations.
To prove it, simply try to see if you meet the same issue if you simply place a scene with less than 8 lights total (including ambient lighting).
If you have SunBurn Pro, you can safely fix that issue changing your pre processor commands in your game project Build properties adding DEFERRED to the pre processor directives.
Thanks, Philippe!
I think one of our other programmers is working on changing the pre processor commands as we speak to DEFERRED. The lights being affected are spotlights.
I will keep you posted.
I reduced the total number of lights running for now until we get the DEFERRED rendering all wired up. This fixed both the light on/off problem and the light intensity issues.
Thanks so much for your help!
I'm glad it helped :)
Just one little addition. Deferred is a SunBurn Pro edition feature and doesn't work on WP7 so if you're planning for a WP7 release you'll have to find some tricks like using Lightmapping :)
No WP7 release. This project is with ForgeFX for a Windows application. And the light mapping is still awesome stuff!!