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!

Re: 4 bit texture bug

Postby Bart » Wed Apr 05, 2017 2:55 pm

I haven't really followed your progress on 4-bit textures at all, so I'm probably missing something fundamental, but when Nik and I had first looked at them, we thought them to be a 4-bit planar format, packing 4 indpendent images into each 16 bit word. For example, this single decal texture contains four images:

Image
Image
Image
Image

If I understand correctly, you are treating them as merely A4L4?
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: 4 bit texture bug

Postby HarryTuttle » Wed Apr 05, 2017 2:59 pm

Bart, the current implementation in fine, in my personal build I just changed those texture format in <Texture.cpp> to this:
Code: Select all
      //
      // 4 bit texture types - all luminance textures (no alpha), only seem to be enabled when contour is enabled ( white = contour value )
      //

   case 8: // low byte, low nibble
      for (yi = y; yi < (y + height); yi++)
      {
         for (xi = x; xi < (x + width); xi++)
         {
            texel = src[yi * 2048 + xi] & 0xFF;
            c = (texel & 0xF) * 17;
            scratch[i++] = c;
            scratch[i++] = c;
            scratch[i++] = c;
            scratch[i++] = c;
         }
      }
      break;

   case 9:   // low byte, high nibble
      for (yi = y; yi < (y + height); yi++)
      {
         for (xi = x; xi < (x + width); xi++)
         {
            texel = src[yi * 2048 + xi] & 0xFF;
            c = ((texel >> 4) & 0xF) * 17;
            scratch[i++] = c;
            scratch[i++] = c;
            scratch[i++] = c;
            scratch[i++] = c;
         }
      }
      break;

   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;
            scratch[i++] = c;
            scratch[i++] = c;
            scratch[i++] = c;
            scratch[i++] = c;
         }
      }
      break;

   case 11: // high byte, high nibble

      for (yi = y; yi < (y + height); yi++)
      {
         for (xi = x; xi < (x + width); xi++)
         {
            texel = src[yi * 2048 + xi] >> 8;
            c = ((texel >> 4) & 0xF) * 17;
            scratch[i++] = c;
            scratch[i++] = c;
            scratch[i++] = c;
            scratch[i++] = c;
         }
      }
      break;
   }

and inverted the alpha channel in fragment shader.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: 4 bit texture bug

Postby Ian » Wed Apr 05, 2017 3:05 pm

Does that work for Harley ?
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: 4 bit texture bug

Postby Bart » Wed Apr 05, 2017 3:07 pm

Ah, ok. So you are indeed interpreting it the same way and you've managed to figure out when the different format codes apply to the different planes, which is something Nik and I had trouble with I recall.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: 4 bit texture bug

Postby HarryTuttle » Wed Apr 05, 2017 3:07 pm

Ian wrote:Does that work for Harley ?

Apparently yes:
hl_02.jpeg
hl_02.jpeg (235.67 KiB) Viewed 6707 times
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: 4 bit texture bug

Postby HarryTuttle » Wed Apr 05, 2017 3:12 pm

Bart wrote:Ah, ok. So you are indeed interpreting it the same way and you've managed to figure out when the different format codes apply to the different planes, which is something Nik and I had trouble with I recall.


In particular: for types 8-11 I've just changed the alpha channel in <Texture.cpp> from this:
Code: Select all
scratch[i++] = (c == 255 ? 0 : 255);

to this:
Code: Select all
scratch[i++] = c;
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: 4 bit texture bug

Postby Ian » Wed Apr 05, 2017 3:16 pm

Well .. this definitely looks better :)

Image

Gonna test the other games
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: 4 bit texture bug

Postby HarryTuttle » Wed Apr 05, 2017 3:22 pm

Ian, I don't want to sound pedantic :) but there's something still wrong: it's missing the black shadow underneath the number and around the text.

However, i just compiled the official build and is fine, don't know what's wrong with that image...
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: 4 bit texture bug

Postby Ian » Wed Apr 05, 2017 3:22 pm

This doesn't though :(
Maybe there is an actual alpha inversion bit as well ..

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

Re: 4 bit texture bug

Postby HarryTuttle » Wed Apr 05, 2017 3:23 pm

What's the texture type of that fence?
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

PreviousNext

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 1 guest

cron