Open Jaklyy opened 5 months ago
messing with a test rom reveals that there's definitely still something ever so slightly off in the color calcs but it seems to overall be much closer to hardware
Emissive and Ambient lighting are pixel perfect. Diffuse light should be pixel perfect (minus overflow behavior) Specular still needs work.
Updated Lugia:
Edit: This pr improves the algorithm for diffuse lighting to be (near?) perfect, thanks to discoveries by asuza. This also changes the way fractional color precision is handled to be maintained until all lights are calculated.
Previous text: Fixes https://github.com/melonDS-emu/melonDS/issues/1966 Results in lighting being noticeably brighter when multiple lights are enabled. Colors seem to match hardware better. Doesn't appear to be perfect, though it's possible those imperfections are due to inaccurate interpolation rather than problems with the lighting calc itself. Definitely needs some test rom verification, though.
Before:
After:
HW Capture (frame dump "reconstructed full color" screenshot):
![image](https://github.com/melonDS-emu/melonDS/assets/102590697/a3d1c1a4-f549-4f46-a31a-5e0b8f89d540)