From an end user point of view, the real3d seems to be doing some pretty impossible things. First thing is textures with transparency

With a traditional renderer, the only way to render this correctly is to sort it back to front and then draw it.
Previous efforts without sorting looked like this

Lemans24 was also stuffed with these kinds of errors. Originally I assumed that the hardware was doing some kind of sorting. But I realised with lemans24, especially on the trees that this was not possible
Although the black halo is not so noticably, on a blue or whiteish background the halos around the leaves really stand out

This is what the alpha polys look like

They are intersecting .. how can you sort this to draw correctly? The answer is you can't it's impossible without splitting the polys. So how can the hardware be drawing these polys correctly? The only answer I think is it's drawing the opaque parts first. Then drawing the transparent parts in a second pass. If you assume that suddenly all these transparency errors go completely. No more halos around the trees.

The 2nd puzzling thing is, why is there no z fighting on shadows for alpha polys? This is what supermodel looked like before I implemented the stencil buffer ..

A depth pass won't fix this, since co-planar polys will still draw and blend over the top of each other. The only? way to fix this would be to use the stencil buffer and prevent overlapping writes ...
But doing a stencil only pass to prevent overlapping polys, you get these kinds of crazy errrors.

And the actual h/w

The balloons render correctly. Okay so the hardware must be doing a depth / stencil pass.
But doing a depth / stencil pass you get these kinds of anomolies when compared to the real h/w.

The shadow and the overlay are different priority layers. The depth buffer is wiped between each layer so how can you do a depth / stencil pass? The answer is you can't. I'm pretty sure it's not possible. So how the hell is the h/w doing transparency? I think the answer is, the hw is actually drawing all the transparent parts to a totally separate layer or render target, and blending the final result over the top of the screen. In almost all examples the model3 only seems to have 1 layer of transparency. Overlapping transparency is almost non existent. By having a separate render target, if the depth test passes you simply overwrite the previous values, so in the case of co-planar polys, there is no overlap, no z fighting. But the beauty? of this is you don't need to do a depth pass first. But why would you need this anyway? The answer is because of node level transparency. If you either don't do a depth pass, or use this, some polys will draw twice or more times, and look totally broken.
Actually I think there are 2 transparency layers. I think the transparency select bit switches the layer.
Here you can see a rare case of actually overlapping transparency (smoke + shadow).

The blending between the 2 layers is weird. If you draw the polys normally and blend over the top they don't look anything like that. It's like a weird dumb blend between the 2 layers. Add up colours between 2 layers, divide by 2. Then draw final result (at a guess).
Here is the bits

The smoke is the only bit which sets the pattern select bit. I originally thought that pattern select was for stipple alpha? But I'm pretty sure it says draw to layer 2.
Just need to code a solution for this ..
