Database traversal

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: Database traversal

Postby Ian » Sat Dec 02, 2017 9:16 am

I had a dig into the sdk with ida pro again ..

Here's what I found

Code: Select all
void __thiscall PRO_Culling_Node::SetGroupLayerNumber(PRO_Culling_Node *this, __int32 a2)
{
  *((_DWORD *)this + 26) = a2;
}


Sets the layer number

Code: Select all
void __thiscall PRO_Culling_Node::FormatCullingHierarchy(PRO_Culling_Node *this, __int32 a2)
{
      // removed not applicable code
      PRO_Culling_Node::AugmentCullingHierarchy(this, 1, *((_DWORD *)this + 26) >= 1u, a2);
 }


This method is turning the layer number into a bool. If layerNumber >= 1

Code: Select all
void __thiscall PRO_Culling_Node::AugmentCullingHierarchy(PRO_Culling_Node *this, __int32 a2, bool stencil, __int32 a4)
{
      // other code
      PRO_Culling_Node::fragmentPolygons(v5, stencil, vertexSharing);
}


Just calls another method to fragment the polys if needed

Code: Select all
void __thiscall PRO_Culling_Node::fragmentPolygons(PRO_Culling_Node *this, bool stencil, bool vertexSharing)
{
        PRO_Culling_Node::formatPolygons(
          (void *)v42,
          a3,
          *((_DWORD *)v42 + 14),
          *((_DWORD *)v42 + 15),
          *((_DWORD *)v42 + 16),
          stencil);
}


Finally ..

Code: Select all
unsigned int __thiscall PRO_Culling_Node::formatPolygons(void *this, int a2, int a3, int a4, int a5, bool stencil)
{
              if ( stencil )
                PRO_Polygon::PolygonIsLayered(v42);
}


PolygonIsLayered simply sets ..

Code: Select all
(this + 6) |= 8u;


Which just sets the layered flag.

So the too lazy didn't read, group layer just seems to set the stencil poly flag. Doesn't appear to do anything else. There must be something else in the culling nodes, or maybe even the viewport itself that turns on stenciling :/
Ian
 
Posts: 1243
Joined: Tue Feb 23, 2016 9:23 am

Re: Database traversal

Postby Bart » Sun Dec 03, 2017 5:25 pm

Is it possible that the state change is triggered by parsing a model that has this bit set during? Seems unlikely but just a thought.
User avatar
Bart
Site Admin
 
Posts: 2064
Joined: Thu Sep 01, 2011 2:13 pm
Location: New York City

Re: Database traversal

Postby Ian » Mon Dec 04, 2017 9:55 am

It's only sega rally 2 which sets the stencil flag. I did notice this in sega rally 2, maybe Harry can make sense of this madness

Image

Notice the dust completely covers the black wheels of the car, yet the shadow shows through somehow. I am not even sure how this is possible, unless texture transparency is rendered to one buffer, poly transparency is rendered to another, and the two blended together.

https://www.youtube.com/watch?v=kJ2sBdxzA7s&t=37s

You can see similar things with the shadows in other games
This is harley

Image

Not even sure how thats possible but I am sure its the key to what we are missing.
Ian
 
Posts: 1243
Joined: Tue Feb 23, 2016 9:23 am

Re: Database traversal

Postby HarryTuttle » Mon Dec 04, 2017 2:13 pm

Ian wrote:maybe Harry can make sense of this madness

Unfortunately not. I hoped that Node ID could be the solution, I also tried time ago to make sense of viewport and/or polygon number, but the former is used heavily in SWT in a way that didn't tell me anything useful, while the latter I still have to check.

Ian wrote:Notice the dust completely covers the black wheels of the car, yet the shadow shows through somehow.

I had somewhat replicated that effect by using the RenderScene function in multipass fashion. That old hack worked a bit for Sega Rally 2 but not in other games, so I soon scrapped that solution. Anyway this is what I did:

1) In <New3D.cpp> I modified the RenderScene function to accept these arguments:
Code: Select all
void CNew3D::RenderScene(int priority, bool alpha, bool texEnabled, bool texAlpha, bool polyAlpha)

2) Then, for every layer priority, after the opaque polygon pass I called:
Code: Select all
RenderScene (pri, true, false, false, true); // i.e. Sega Rally 2 shadows
RenderScene (pri, true, true, true, false); // i.e. Sega Rally 2 headlights
RenderScene (pri, true, true, true, true); // i.e. Sega Rally 2 dirt/snow
RenderScene (pri, true, true, false, true); // i.e. Sega Rally 2 car glasses

Obviously inside the function there was a check for each particular combination, and if it wasn't met it exited.
User avatar
HarryTuttle
 
Posts: 578
Joined: Thu Mar 09, 2017 8:57 am

Re: Database traversal

Postby Ian » Mon Dec 04, 2017 3:50 pm

I was thinking of pushing something similar to that
But like
RenderScene(opaque)
RenderScene(textureAlpha)
RenderScene(polyAlpha)

it's enough to fix the lights in lemans24
Ian
 
Posts: 1243
Joined: Tue Feb 23, 2016 9:23 am

Re: Database traversal

Postby model123 » Sat Dec 09, 2017 10:44 am

Hello

Translucent stage frame and shadow problems with Virtua Fighter
Translucent map and shadow problems with spike out
I think the same as
The transparency of the afterimage of the blow is overlapping

Image

https://youtu.be/xLdbunrEwHQ?t=10m11s
https://youtu.be/xLdbunrEwHQ?t=9m54s

saves
http://www.mediafire.com/file/pxg6sq9dde7s2m2/vf3tb2.zip

From Google Translate
model123
 
Posts: 22
Joined: Wed Mar 08, 2017 8:34 am

Re: Database traversal

Postby Ian » Sat Dec 09, 2017 4:14 pm

thanks for those screenshots
There is definitely some sort of depth pass happening for translucent polys ..
Ian
 
Posts: 1243
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 1 guest