4 bit texture bug

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
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!

4 bit texture bug

Postby Ian » Tue Apr 04, 2017 1:01 pm

This one was found by model123

Image
Image
Image

This is what the raw (decoded) texture looks like
Image

So it looks like are textures are perfectly inverted ....
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: 4 bit texture bug

Postby HarryTuttle » Tue Apr 04, 2017 1:13 pm

That's another case that made me mad since last year... the fix would be to invert the "c" value like in this code snippet:
Code: Select all
case 10:   // high byte, low nibble
  for (yi = y; yi < (y + height); yi++)
  {
    for (xi = x; xi < (x + width); xi++)
    {
      texel = src[yi * 2048 + xi] >> 8;
      c = (texel & 0xF) * 17;
      c = 255 - c; // Breaks ECA, Harley but fixes Daytona 2 decals
      scratch[i++] = c;
      scratch[i++] = c;
      scratch[i++] = c;
      scratch[i++] = c;
    }
  }
  break;

However breaks some textures in Harley (and others) like the big green street sign at the beginning of the demo... The thing is that alpha channel should always be inverted, but rgb values depends on something else... I'm preparing some screenshot I'll post here
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: 4 bit texture bug

Postby Ian » Tue Apr 04, 2017 1:16 pm

Code: Select all
   case 10:   // high byte, low nibble
      for (yi = y; yi < (y + height); yi++)
      {
         for (xi = x; xi < (x + width); xi++)
         {
            texel = src[yi * 2048 + xi] >> 8;
            c = 255 - ((texel & 0xF) * 17);
            scratch[i++] = c;
            scratch[i++] = c;
            scratch[i++] = c;
            scratch[i++] = (c == 0 ? 0 : 255);
         }
      }
      break;


The 4 bit textures use a special value 255 to indicate 1 bit transparency
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: 4 bit texture bug

Postby Ian » Tue Apr 04, 2017 1:21 pm

But yeah .. inverting the texture breaks the signs
There must be some flag in the poly header that inverts the texture

Image
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: 4 bit texture bug

Postby HarryTuttle » Tue Apr 04, 2017 1:29 pm

Good Daytona 2 decals:
du2_01.jpeg
du2_01.jpeg (242.64 KiB) Viewed 10086 times


Bad Harley:
hl_01.jpeg
hl_01.jpeg (241.19 KiB) Viewed 10086 times


Bad ECA:
eca_01.jpeg
eca_01.jpeg (236.47 KiB) Viewed 10086 times


I checked for any connection with translator map bit and/or translator offset values but nothing... :(
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: 4 bit texture bug

Postby Ian » Tue Apr 04, 2017 1:32 pm

Might have to use barts bit analysis tool
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: 4 bit texture bug

Postby HarryTuttle » Tue Apr 04, 2017 1:42 pm

...and there's also this, as someone noted in another forum (left Supermodel, right Abe's footage):
du2_02.jpeg
du2_02.jpeg (236.5 KiB) Viewed 10083 times


that's however an animated texture.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: 4 bit texture bug

Postby Ian » Tue Apr 04, 2017 2:00 pm

That's not a 4bit texture is it?
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: 4 bit texture bug

Postby HarryTuttle » Tue Apr 04, 2017 2:09 pm

Ian wrote:That's not a 4bit texture is it?


Yes it is, it's composed by three types: 1,2 and 3 precisely (so not contour)
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: 4 bit texture bug

Postby Ian » Tue Apr 04, 2017 2:51 pm

It can't be a 4bit texture, because it works in the legacy engine. And countour is always specified for 4 bit textures. Took me a long time to figure that out :p
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Next

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 1 guest

cron