Thursday, January 31, 2013

Graphics Write-Up #3

This week was considerably easier than the past weeks.  There were a few stumbling points however.  This was the largest one:


{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
{ 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 },
{ 0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
{ 0, 32, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 },


In the end, COLOR had to be moved to the end since I wasn't sure how large it was and thus how much to offset the next data by.  (In retrospect, calling sizeof on the type would have worked too).  The light itself was working after implementing it like the camera, although it felt like it wasn't actually moving.  Changing the increments from 1 to 10 helped improve that though, which makes sense since the light needs to change a lot for it to have a noticeable impact.

The only other stumbling block was setting up the UVs.  I initially did it with 0,0 at the bottom left and it looked horrible and you couldn't tell what the texture was supposed to be.  I messed around with the UVs for a while trying to figure out what was going on, but then Shrly explained that in DirectX the origin is actually the upper left.

Another slightly odd issue was attempting to call a variable in the FragmentShader texture.  For some reason that just doesn't work.

I love that the light isn't actually lighting things up, but instead darkening things.  It's like an anti-light!

Camera is still on WASD and the Cube is on the arrow keys.
Light Controls:
I - Up
J - Left
K - Down
L - Right



P.S.  In case it isn't obvious from our almost identical write-ups, Jason and I worked together on this assignment (as with previous ones).

No comments:

Post a Comment