[Patch] Textures

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: [Patch] Textures

Postby Ian » Sat Jan 13, 2018 1:16 pm

That's great work Harry, I'll push these later tonight :)
I had wondered before about the previous logic but it had appeared to work well enough. The only place the microtextures looked off, was right before the track joins the main circuit on the advanced course in daytona power edition. But I never found any good quality arcade footage to compare against.
Ian
 
Posts: 1550
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Textures

Postby HarryTuttle » Sat Jan 13, 2018 1:37 pm

Ian wrote:But I never found any good quality arcade footage to compare against.


Thanks Ian! I based my work from Abe's videos of Daytona 2 BOTE attract sequence, when it explains how to drive, just before passing between the big side rocks. Well, here:
(Actual Supermodel footage)
d2bote_01.jpeg
d2bote_01.jpeg (206.62 KiB) Viewed 2578 times
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Textures

Postby Ian » Sat Jan 13, 2018 6:07 pm

Harry, are bitwise glsl operators available in glsl 1.2? Thought they were introduced with gl 1.3 which is OpenGL 3.0. Also is your maths correct. Using the bit shifting microtexturescale comes out as 1,2,4 and 8. But if you shift 128, or 1000,0000 (in binary) right 8 places you get zero? Which will give us a divide by zero error in the shader.

Disclaimer it's late and typing on my phone so could have messed up some understanding :P
Ian
 
Posts: 1550
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Textures

Postby HarryTuttle » Sun Jan 14, 2018 10:04 am

Ian wrote:But if you shift 128, or 1000,0000 (in binary) right 8 places you get zero? Which will give us a divide by zero error in the shader


Damn! I'm going to check tomorrow :) Anyway just saw this in the SDK, pro_tables.hh:
Code: Select all
#define MAX_MICROTEXTURE_LOD   (4)

Probably is a value to clamp the microtexturescale shifting. That said, bitwise ops for ints work here, but I'm not sure on older hw. I used them because probably they're faster than divisions.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Textures

Postby Ian » Sun Jan 14, 2018 11:22 am

Anyway I've updated the microtexture code on the SVN with your findings. Hopefully I didn't break anything :) Scaling relative to the base texture size makes a lot more sense I think.
Ian
 
Posts: 1550
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Textures

Postby HarryTuttle » Mon Jan 15, 2018 4:29 am

Ian, your last commit contains a math error ;). My patch behaved more like this:

in <New3D.cpp>
Code: Select all
#define MAX_MICROTEXTURE_LOD 4
float microTexScale[] = { 1, 2, 4, 8 };
 
currentMesh->microTextureID = ph.MicroTextureID();
currentMesh->microTextureScale = std::min(MAX_MICROTEXTURE_LOD, microTexScale[ph.MicroTextureMinLOD()]);

and in <R3DShader.cpp>
Code: Select all
vec2 scale    = baseTexSize / ( 128.0 / pow(2.0, microTextureScale) );

Otherwise we get different visual results. I've borrowed that macro directly from the SDK, I think that was the intended behavior to avoid a division by zero.
Last edited by HarryTuttle on Mon Jan 15, 2018 6:56 am, edited 1 time in total.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Textures

Postby Ian » Mon Jan 15, 2018 4:59 am

Let's check .. :) It's always possible i screwed something up

Using yours:
float microTexScale[] = { 1, 2, 4, 8 };
( 128.0 / pow(2.0, microTextureScale) );

128 / (2^1) = 64 = 2x scaling
128 / (2^2) = 32 = 4x scaling
128 / (2^4) = 8 = 16x scaling
128 / (2^8) = 0.5 = 256x scaling

Using svn version

128 / (2) = 64 = 2x scaling
128 / (4) = 32 = 4x scaling
128 / (8) = 16 = 8x scaling
128 / (16) =8 = 16x scaling

I suppose the question is. For MicroTextureMinLOD() using the value 2 is the correct scaling 8x or 16x ? What's the visual difference in daytona ?
I assumed also that
#define MAX_MICROTEXTURE_LOD (4)
referred simply to the number of LODs there were. Not a direct clamp on the value.
Ian
 
Posts: 1550
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Textures

Postby HarryTuttle » Mon Jan 15, 2018 5:24 am

Ian wrote:For MicroTextureMinLOD() using the value 2 is the correct scaling 8x or 16x ? What's the visual difference in daytona ?

The correct one is 16x. The difference is in the pattern showed here (the big side rocks), MicroTextureMinLOD() == 2:
Image
With 8x you'd get "bigger" patterns.

This is from an Abe's video:
Image
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Textures

Postby Ian » Mon Jan 15, 2018 5:57 am

This is 8x
Image

And 16x
Image

So yeah i'd say you are definitely correct here!
Ian
 
Posts: 1550
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Textures

Postby HarryTuttle » Mon Jan 15, 2018 6:13 am

Obviously, as you've noticed before, we've to address the case when MicroTextureMinLOD() == 3, I choose to clamp it using that macro as a safety check, but currently I still haven't encountered any such condition.
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: Bing [Bot] and 2 guests