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

Shader depal slightly offset (bilinear filtering) #11008

Closed
unknownbrackets opened this issue May 6, 2018 · 3 comments
Closed

Shader depal slightly offset (bilinear filtering) #11008

unknownbrackets opened this issue May 6, 2018 · 3 comments
Labels

Comments

@unknownbrackets
Copy link
Collaborator

unknownbrackets commented May 6, 2018

In Dragon Ball Z Tag Team, outlines are drawn around characters using a depal effect. This is probably most apparent at 1x.

Before / without shader depal:
npeh90042_00000

With it (#10911):
npeh90042_00002

I tried adjusting the fraction to account for pixel centers (since 0.5,0.5 should really have no linear filtering...)
npeh90042_00001

That helped, but they still seem to pull left...

Technically a 1.6.0 regression but not very major.

-[Unknown]

@hrydgard
Copy link
Owner

hrydgard commented May 6, 2018

Right, I think with manual bilinear we need indeed offset by 0.5. Not sure why there would be a remaining horizontal-only offset though, unless the 0.5 offset got unevenly scaled by texture size somehow...

@unknownbrackets
Copy link
Collaborator Author

I was just using:

WRITE(p, "  vec2 fraction = fract(%s.xy * vec2(textureSize(tex, 0).xy) - vec2(0.49, 0.49));\n", texcoord);

(0.49 to avoid rounding to frac=0.99...)

It does move horizontally with that change, so I'm not sure why it'd need more than that...

-[Unknown]

@hrydgard
Copy link
Owner

hrydgard commented May 6, 2018

No we need to offset the UV not just for the filtering but also the actual texture lookups. I'll try to put it together soon.. Also we can use direct loads instead of a sampler, not sure about any perf win from that though.

EDIT: Actually probably don't want to use direct loads as we'll lose automatic wrapping, which we still use if framebuffers are pow2, I think.

hrydgard added a commit that referenced this issue May 6, 2018
…ing, fixing #11008

Also skip three texture samples if all indices are equal.
hrydgard added a commit that referenced this issue May 7, 2018
Shader depal (Vulkan): Apply a half-texel offset when bilinear filtering, fixing #11008
@hrydgard hrydgard closed this as completed May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants