I have a problem with point lights in my scene. It’s mostly under ground, and has around 50 lights. After some experimenting, I found Point lights look and work best for overhead lights in this instance, as they are supposed to be bulbs, not spots.
Now, on to the problem at hand. I seems can add(duplicate) up to 7 lights in a row, but when i add the 8th light, one of the previous lights dims or goes out entirely. I have tried duplicating 7, and adding the next one fresh, but the same thing happens, once I hit #8, poof! It could be 10, as I have 2 more lights at the start tunnel that stay on fine. They are in their own game object folder, and they are only 2 models. I split the light models down to 3 sections, 2 in one, and about 20 - 25 in each of the other two. I may have to break up the lights into smaller 'packages" similar to what rFactor needs, but I’d rather not if I can avoid it. It will be a long drawn out process to do that at this point in the tracks development, but not impossible if need be.
Not sure if this is a limitation to the free version, a bug, or a video card problem.
Any advice? Thanks.
Sounds like you are using vertex lights and not point lights. With a hardware light there’s a fixed limit on the number of lights that can affect any particular mesh.
If you really want 50 lights in your scene, you will have to break up the geometry and use layers to ensure that only 8 lights affect any particular mesh.
Bake your lights into lightmaps.
with pixel lights the quality settings define how many can affect a mesh.
I think the default for that is really low even on the highest setting. 3-4. I’d love to see the draw calls if he changes that to 50!
Boy, that was fast. ![]()
Thanks for the advice.
I did try using pixel and vertex lights instead of auto, but the fps hit was atrocious. As far as baking to lightmaps, I’m not sure how to do that, but I’ll look into it. My understanding is lightmaps will only affect unity generated terrain, which I’m not using. The map is modeled in Max. I’m also looking at lighting the interior in Max the importing again. I’d hate to have to break the model up into a gazillion separate parts, but if I have no choice… :roll:
lightmaps are normally generated in an external tool (like the modeler or Gile or PureLight)
Unity 2.x doesn’t support lightmap generation
Lightmaps are generated in Max. You use Max lights and bake the illumination information into a texture. You use that in a lightmap shader and it’ll look just like your max scene but with no extra draw calls.
You can then throw a few pixel lights around that are more dynamic. A rotating light, light hanging from a wire moving about, a flashlight on the end of your gun, etc.
There’s a slew of tutorials detailing on how to do it, but can’t point you to any ones for Max. I’ve only seen the ones for Modo.
http://www.geartechgames.com/GearTech_Games/Beginning_a_Project/Beginning_a_Project.html
http://www.fearedfuturegames.com/tutorials/tutorials.htm
I would also suggest watching the following video from Unite. It’s on performance optimization and includes information on lights that sounds right up your alley. They use a test scene with like 100 lights!
http://unity3d.com/support/resources/unite-presentations/performance-optimization
There’s tons of awesome information in the video. However I’ll have to warn you ahead of time. I wanted to pull my hair out listening to the guy swallow every other second with the throat mic that sounded like it was on his adam’s apple.
My advice is to split up your map into different meshes so you won’t have to redraw the whole level with each light, even if this light is hundred of meters far…
Me again. I tried a couple of things to fix the problem, and found GODLIKE’s advice works best. I did find that the maximum lights I can use is 6. When I have 8 lights in a section, 2 will dim or shut off as I add more to another section. I had to break the model up into 9 sections, as well as the light models, and parented the lights to each section. Ie:
Section04
Lights04
Pointlight4/1
Pointlight4/2
“”
“”
Pointlight4/5
and on down the line. There are 45 lights in the whole model.
Oh, this is for a racing game, so I put headlights on the car (from the latest car tut, very nice.) and they work fine. Just a bit of flicker on the walls.
Now on to a couple of other questions.
1: AS a good portion of the track is under ground, how can I make the tunnel sections pitch black dark when unlit? If I shut off the directional light, (sun) that works, however, then the whole track is dark, not good in the open sections. The tunnels are covered with a “grass” model, as well as being covered internally. I have both the track and grass set to cast shadows, but as I’m using the free version, I don’t think that will work. If it works in the full version, that’s fine, as long as I know when I send the model off to my lead dev, he can add shadows that will make it dark, if the lights are out, even in the daytime.
2: As I stated, the track is covered over with a “grass” plane, but there are open shafts(holes) that lead down to the underground sections of track. I have found that the “sun” does not penetrate these shafts, even if I use a higher intensity, and distance and set the direction to approximately noon.
I’m still debating if this could be a limitation of the vid card, or something I missed. Again, if it’s a limitation of the free version, my lead can fix that later, and I won’t worry about it.