Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    235
  • comments
    509
  • views
    172387

Lighting

Sign in to follow this  
SimmerD

91 views

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.


Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!