[Patch] Fixed Shading

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] Fixed Shading

Postby Ian » Sat Mar 18, 2017 10:27 am

I've honestly no idea what the translator map does
Ian
 
Posts: 836
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Fixed Shading

Postby HarryTuttle » Sat Mar 18, 2017 3:08 pm

Ian, I've finally sorted it all. :)

As it turns out, Step 1.5 have the shade "base" value set to 2.0 for *everything* self-illuminated (even non fixed shaded), so the corresponding poly color gets its value doubled, then fixed shading is added to the value like this: for illuminated polys spans from -0.5 to +0.5, for self-illuminated polys spans from -1.0 to +1.0, finally for ambient light == 0.0 (and only in this particular case) the shade *is* the value of fixed-shading ranging from 0.0 to 1.0.

Now it all makes sense. And the much more clearer code is like this:
Code: Select all
if (m_step == 0x15) {
  if (!ph.LightEnabled()) {
    shade = 2.0f;
  }
}
float divisor = ph.LightEnabled() ? 255.0f : 127.0f;
float offset = ph.LightEnabled() ? 0.5f : 1.0f;
shade += 2.0f * (float)((UINT8)(ix & 0xFF)) / divisor - offset;
if (vp_ambient == 0.0f)
  shade = (float)((UINT8)(ix & 0xFF)) / 127.0f;
User avatar
HarryTuttle
 
Posts: 295
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Fixed Shading

Postby Ian » Sat Mar 18, 2017 6:40 pm

I'll give this one a spin tomorrow :)
Ian
 
Posts: 836
Joined: Tue Feb 23, 2016 9:23 am

Previous

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 2 guests