Closed PiKeyAr closed 7 years ago
It occurred to me why my last implementation didn't work, so I'll put it here before I forget:
I was only switching the specular palette used when the common object textures were applied to the scene. However, since stage objects and common objects typically don't change the light type, it would carry over from the last object rendered, causing inconsistent specular palette selection. Although I'd like to avoid it since it happens so frequently, the simple solution would be to hook njSetTexture and check the NJS_TEXLIST pointer against the common object texlist.
The correct palette is now being selected. Brightness index calculation on the other hand is still not quite right. The skulls are definitely still considerably less red than on the Dreamcast.
I believe this is because on the Dreamcast, stage-specific objects will use the stage's specular palette (PLEdit index 2) and only common objects use the second specular palette (PLEdit index 4). Currently in my implementation, all objects use the second specular palette, and the stage specular is reserved for the stage itself. This is incorrect behavior in my implementation.
One possible solution to this is to only select the second specular palette when the common object textures have been applied, and otherwise default to stage specular. I've tested this to some degree, but it causes the specular palette to be applied inconsistently depending on what's visible. It's worth looking into further, though.