Tuesday, August 11, 2009

Lighting Tests

This is the initial lighting test using lights in Unity and keeping them set to Forced Vertex. It looks okay and the performance is good, except that after adding a few lights, they begin to cut out because all the geometry is being combined. After trying a few variations of layouts and light settings, I realize this is probably not going to work.

Here is the level combined and vertex welded in 3dsmax, and then vertex lit which, which not only processes way faster in max, but it also runs in the game without any lighting calculations so there are way less draw calls becuase there are no lights in the scene. The only down side is that the level isn't as easily modified after it is merged together, but by this point the level design should already be signed off on.

6 comments:

Danny Parks said...

Looking good. Are you doing any of the culling regions the unity folks mention in their new tutorial? It probably won't work on a single welded mesh, but it could let you keep things modular. Are you still able to achieve that darkening with the light fall-off on a single vertex lit mesh if it's large? I've used shadow maps, but not vertex lighting.

Kristopher Peterson said...

No, since the camera is facing downward, there will never be any background drawing of geometry that is not being seen so there's no reason to use it.

The optimization page mentions chunking the meshes into 1500 polys a piece, so I will probably just end up merging each room or hallway into separate pieces, and not have 1 giant mesh.

Yeah, you can still get falloff using vertex lighting. It can also be painted as well as calculated in 3dsmax so you can get it to do anything you want really, assuming you have enough vertices in your mesh. You can even get creative and fake cast shadows by using a 50% opacity mesh and vertex colors. You can further enhance that by extruding a border of vertices and use vertex alpha so you get a nice blended edge on your shadows.

Danny Parks said...

That makes complete sense, I hadn't stopped to think what/how the culling regions would actually cull.
Is that a debug menu in the first screen? I've been trying to find something that can display draw calls and frame rate for the iPhone. Any suggestions?

Kristopher Peterson said...

Yeah, is the stats display not in the iphone version? Still haven't gotten the iphone version but I know reading posts that there is access to a wealth of feedback. I'd check the forums.

Danny Parks said...

Stats Display? That'd be news to me. Did you roll your own, or is it part of Unity that I've been missing?
Converting over to iPhone is actually pretty easy aside from the input issues. The only real hang up I've had is that you tend to have to be more explicit about variable casting. All in all, it's pretty easy.

Kristopher Peterson said...

http://unity3d.com/support/documentation/Manual/RenderingStatistics.html