Thursday, December 3, 2009

Warm and Cool Lights

I decided that I needed to step back and review how my code was organized and make a bit of a clean start. Things were getting pretty messy and for reasons I don't understand, when I'm writing shaders, I don't feel like I can use subroutines.

Which is totally stupid.

So, I went through my notes and implemented a bunch of the equations that Joe discussed in class for light return and light attenuation through a material and reflection (the cosine term). I ended up with the following image:

There are two lights in the scene: a warm light directly behind the model and a cool light in front of the model.

The final color has three components: the reflected light, light that shines through the model, and light that penetrates into the model and is returned.

All of the light is added together and tone mapped, so the lighting is not constrained to the (0,1) range when calculated the final color until the tone mapping operation.

Let's look at the three components separately:




Shinethru and reflected look ok, but returned looks terrible. Maybe I've picked bad coefficients of scattering, poor optical depth, etc. Regardless, it isn't what I expected. Plus, energy is not being conserved, so the composite image definitely isn't correct, but I think that this is a start to some nice shading with translucency.

1 comment:

  1. This information is meaningful and magnificent which you have shared here. I am amazed by the way you have explained things in this article. I am impressed by the details that you have shared in this post and It reveals how nicely you understand this subject. I would like to thanks for sharing this article here. Find LED Neon Signage.