Lighting

Published March 21, 2006
Advertisement
More fixes over the last few days. I really feel almost done with the graphics, but then something doesn't look right, and I find out things are quite broken, and have to go in and fix them.

The main thing I fixed this weekend was the entity lighting, which was, how shall we say - completely broken. The diffuse terms were working, which is the largest part of the lighting, but the specular was totally off, and the entity lighting was not consistent with the terrain & static geometry lighting. Also, entity ambient lighting was always 0.2, 0.2, 0.2, and now properly uses the values set by the level designer.

I had a bear of a time remembering how to transform the eye vector into tangent space of a skinned model, even though I believe I was the first to propose the solution to this ( skinning the basis vectors and then going through this modified matrix ) in mid-to-late 2000. I forgot that the tangent space matrix is defined to go from model->tangent space, so you must go world->model->tangent if dealing with an instanced object or animated mesh.

Since the per-pixel lighting on the models was recent, I hadn't taken this into account properly with the specular. When I tried to make the android shiny, it didn't work. A bit of investigation revealed that nothing was shiny anymore.

I also fixed the weapon lighting, which was previously tied to the holding character's lighting in a way that caused even shadow receiving characters ( like your player model ) to darken & brighten overall. Now the weapons use the character's center position as the place to check their lighting from, but store their own light values.

Another fix involved the customizable entity facets not being loaded properly.

I added a rim lighting option to entities. This calculates a 1-n.e term during the ambient pass, so it increases a character's ambient on the edges of the character to give a softer look on clothes, etc. It's pretty subtle on the main char, but looks good on the cultist.



Today I fixed something with the shadow & occlusion ray caster that was driving me crazy for a long time. I finally fixed it b/c the new cave level made the problem incredibly apparent. Basically, when casting a shadow ray towards a light from a piece of geometry, it's possible you will hit the same geometry chunk you are casting from, so you need to somehow offset from the spot, or ignore close hits. If you ignore close hits, or simply offset in the normal direction, you will get a nice bright spot in sharp corners, where you don't hit the triangle 90 degrees from you b/c it's too close to where you started.



One solution I put in today is to make a version of your static geometry with completely shared normals ( even previously sharp edges ). Once you have this, you can offset the raycast start location in this shared normal direction. This way you will push yourself out of corners before casting the ray, allowing the ray to legimiately hit the nearby corners if it should.


Previous Entry Lighting
Next Entry Visual vs Physical
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

1.2 Almost ready...

1118 views

Sound Paths

1335 views

Stately Progress

1137 views

State Lines

1287 views

Pulsing

871 views

Return to The Ship!

1011 views

Cameras & Boxes

1128 views
Advertisement