I’m looking for a way to approximate a hueshift on an animated sprite, without using a pixel shader (since MBXLite doesn’t have them)
It’s a bit of a pickle, because you either lose a lot of performance, or need way too much memory.
The only method I’ve currently come up with is altering the pixels of the graphics resource itself on the fly. This works well enough, but it’s either very slow, or consumed a lot of memory. Here’s the two methods I’ve used:
Method 1:
Store the original pixel data in a Color[ ] (using Texture2D.GetPixels()) and apply a HSV transformation on these pixels at runtime.
Pro: Can shift to any hue you want
Con: Scales very poorly with texture size.
I currently have a 1024x512 texture, so doing over half a million HSV transformations at runtime is not a viable option.
Method 2:
Same as Method 1, but store specific hueShift values in separate Color[ ]'s, and apply those to the texture at runtime.
Pro: Much faster, scales fine with larger textures (in speed)
Con: Takes a lot of memory.
Since I need 5 colors (original, 4 shifts), I consumed 6 times the original texture. For a 1025x512 texture at Fullcolor RGBA, this means any MBXLite device will go out of memory almost immediately.
I’m wondering if anybody has anything that can approximate a hueShift, or knows of any smart tricks to do something like this much faster or using far less memory. If not, I doubt our game will support anything below OpenGL ES 2.