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

Use texelFetch to handle ABSDIFF mode #6064

Closed
wants to merge 1 commit into from
Closed

Use texelFetch to handle ABSDIFF mode #6064

wants to merge 1 commit into from

Conversation

dbz400
Copy link
Contributor

@dbz400 dbz400 commented May 11, 2014

Meanwhile , getting rid of usage of NV_shader_framebuffer_fetch .Tested on Nvidia only with OpengGL 4.4

Courtesy of @unknownbrackets to get this fixed.

Fixes #3001

@hrydgard
Copy link
Owner

This is missing the changes to Statemapping and ShaderManager, right?

@unknownbrackets
Copy link
Collaborator

I think I'll just have a go at a more complete version and see how it works. Definitely can't sample tex, though.

-[Unknown]

@dbz400
Copy link
Contributor Author

dbz400 commented May 11, 2014

@hrydgard , yep becasue i sample tex only instead of fbotex that shown in @unknownbrackets example.

@unknownbrackets , i tried your example on Dragon Ball Z and the outline is working fine however when i tested in another games which also require ABSDIFF blending but it is not working (just like it didn't apply anything i.e. no effect at all) .I did try to approximate it as max(destcolor - v) that we are currently using in our blend equation for ABSDIFF but the result is also different .Therefore i'm wondering this destcolor is the previous color ?

@unknownbrackets
Copy link
Collaborator

Well, I'll try to look for other examples, but max should not approximate abs at all (unless it's max(N, -N)). Anyway, it won't support overlapping polygons which could be important, I don't know. There could also be other issues involved.

I'm still quite worried this will be slow, probably want an option (maybe even for the clut stuff... ugh, hate options.) Some things it could potentially fix if fast enough are:

  • Alpha doubling blend modes (Persona 2, Popolocrois.)
  • Fixed A/B blend values that are not exact inverses of each other (Lunar spell effects I think?)
  • Absolute difference blending (Dragon Ball Z.)
  • Increment / decrement stencil -> alpha (can't remember, Wipeout Pure?)

But probably incr/decr would be too slow, and maybe/probably not very worth it.

And, texelFetch is supported on OpenGL 3.0+ / ES 3.0. Could use texture, but blitting is only supported in ES 3.0 (although I suppose we could blit "manually".) So doing min/max is not very useful it would seem like. However all these states would add a lot more shader permutations and potential uniform changes...

-[Unknown]

@dbz400
Copy link
Contributor Author

dbz400 commented May 11, 2014

I did check the speed and it is very fast .almost no difference.

@unknownbrackets
Copy link
Collaborator

In Dragon Ball Z, it is doing a single render with absdiff. I'm not (very) concerned about that, although not certain about mobile. Wipeout Pure does a bunch of individual draws for incr/decr stencil, each would do a blit, and that's where I'm more concerned (or with games that do a lot of draws with unsupported blend modes.)

-[Unknown]

@dbz400
Copy link
Contributor Author

dbz400 commented May 11, 2014

I see. Then i close this pull and wait for your new complete one.

@dbz400 dbz400 closed this May 11, 2014
@hrydgard
Copy link
Owner

@unknownbrackets , we don't seem to be missing any more effects in Wipeout Pure, the game looks 100% correct to me. But yeah, it indeed incrs and decrs the stencil channel to do stencil shadows, but only uses the result of that the "normal" way, so it works.

@dbz400
Copy link
Contributor Author

dbz400 commented May 11, 2014

Probably Alpha doubling blend modes would be a good candidate and we are not still emulating it correctly

@dbz400 dbz400 deleted the patch-55 branch May 12, 2014 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants