Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Black Outline


Dr.House
 Share

Recommended Posts

Hello Eclipse

I'm working on a game and I want to know if it possible trough coding to add a black outline to a Sprite.

Something like "Stroke" in Photoshop even when scalled down the image the stroke/outline will nicely adjust to the image.

Imagine for example ROTMG sprites without that black outline, and I add trough coding x1 Pixel Black Outline, wich will adjust nicely even if the sprite changes size for example from 60x60 to 30x30 or whatever, but will keep that nice 1px black outline.

So, is this possible? In **JS**

If yes, it is something complicated ?

Thank you!
Link to comment
Share on other sites

You have two options, the simple (or lazy, depending on your outlook) option, and the technically correct option.

The simple option is to simply redraw the image 4/8 times offset by 1 pixel (up/down/left/right and optionally up-left/up-right/down-left/down-right) and make them filled black. Obviously, this will impact performance. Test extensively if you try this out.

Your technically correct option (but isn't necessarily always possible, depends on whether your graphics engine allows it), is to look up some shader options. WebGL certainly allows you to use shaders, dunno about anything else.

I can't provide any shader code, I'm useless at creating them. :p
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...