Layered transparency

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!

Layered transparency

Postby Ian » Mon Apr 10, 2017 9:46 am

We implemented a quick and dirty hack to fix the crazy z-fighting issue that was plaguing shadows. Unfortunately this fixes shadows at the expensive of breaking effects in other games.

The only game I know that sets the stencil polygon attribute, is sega rally2. And it's used for the shadow under the car.
However I had long suspected there was something in the culling nodes themselves that set some sort of stencil mask. The API has a clue in this regard

void SetGroupLayerNumber ( long layer_number ) ;
Description
Sets the layer number for group layering. The group layer number sets the drawing priority for all polygons under the culling node.


The important bit
When group layering is used, the geometry being layered must all be coplanar. In addition, all culling nodes whose drawing order is to be controlled by this attribute must be children of the same parent node.


The SDK has a few clues as well
#ifdef NEW_MODEL
#ifdef BIG_ENDIAN
unsigned long tex_lod_tbl_addr : 32 ;
unsigned long spare3 : 21 ;
unsigned long flip_polygons : 1 ;
unsigned long shadow_only : 1 ;
unsigned long valid_shadow_id : 1 ;
unsigned long shadow_object_id : 8 ;
#else


These aren't used on the model3, but it's clear they put some sort of shadow code into the culling nodes on later hardware. But what about the model3 ...

This is what the culling node data looks like (from mame)
x------- -------- -------- -------- Is UF ref
-x------ -------- -------- -------- Is 3D model
--x----- -------- -------- -------- Is point
---x---- -------- -------- -------- Is point ref
----x--- -------- -------- -------- Is animation
-----x-- -------- -------- -------- Is billboard
------x- -------- -------- -------- Child is billboard
-------x -------- -------- -------- Extra child pointer needed
-------- -----xxx xxxxxx-- -------- Node ID
-------- -------- -------- x------- Reset matrix
-------- -------- -------- -x------ Use child pointer
-------- -------- -------- --x----- Use sibling pointer
-------- -------- -------- ---x---- No matrix
-------- -------- -------- ----x--- Indirect child
-------- -------- -------- -----x-- Valid color table
-------- -------- -------- ------xx Node type (0 = viewport, 1 = root node, 2 = culling node)


But you can see there are 5 unused bits in there in the culling node
-------- ?????--- -------- --------

Anyway I did a bit of debugging with virtua fighter and just dumped the raw values for the culling nodes.
I found two that looked like this

node - 8177d412 node id 501
node - 8177d812 node id 502

Those node values set some of those unused bits. Anyway I stepped through the polys and realised they were the shadow polys. That's can't be a coincidence ..
More investigating required :)
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Layered transparency

Postby HarryTuttle » Mon Apr 10, 2017 11:24 am

Speaking of nodes, it could be also the case of the semi-transparent ambulance clones, like a trail, of this particular sequence: http://www.supermodel3.com/Forum/viewtopic.php?f=3&t=1138&start=40#p12006. Those polys don't have any translucency at polygon level, however they could be an instantiated node with a group/level transparency set.

What do you think?
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Layered transparency

Postby Ian » Mon Apr 10, 2017 11:37 am

The ambulance scene has no translucency?? That's interesting :) just have to dump the values and see what it's doing.
How many levels of transparency would you say its using? Might give a clue as to the number of bits used
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Layered transparency

Postby HarryTuttle » Mon Apr 10, 2017 11:52 am

I would say that there are 32 levels, as stated in the reald 3d pro1000 product description:
TRANSLUCENCY
Polygons can be transparent as a result of LOD blending, texture, inherent polygon
translucency and edge on translucency. The system supports up to 32 levels of
translucency.


that is the polygon translucency, the textures can have 1 or 4 bit, but the case of the ambulance cannot be texture translucency 'cause that model has many texture types, even contour ones, so to blend smoothly one should modify the underlying polygon alpha channel.

Another clue from the devguide:
TRANSLUCENCY
Polygon translucency is specified at the polygon node level. Also, a culling node may
compute translucency for level-of-detail transitions. In this case, the translucency is
inherited for all child nodes. The final polygon translucency is the product of the
inherited translucency from the culling nodes, the inherent polygon translucency, and
the translucency due to texture.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Layered transparency

Postby Ian » Mon Apr 10, 2017 11:55 am

That's pretty interesting :) I hadn't seen that in the devguide.
Maybe those 5 bits are simply a transparency value. I wonder if they also force stencil on
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Layered transparency

Postby HarryTuttle » Mon Apr 10, 2017 11:57 am

Also, speaking of translucency, I still cannot find that contour threshold 8-bit value. That defines the point at which to "cut" or discard the pixel in a contour texture's bilinear filtered 1-bit alpha channel.

There are many visual confirmations that the generic 0.5 threshold is not ideal for every case.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Layered transparency

Postby Ian » Mon Apr 10, 2017 12:36 pm

I just guessed 0.5
The hardware seems to have alpha testing always enabled as can be seen in some of the 2d sequences in ocean hunter, but with a different threshold
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Layered transparency

Postby Bart » Mon Apr 10, 2017 12:51 pm

Another place where this may be used is Lost World, during sequences when T. rex footsteps cause the ground the tremble. Many years ago (i.e., 10+, at the time of the original Supermodel project), there was a Lost World cabinet at a local arcade and I remember watching that sequence and thinking it looked like multiple instances of the entire scene were drawn blended atop each other. One way to do this in OpenGL is through an accumulation buffer (I think) but Model 3 doesn't have that. I'd have to see footage again.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: Layered transparency

Postby HarryTuttle » Mon Apr 10, 2017 1:29 pm

Speaking of that game, have you noticed a strange thing in many actual arcade hw videos of that game?
In the intro when the The T-Rex is walking on his own footstep the foot is missing part of the tarsus, which is a separate model. In Supermodel is entirely displayed, that incidentally results in a better overall version of that sequence.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Layered transparency

Postby Ian » Mon Apr 10, 2017 1:53 pm

The lost world has 2 interesting bugs..
Missing laser pointer, in game selection. And missing headlight effect on t rex scene
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