Post news RSS Diary 1: Lighting

First diary entry about switching lighting models in Unity3D.

Posted by on

Diary 1: Lighting

Lighting Comparison 1

I've spend the last few days experimenting with different rendering methods in unity.

Mostly it came down to either using the built in baked lighting in Unity3D or having a completely dynamic system. I ended up going with the dynamic system for a number of reasons.

First. It reduces the size a bit. I have one level now, but at low quality the light map for each level weighs in at around 5megs. 15 levels = 75 megs and that would be a lot of space just for light maps.

Second. It prohibits custom maps. User created maps, or mods that change the layout of levels would not be possible as the light maps can't be generated at runtime (at least not yet)

Third. It doesn’t work with dynamic objects such as doors. Unity does have real-time GI lighting effects but dynamic objects cannot effect the flow of light. That is, dynamic objects can be lit by the lighting model, but cannot effect the model itself. In practise what this means is that opening a door won’t allow light to flow out into the corridor, and that is a real problem.

In the end I just went with a more standard model. There are two options in terms of lighting quality “high quality” and “normal”. High quality uses per pixel lighting on all lights, and has shadows. “Normal” quality skips the shadows and does per pixel lighting on just the main light. This seems to be a good compromise and I get 100+ fps on intel integrated graphics.

Another big performance boost was the introduction of a new culling system. I ended up dropping the unity one and building my own based on an A-Star algorithm. It’s a bit crude, but does the trick and doubled the FPS on my dev computer.

I also added support for map switching (there are stairs / trap doors you can take now) and balanced out the races a bit.

Ok, that’s all for me for today.

As always latest version can be previewed in the browser here

And check the downloads for a windows build.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.