Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX12: Naruto Shippuden: Ultimate Ninja Storm Generations- Shadow and depth issue #1949

Closed
SakataGintokiYT opened this issue Jul 19, 2016 · 11 comments

Comments

@SakataGintokiYT
Copy link
Contributor

SakataGintokiYT commented Jul 19, 2016

@vlj
@kd-11
Fotoszok.pl
Shader-Log : https://mega.nz/#!MdpSCAwT!RXmjPlCuOrYp3Ymb4MF8azLwf9efnqXEnXT-GxDBm1U

@vlj
Copy link
Contributor

vlj commented Jul 19, 2016

It's an issue with the way depth buffer is used in the engine (I assume it's the same for every Naruto game).

The game renders the scene normally then overwrites it (hence the missing geometry).
Depth buffer is rendered as D24_X8 which is correctly emulated. However it is then sampled as RGBA8 on rsx : the shader usually reads the first 3 values and reconstruct the depth component using a dot() operation with carefully chosen constant vector. In DX12 the sampled value is sampled as a D24_X8 which means that the shader will get a (depth, 0, 0) when sampling. Usually the dot constant vector has component that makes depth close to the real dot(RGB) operation but not exactly the same.

I had a patch that copied d24_X8 texture to a buffer which is then copied to a RGBA8 textures which solved the glitches but there might be a better way to do by hacking shader.

@MrSapps
Copy link

MrSapps commented Jul 19, 2016

How come its not possible to query directly as RGBA8 like RSX?

@vlj
Copy link
Contributor

vlj commented Jul 19, 2016

Modern gpu uses compression algorithm on depth stencil which hides actual implementation. Additionally not every gpu supports d24x8 internally, radeons fallback to d32x8.

We can transform depth value to rgba before sampling (it's only a compute shader task) or split depth in 3 part in fragment shader

@raven02 raven02 changed the title [DX12]-Naruto Shippuden: Ultimate Ninja Storm Generations-[ Dark texture and problem with depth ] DX12: Naruto Shippuden: Ultimate Ninja Storm Generations- Dark texture and problem with depth Jul 20, 2016
@kd-11
Copy link
Contributor

kd-11 commented Jul 20, 2016

I think we can just use a sample_depth_as_rgba in fs to return a 3/4 component vector that is already weighted. Not sure how to split the depth value into pieces at the moment though. Maybe we can use the naruto shader weighting vector to reconstruct the split.

@kd-11
Copy link
Contributor

kd-11 commented Sep 27, 2016

After analyzing the shader the values used are roughly (1.f, 1/256.f, 1/50k) or roughly what i'd expect from bitshift of 0, 8 and 16. Using these values in shader workarounds works very well (and I'm assuming gets around some precision issues), but unfortunately, some programs seem to sample the depth texture as RGBA8 when it seems otherwise unexpected e.g the depth gcm sample.

@kd-11
Copy link
Contributor

kd-11 commented Sep 27, 2016

Nevermind. Seems to work fine like that.

@SakataGintokiYT SakataGintokiYT changed the title DX12: Naruto Shippuden: Ultimate Ninja Storm Generations- Dark texture and problem with depth GL / VK / DX12: Naruto Shippuden: Ultimate Ninja Storm Generations- Shadow issue Oct 16, 2016
@ikki84
Copy link
Contributor

ikki84 commented Feb 3, 2017

@vlj Are you still in RPCS3 team?

@Zangetsu38
Copy link
Contributor

@ikki84 I think probably not :(

@AniLeo
Copy link
Member

AniLeo commented May 22, 2017

Please retest this @SakataGintokiYT

@AniLeo AniLeo added Bug and removed Enhancement labels May 22, 2017
@SakataGintokiYT
Copy link
Contributor Author

@kd-11
Add this to D3D12 Issues

@SakataGintokiYT SakataGintokiYT changed the title GL / VK / DX12: Naruto Shippuden: Ultimate Ninja Storm Generations- Shadow issue DX12: Naruto Shippuden: Ultimate Ninja Storm Generations- Shadow issue Jun 21, 2017
@SakataGintokiYT SakataGintokiYT changed the title DX12: Naruto Shippuden: Ultimate Ninja Storm Generations- Shadow issue DX12: Naruto Shippuden: Ultimate Ninja Storm Generations- Shadow and depth issue Jun 21, 2017
@kd-11 kd-11 closed this as completed Jun 21, 2017
@kd-11 kd-11 mentioned this issue Jun 21, 2017
23 tasks
@AniLeo
Copy link
Member

AniLeo commented Jun 21, 2017

#2861 fixed shadows, game displays correctly now, I verified, didn't check on D3D12 though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants