Monday, December 2, 2013

I Used To See Four Lights

So, what's going on today...

I decided to put some proper lighting code into the component system.  I've been using the same four hard-coded lights for quite some time, and it seemed like maybe now was the time to do something a little better.  :)

So, adding in a couple of light components.  First, the lights themselves, which are attached to a transform and can therefore be attached to other objects or otherwise moved around the scene.  And second, a collector, which can be attached to a model object and determine the influence of the lights in the scene on the object.

This is pretty basic, we'll see how well it works out.  Currently I'm just accumulating all of the lights into a single set of spherical harmonic coefficients for each object.  That might become performance-prohibitive eventually, though any sort of dynamic spatial partitioning probably won't be cheap either.

So, today was mostly spent brushing up on the math for all of that again... and then remembering that DirectX has a bunch of functions for this already... and then remembering that I already wrote code that was using them months ago.  I seriously need to defrag my brain or something.

No comments:

Post a Comment