Nov
25
2015

Opaque Sprite Shader

sprite_opaque_no_tint_shader_unity (screenshot of modified shader properties in debug view mode)

Modified built-in sprite shader so that its opaque, no color tint, and pixel snap is always on.
Just to test if there are any performance benefits to use them for opaque sprite tiles, at least the compiled shader stats seems to be lighter.

You can download built-in shader sources at: https://unity3d.com/get-unity/download/archive

Default Sprite shader compiled stats:

// Stats for Vertex shader:
//       d3d11 : 8 avg math (5..11)
//    d3d11_9x : 8 avg math (5..11)
//        d3d9 : 13 avg math (6..21)
// Stats for Fragment shader:
//       d3d11 : 2 math, 2 texture, 1 branch
//    d3d11_9x : 2 math, 2 texture, 1 branch
//        d3d9 : 5 math, 2 texture

Opaque Sprite shader compiled stats:

// Stats for Vertex shader:
//       d3d11 : 10 math
//    d3d11_9x : 10 math
//        d3d9 : 20 math
// Stats for Fragment shader:
//       d3d11 : 0 math, 1 texture
//    d3d11_9x : 0 math, 1 texture
//        d3d9 : 2 math, 1 texture

 

Modified Sprite shader source:


Leave a comment

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.