1
Support / Re: Shader, outline and texture size
« on: January 31, 2013, 02:55:30 pm »Quote
I'm not sure what exactly you want, but...
If you want the number of texture pixels in a sprite, you can get this from:
var def = sprite.GetCurrentSpriteDef();
width = def.boundsData[1].x / def.texelSize.x; // you can do the same with y to get height in texels.
Thanks, it's what I was looking for
Quote
One cheeky way to get outlines for nearly free - draw an outline around your sprites, and have alpha set to 1 in those areas. Subtract 1 in alpha in normal shaders to draw your normal sprites - you can't have perfectly solid sprites, but I highly doubt you'd be able to notice an alpha of 254 on everything. Before you do that though, use the same texture on a second shader - now simply draw the alpha channel + a solid color (ignore the rgb channels on the texture). If you place this behind the other sprite, you'll have perfect outlines for nearly free..
It's a very good idea, I'll try it The only problem with that is its involve more work for artists