Hey people,
I’m having issues with rendering animated sprites. When the sprites are loaded in the scene (delivered from an asset bundle) console is throwing out warnings like this:
"[sprite_name_heree] is using a shader without GPU deformation support. Switching the renderer over to CPU deformation."
The sprites use 2d bone animation (all done using the built-in system) and they have a custom shader assigned. The shader allows me to use a mask so that I can recolour a part of the image.
When I instantiate the sprites in the project used to build the asset bundles, it all works fine without console warnings. Warnings only appear when loaded from the bundles in the main project, for each sprite in a given prefab. The shader is specifically included in the exported bundle. I’ve also enabled GPU skinning in Project Settings/Player and I’m using the most up-to-date 2d animation package for U2023.2
Does anyone have any idea why this is happening? Is this a shader issue, asset bundle issue or something else entirely? I’d appreciate your help!
Please note that GPU Sprite deformation support is currently supported in the default shaders (Sprite-Lit-Default and Sprite-Unlit-Default).
To add support for custom shaders, please check the following macro in the shader:
UNITY_SKINNED_VERTEX_COMPUTE(v);
implemented in com.unity.render-pipelines.universal\Shaders\2D\Include\Core2D.hlsl
Add a multi_compile flag to the custom shader. #pragma multi_compile _ SKINNED_SPRITE
We are currently working on adding support in ShaderGraph for custom shaders through adding a new node. Will post an update once its available.
Hey how did you add this to your shader graph? I’m new to keywords and HLSL. Adding the SKINNED_SPRITE as a bool keyword seems to have disabled any deformation, whether set to true or false.
I’ve opened the shader code and added “#pragma multi_compile _ SKINNED_SPRITE” up where all the other pragmas sit, saved and exported the bundles. Checked in the main project and no warnings appeared.
HOWEVER, and I’m questioning my sanity here, two days later I opened the shader code again and the change wasn’t there. So what I think has happened, after saving and coming back to Unity, my change has been overwritten, but if that’s what happened, I still don’t know what caused the warnings to go away.
UPDATE - just as ended writing this post, I asked our coder and turns out he got annoyed by the warning and suppressed it, that’s why I didn’t see it.
Maybe saving the shader code with the flag added as a new file would help but I’m yet to try that.
As mentioned above, we are working on ShaderGraph support for Sprite GPU Skinning and will be posting an update soon. Until then, please
Add the suggestion above to make Shaders compatible for Sprite GPU Skinning.
Disable GPU Skinning in Player Settings (Player → Other Settings → Rendering → GPU Skinning → CPU). This will fallback to CPU skinning / Dynamic Batching.
Here is a simple sample for option 1 (check comments with Sprite GPU Skinning):
I do not understand how to make the changes with #pragma multi_compile _ SKINNED_SPRITE in the shadergraph generated shader. Everytime I add it and save it gets removed and the warnings still pops.
Alternatively is there some progress on adding it’s inclusing in shadergraph?
Thanks for the help.
However I do not see a sprite skinning node ( I have GPU skinning in settings enabled and SRP in pipeline asset), only linear blending skinning. I am using URP.
edit: oh my version of the shader graph is 17.0.3, I dont see a more recent one
I added the Sprite Skinning node to the Shader Graph, but the same error message is still displayed.
[Worker0] (spriteName) is using a shader without GPU deformation support. Switching the renderer over to CPU deformation.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Also, when I move the sprite skin’s bone, the image gets distorted, but the normal map doesn’t.
Unity Version is 6.2 (6000.2.0f1)
and URP version is 17.2.0
The error continues to occur.
When SRP batcher is enabled:
Error message is displayed (“~without GPU deformation support”)
Normal maps are not applied to sprite skins and move separately
Would you like to get the shader graph and sprite by email? (I do not want it to be made public.) Or could you please provide a little more detail about what kind of reproduction you would like to upload?
Just did a quick test on 6000.2.1f1 with a similar setup. Could you please verify whether all 3 Texture2D properties have TexelSize and Offset disabled. (Please see the attached screenshot).