GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2013-09-30 08:40:15

Boysano
Member
Registered: 2012-11-14
Posts: 4

How to make sprite outline script?

I want a filter or script which will redraw the instance sprite,
with an outline like in rotMG game.

Say then I put script in objects draw event:

scrRedrawWithOutline(pixels_width, color, alpha);

or for more advance glow or shadow effect maybe:

scrRedrawWithOutline(pixels_width = 2-3, color, alpha, gradient = true/false);

I assume it must be done with surfaces to protect performance!

Any help will be appreciated.

Offline

#2 2013-10-01 22:06:18

xot
Administrator
Registered: 2007-08-18
Posts: 1,240

Re: How to make sprite outline script?

I'll see what I can come up with. It won't look as nice and it will be probably be computationally expensive. If a lot of sprites need these effects it might be too much.

The ideal way to achieve the look of Realm of the Mad God is render the effects into the sprites themselves. I suspect that is what they've done. It's something than could easily be done with a Photoshop action and a folder of sprites.

Last edited by xot (2013-10-01 22:54:22)


Abusing forum power since 1986.

Online

#3 2013-10-04 10:29:12

xot
Administrator
Registered: 2007-08-18
Posts: 1,240

Re: How to make sprite outline script?

This is actually a pretty complex problem to solve in a way that is easy to use and runs at practical speeds. It's more like an effects engine than just a simple script. Drawing a black outline is not so hard , but the when different colors, alphas, and gradients get involved, it's a different story.

It might be a little easier with a shader, if the sprites were prepared properly. They would have to have empty space around them large enough to accommodate the effect. Also, cropping would have to be disabled for their texture group (a Pro-only feature) or they would need to be marked for 3D which has the same effect but requires they have power-of-two dimensions.


Abusing forum power since 1986.

Online

#4 2013-10-04 20:17:23

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

Re: How to make sprite outline script?

a cheap way, but not accurate is to cal d3d_set_fog(1,color,0,0) (fog on) then draw scaled up so it's larger, then call d3d_set_fog(0,color,0,0) (fog off) then draw_self over that.

works for sprites origins centered that dont have compex shshapes

Last edited by icuurd12b42 (2013-10-04 20:17:48)

Offline

Board footer

Powered by FluxBB