Object glow

A

Acr515

Guest
Is there a simple way to put a glow effect around an object, similar to the one in the image editor? I want this so I can indicate to the player what objects they can interact with, so the glow will be created whenever they're a certain distance from something. I don't want to have to create sub-images for every sprite and do the glow effect in the image editor.
 
S

Snail Man

Guest
What I would do is make a single glow sprite that's pretty large, then you can use the draw event to draw the glow sprite below any object, and scale the glow sprite if you want to.

To make an object glow, you would just need to put in its draw event
Code:
draw_sprite(spr_glow, 0, x, y); //draw the glow sprite
draw_self(); draw the object's sprite on top
 

obscene

Member
Hang on, I don't quite understand this. Do I need a glow map for every object that I want a glow for? If that's true, then I might as well just give every object the image editor glow effect.
I personally don't know... I haven't used it. But if it does, that would be pointless. But it's a free download so I'd try it. I know there has to be a shader to do this.... I have a shader that draws things white and I have another shader that draws things blurred. Combine the two and you got what you need (but I can't combine shaders because I'm shader-dumb. :p )
 
A

Acr515

Guest
I personally don't know... I haven't used it. But if it does, that would be pointless. But it's a free download so I'd try it. I know there has to be a shader to do this.... I have a shader that draws things white and I have another shader that draws things blurred. Combine the two and you got what you need (but I can't combine shaders because I'm shader-dumb. :p )
I have absolutely no idea how to use shaders, so I guess I'll just use Snail Man's method although it isn't ideal and just see how it looks.
 

obscene

Member
If you can find a shader that works it's actually easy to use....

/// Draw Event

shader_set(shader);
draw stuff
shader_reset();
 

Yal

🐧 *penguin noises*
GMC Elder
You could draw multiple copies of the sprite at positions around the object, with additive blending and transparency. Like this crude example:
Code:
if(can_interact){
  draw_set_blend_mode(bm_add)
  for(c = 0;c < 360;c += 18){
    draw_sprite_ext(sprite_index,image_index,x+lengthdir_x(4,c),y+lengthdir_y(4,c),image_xscale,image_yscale,image_angle,image_blend,image_alpha*0.25)
  }
  draw_set_blend_mode(bm_normal)
}
draw_self()
 
A

Acr515

Guest
You could draw multiple copies of the sprite at positions around the object, with additive blending and transparency. Like this crude example:
Code:
if(can_interact){
  draw_set_blend_mode(bm_add)
  for(c = 0;c < 360;c += 18){
    draw_sprite_ext(sprite_index,image_index,x+lengthdir_x(4,c),y+lengthdir_y(4,c),image_xscale,image_yscale,image_angle,image_blend,image_alpha*0.25)
  }
  draw_set_blend_mode(bm_normal)
}
draw_self()
I like this one. I tweaked it a little bit, and it looks pretty nice. Thanks!
 

Yal

🐧 *penguin noises*
GMC Elder
No problems! :3

18 is a factor of 360, so if it feels a bit odd, that's why I chose that instead of, say, 15. (Which is also a factor of 360, but... NEVER MIND xD). If you need to draw a lot of glowing objects at once, you might want to increase the step factor a bit... and also keep in mind that each time you change blend modes, you're forcing a texture batch change which can impact the performance, so if you need to draw tons of glowing objects this way, you should change the blend mode ONCE and then draw all the glows, then change it back.

Probably nothing you need to care about right now, but worth keeping in mind for later.
 
Top