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

Blend Modes #28

Open
PadTwo opened this issue Apr 5, 2022 · 8 comments
Open

Blend Modes #28

PadTwo opened this issue Apr 5, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@PadTwo
Copy link
Contributor

PadTwo commented Apr 5, 2022

Hi @rainyt, I have been using your library extensively lately and i was wondering if it is possible to implement a similar Shader optimization as it is for BlendMode.additive also for the other blend modes ( BlendMode.additive , BlendMode.additive ).

I have tried looking into SpineRenderShader and SkeletonSprite but without much success.

@PadTwo PadTwo changed the title Blend Modes label:enhancement Blend Modes Apr 5, 2022
@rainyt
Copy link
Owner

rainyt commented Apr 5, 2022

Hello, BlendMode.additive is BlendMode.Add? At present, it should be supported. Is there any strange problem?

@rainyt
Copy link
Owner

rainyt commented Apr 5, 2022

At present, only add's blendmode is implemented by shaders, while other blendmodes cannot be implemented by shaders for the time being. But there may be unexpected phenomena? If you can provide me with a problem spine to try?

@PadTwo
Copy link
Contributor Author

PadTwo commented Apr 5, 2022

It is more of an improvement really, not a real problem.
I am currently working on a skeleton with 123 Slots and some of them use BlendMode.Screen which cause a performance drop, the current solution is to use Add instead of Screen.

@rainyt
Copy link
Owner

rainyt commented Apr 5, 2022

Is there a way to get the background color from the shader?

@rainyt
Copy link
Owner

rainyt commented Apr 5, 2022

Use bitmapData to cache the background pixel map in each frame, and then provide it to spine for mixed rendering?

@PadTwo
Copy link
Contributor Author

PadTwo commented Apr 6, 2022

Is there a way to get the background color from the shader?

Is Add currently applied only to objects inside SkeletonSprite ? if so maybe the same principle could be applied to other blend modes ( as an option maybe ).
In the project i am working on every object with a blend mode applied has its background inside the skeleton.

Maybe i am missing something, my knowledge of shaders is relatively limited.

@rainyt
Copy link
Owner

rainyt commented Apr 6, 2022

Since other blendmodes need background colors for calculation and blendmode, only Blendmode.ADD is not need. Therefore, SkeletonSprite only supports add when it does not digest drawcall; Other blendmode requires 1 drawcall.

@rainyt
Copy link
Owner

rainyt commented Apr 6, 2022

Maybe there is a way to detect whether there are multiple hierarchical blendmodes, and then make it a sprite to mix blendmodes, which should reduce the consumption of drawcall.

@rainyt rainyt added the enhancement New feature or request label Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants