Shader programs for Sprites in CocosSharp?

I've been trying to determine if there's any support or discussion of supporting shader programs on sprites.
I can't find anything not even in limitations.

I feel I have missed something obvious - what's the equivalent of setting a shader program for CocosSharp?

If this is not available or not going to be available within the next few months, I will have to go back to the plan of using Cocos2D-x and using that alongside Xamarin, on iOS, Android and WP.

thanks

Posts

  • AndyDentAndyDent AUMember ✭✭

    I was talking to my co-founder about this issue this afternoon and it reminded me that Apple also went through an evolution of their SpriteKit, similarly derived from Cocos2D. SpriteKit 1.0 came out on iOS7 lacking shader nodes and only added them in iOS8. Unfortunately, because you can't back-port it, we are ruled out from using SpriteKit.

  • RamiTabbaraRamiTabbara AUMember, Xamarin Team Xamurai

    Hi Andy,

    I've opened up a new github issue here, outlining a proposed enhancement that would allow CCNode objects to be rendered with custom shaders. Please let me know if it aligns with your team was after or suggest any improvements/changes to the proposal.

    Just as a small caveat, keep in mind that as CocosSharp is built upon MonoGame, your shaders would need to be first written in HLSL and then the underlying MonoGame content tools would generate a GLSL version of your custom shaders in the cases where you were targeting iOS/Android devices.

  • AndyDentAndyDent AUMember ✭✭

    I"m fairly new to shaders so I don't understand the performance and build implications of this. Thanks for creating the issue.

    My initial reaction from looking at Custom_Effects is that there's a lot of layers of tools between an effect and it working at runtime.

    Forgive me for appearing rude, but it seems that the history of MonoGame is adding layers of complication by inserting abstractions. (I have many years of cross-platform framework development so an extreme sensitivity to abstraction layers!).

    Bluntly, the primary platforms for Xamarin are iOS and Android, dwarfing any others. These are both inherently OpenGL.

    By being based on MonoGame and propagating some of its abstractions, it seems CocosSharp is pushing us a long way from the "metal" of how the GPU works in these devices. Does this translate into any real performance disadvantage compared to Cocos2D-X?

    The Cocos2D-X project has taken the opposite approach, with Microsoft's help, of compiling GLSL shaders via ANGLE.

    We want to do very high-speed finger-tracking so being able to move rendered shapes and vary their rendering as fast as you can move a finger is very important to us. I'd really like to be using some variant of Cocos2D to add particles and lots of game goodies down the track but will go back to raw OpenGL if I have to.

  • RamiTabbaraRamiTabbara AUMember, Xamarin Team Xamurai

    Hi Andy,

    Currently, as we haven't implemented custom-shader support, I can't give you any quantitative claims about performance differences. But in terms of abstraction, I just want to clarify that the Effects class is simply a relational-mapping of the underlying shader program, so I would still consider this fairly low-level.

    Moreover, the largest performance overhead would come from the actual shader program itself which is independent of the particular library chosen be it CocosSharp or Cocos2d-x.

Sign In or Register to comment.