-
-
Notifications
You must be signed in to change notification settings - Fork 216
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 applied to Spine node not working in official v. 4.0 #234
Comments
Good news |
Does engine-x works? |
Engine-x behavior is identical to official v4, i.e. shaders are not working when applied to Spine nodes. |
ok, I will check later |
I have checked the official spine runtimes v4 implementation, it's not support custom programstate currently |
I think there are two issues here, one has to do with the Spine runtime currently not supporting custom program state (for which Spine developers need to merge the PR fix) and the other with the fact that batching is altogether disabled for custom program types in the Cocos2d-x engine code (CCTrianglesCommand.cpp). |
Yes, so I create a PR to re-enable custom program state batch draw |
The PR may only improve batch draw and all program was compiled just in use time, for spine, you may needs send issue to official spine-runtimes: https://github.com/EsotericSoftware/spine-runtimes |
There's already a PR for that issue: EsotericSoftware/spine-runtimes#1763 |
spine-custom-shader.zip The test case is set spine animation HSV: https://github.com/c4games/engine-x/blob/master/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp#L337 |
And I also send a PR to spine-runtimes: https://github.com/EsotericSoftware/spine-runtimes/pull/1787/files |
Thanks! @halx99, I pulled the latest from master and applied your Spine runtime patch and now shaders work beautifully on Spine nodes. I think this issue is considered closed unless you want to wait for the Spine team to merge your PR. |
Out of curiosity, have you tested displaying more than one of the same spine animation on the screen, but each spine animation uses a different custom shader or different shader uniform values? For instance, with the HSV test case, display multiple spine animations, each having the custom HSV shader with different HSV value set for each one. Does it work? |
I will check later |
@rh101 I have checked, it's display same because two spine animation merged to 1 draw batch, so needs to implement custom shader like your's |
Fair enough. I was hoping there was a better way to handle the batching without using the IDs, but I can't think of any other way at the moment. |
Wouldn't XXH32 be processing intensive depending on the data contained in the vertex and uniform buffers?
I've never used it, so just wondering if it would be slow the larger the buffers are. |
I think the uniform buffer size depends on shader complexity and usually it small than 256 bytes, the XXH32 so fast could be ignore, I checked the full FBO test case, the fps still fast than official v4 in my machine
|
We also can provide setUniformID manually for user to avoid calculate uniformID with uniform buffer automatically, what do you think about? |
That would be a good idea, in case the performance is affected by the XXH32 calculation. |
Steps to Reproduce:
Shaders applied to Spine nodes do now work anymore in official v. 4.0, this is a known issue documented in https://discuss.cocos2d-x.org/t/cocos2d-4-0-create-shader-for-spine-animation/51480.
A relevant PR has been created at cocos2d/cocos2d-x#20584
The text was updated successfully, but these errors were encountered: