pnill / cartographer

The project which restores halo 2 PC multiplayer online through the "Network" area, while also adding new features such as GunGame and more to come.
https://cartographer.online/
GNU General Public License v3.0
158 stars 48 forks source link

SetRenderState(D3DRS_DEPTHBIAS, g_depth_bias) causing depth buffer issues #118

Open nukeulater opened 6 years ago

nukeulater commented 6 years ago

capture

unknown1

unknown

If you look closely you can see lights / transparent planes shine through geometry. Update 2022: Happens on MCC too. H2MCC patched in 2021 by 343i 👍🏻 (link)

Lights emitted by enemies in Campaign no longer show through some solid objects briefly when the enemy moves out of view.

They start to behave as expected if you get closer to the light / transparent plane source.

korpser32 commented 6 years ago

Yes this happens on my PC as well as on my Xbone with MCC on classic Halo 2 mode. I believe this is a result of the modded engine to allow 60 fps, as it was originally intended and all physics coded to be tied to the framerate. The same thing happens on PC again because the game has been modified to allow a higher than planned framerate and could mess up the calculations for when to draw lighting on your screen, because as you mentioned when you get closer it gets fixed and you can no longer see the light through the wall. I wouldn't worry too much about it, I get it's immersion breaking because I've noticed and felt that way too but I just take it as the one little downside to a great game.

nukeulater commented 6 years ago

The "tickrate" change has nothing to do with this. I personally tested that by setting the game engine back to xbox values (possible on PC) and the issue still occurred. Most likely a ZBuffer issue.

General-101 commented 6 years ago

Depth bias offset might be the cause or somehow related to this. Setting it to zero hides the issue.

nukeulater commented 6 years ago

Fixed if 62e8d80f2b4057c5bfd6c40fddb9b0964be7f114 is merged.

iSupersniper commented 6 years ago

This change causes zflighting issues with all bitmaps that are modified when looked at from a distance.

capture 1

nukeulater commented 6 years ago

Z-figthing happens because that light is coplanar with the wall behind/it has similar or identical values inside the Z-buffer w/ the wall. Unless you can find a way to move that light a bit or determine from which shader the depth bias value is taken from (and I suspect most of the plane lights use the same shader), it cannot be fixed.

General-101 commented 6 years ago

Just to be clear for anyone reading. The zfighting only happens if the shader used for that particular mesh had a depth bias offset value defined. This basically means that the only zfighting you should see is on mesh pieces that showed through geometry in the first place.