ali-alidoust / gta5-extended-video-export

GTA V Video Export Enhancement
Apache License 2.0
25 stars 18 forks source link

Lineraize depth buffer #11

Open barcharcraz opened 7 years ago

barcharcraz commented 7 years ago

It looks like sometimes the depth buffer is already linear (I think it's when the game creates depth in a DXGI_FORMATR32G8X24_TYPELESS buffer as opposed to a DXGI_FORMAT_R24G8_TYPELESS one). I tested on a geforce 1080 and titan X pascal and got this 64bit depth stencil buffer on both, however I got the 32 bit buffer on an intel iris pro system.

I have verified that the depth buffer is indeed linear in this case as transforming pixels into world space yields correct results.

barcharcraz commented 7 years ago

Perhaps there's a way to get the game to always just use the linear buffer. That would be ideal.

barcharcraz commented 7 years ago

FWIW I have a similar project at https://github.com/umautobots/GTAVisionExport (the native part) that gets correct depth and stencil on nvidia pascal platforms. Perhaps we can compare notes.

ali-alidoust commented 7 years ago

If the hardware supports it, I think this would be a great idea. For linear export from logarithmic one I used the game engine itself. It creates a smaller linear depth buffer for SSAO and I give it a full scale texture and re-render it.

barcharcraz commented 7 years ago

Ahh. Unfortunately we need a full Rez depth buffer. I'm not sure if the linear depth is something gta does or something the nvidia drivers do

ali-alidoust commented 7 years ago

The depth buffer is rendered in full resolution. I don't think it's related to the drivers, since the game must have complete information about what data is inside the texture.

barcharcraz commented 7 years ago

I guess I'll have to trace Tex creation. But the nvidia drivers do seem to redirect a whole lot of functionality (we actually tried to detour via vtbl editing and had to move to hotpatching and trampolines because the nvidia drivers were already touching almost all the vtbl entries multiple times) On Tue, May 9, 2017 at 1:32 PM ali-alidoust notifications@github.com wrote:

The depth buffer is rendered in full resolution. I don't think it's related to the drivers, since the game must have complete information about what data is inside the texture.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ali-alidoust/gta5-extended-video-export/issues/11#issuecomment-300242370, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPnvU95M7Cwat2huCSB-f_4k5KT9j6_ks5r4KMogaJpZM4NSaIp .