Okay, I'm stumped. Help me with my lighting code?

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
DarkMorford
DCEmu Newbie
DCEmu Newbie
Posts: 5
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Thu Jan 12, 2017 6:44 pm
Has thanked: 0
Been thanked: 0

Okay, I'm stumped. Help me with my lighting code?

Post by DarkMorford »

I'm trying to implement some basic Phong-style lighting on the DC, and it's kicking my butt. (It doesn't help that 3D graphics was always my worst class in college.) I've mocked up what I'm trying to achieve in OpenGL on my PC—the light source is directly behind the camera, so it's lighting up both faces of the cube evenly. Unfortunately, what I'm getting out on the Dreamcast looks like this. And here's a link to the code I'm running.

I've done some printf() debugging and I'm pretty sure the six normal vectors are getting transformed correctly, so I'm assuming either something else is getting wrongly transformed or there's an issue with my calculateDiffuseIntensity() function. Any thoughts?
Post Reply