power edition bug

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome. Not for end-user support.
Forum rules
Keep it classy!
  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!
Post Reply
Ian
Posts: 26
Joined: Wed Nov 08, 2023 10:26 am

power edition bug

Post 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.
Bart
Site Admin
Posts: 87
Joined: Tue Nov 07, 2023 5:50 am

Re: power edition bug

Post 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.
Ian
Posts: 26
Joined: Wed Nov 08, 2023 10:26 am

Re: power edition bug

Post 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
gm_matthew
Posts: 15
Joined: Wed Nov 08, 2023 2:10 am

Re: power edition bug

Post 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.
Ian
Posts: 26
Joined: Wed Nov 08, 2023 10:26 am

Re: power edition bug

Post 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.
Bart
Site Admin
Posts: 87
Joined: Tue Nov 07, 2023 5:50 am

Re: power edition bug

Post by Bart »

Are there still any polygon header bits whose function is unclear? I recently rehabilitated the polygon header debug tool.
Ian
Posts: 26
Joined: Wed Nov 08, 2023 10:26 am

Re: power edition bug

Post 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:)
Bart
Site Admin
Posts: 87
Joined: Tue Nov 07, 2023 5:50 am

Re: power edition bug

Post 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.
Ian
Posts: 26
Joined: Wed Nov 08, 2023 10:26 am

Re: power edition bug

Post 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.
User avatar
Masked Ninja
Posts: 9
Joined: Sat Nov 11, 2023 9:48 pm

Re: power edition bug

Post 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
Post Reply