Page 1 of 1

power edition bug

Posted: Sun Nov 12, 2023 2:28 pm
by Ian
The lasers come out the wrong colour

h/w
Image

supermodel
Image

I know roughly what the issue is. The lasers have lighting applied, and the backfaces apply negative lighting. Basically the lighting is not clamped so goes negative. Other parts of the game rely on this behavior, just it looks wrong here.

The lighting clamp comes from jtag, so maybe our jtag needs some work at some point in the future.

Re: power edition bug

Posted: Sun Nov 12, 2023 7:32 pm
by Bart
Are you saying that the JTAG clamp isn't being set? We no longer have any patches applied to Daytona 2. It's possible our JTAG implementation is not seeing the write because of how we implement it as a giant unified register instead of properly daisy chaining the ASICs.

Re: power edition bug

Posted: Sun Nov 12, 2023 7:51 pm
by Ian
I am not sure, I haven't dug that deep into it
just mostly noting the bug is here so we can look at it in the future :)
But yeah I suspect maybe jtag isn't working quite right

Re: power edition bug

Posted: Wed Dec 06, 2023 5:11 pm
by gm_matthew
It's not a JTAG issue as the game never performs JTAG writes during a race. More likely there must be some exception to sun clamping being disabled... the lasers are translucent so maybe sun clamping still occurs for translucent polygons?

Changing the line:

Code: Select all

if(sunClamp) {
to:

Code: Select all

if(sunClamp || finalData.a < 1.0) {
in the quad and triangle fragment shaders makes the lasers look like they should, but I'm not yet sure that it wouldn't make something else in this game (or perhaps in L.A. Machineguns) look wrong.

Re: power edition bug

Posted: Thu Dec 07, 2023 1:25 pm
by Ian
It could well be as something as simple as that. Other possibility is some kind of bit in the polygon header but I think that is less likely since we never found any sun clamping bits before.

Re: power edition bug

Posted: Thu Dec 07, 2023 6:29 pm
by Bart
Are there still any polygon header bits whose function is unclear? I recently rehabilitated the polygon header debug tool.

Re: power edition bug

Posted: Fri Dec 08, 2023 11:23 pm
by Ian
Maybe the translator map. I think it's just daytona that uses it, but I'm pretty sure it's just related to texturing.

If I remember correctly the 2 daytona versions use a different light clamp model. Power edition is unclamped. I'm pretty sure I did a binary diff between the wheel models on the cars between the 2 versions and found they were identical. That's when we started looking at jtag to find where it could be set.

But it's quite likely Matthew's suggestion is right. Worth just trying to see if it breaks anything:)

Re: power edition bug

Posted: Sat Dec 09, 2023 9:33 pm
by Bart
I wonder if it's worth whipping up some sort of regression test script that loads a bunch of states and snapshots the frame buffer. Not sure how to do a reliable quantitative comparison between the two that isn't overly sensitive to small differences (including differences between GPUs). I think the game industry does this and there must be some papers on the subject.

Re: power edition bug

Posted: Wed Dec 13, 2023 9:11 pm
by Ian
If it is just transparency that uses the clamped model it would just be polygon transparency. Poly transparency has 1 extra bit so instead of 0-31 (5 bits) it uses 6 bits where the top bit is basically an enable bit. The range in this case is just 0-32.

I think there is a good chance these might use the clamped model. Failing that always worth checking the viewport data to see if there are any difference between the viewport with the lasers and that of the cars which we know use an unclamped model.

Re: power edition bug

Posted: Mon Dec 25, 2023 4:28 pm
by Masked Ninja
I see that in the latest revision (Git revision 33b84c8 "2023-12-22"), this has been fixed.
Thank you so much....... :D