Illuminating objects using a blend that doesn't show the blending object ...

U

Unportant

Guest
That's hard to describe.

What I mean is that, I'd like to, say, use a bm_add with a spotlight to illuminate other objects, but I don't want to draw the spotlight itself, just the *effects on the illuminated objects*.

E.g. x below is the spotlight, m is a man, and l is the left side of the man that the spotlight hits. I'd like to show l and m but not x.

xxxxxxlllmm
xxxxxxlllmm
xxxxxxlllmm

Is it possible to use blending modes (or anything else, besides shaders), to pull this off?

Thanks!
Nick
 

Yal

🐧 *penguin noises*
GMC Elder
I think this could do it.

Code:
draw_set_blend_mode(bm_add)
draw_set_color(c_gray)
draw_set_alpha(0)
draw_circle(spotlight_x,spotlight_y,spotlight_radius,false)
draw_set_alpha(1)
draw_set_blend_mode(bm_normal)
 
U

Unportant

Guest
I think this could do it.

Code:
draw_set_blend_mode(bm_add)
draw_set_color(c_gray)
draw_set_alpha(0)
draw_circle(spotlight_x,spotlight_y,spotlight_radius,false)
draw_set_alpha(1)
draw_set_blend_mode(bm_normal)
No, that just completely hides the spotlight and its shiningness. It's an interesting thought, though. I feel like it's close enough to an answer that I could get there if I just understood blend modes better ...
 

Yal

🐧 *penguin noises*
GMC Elder
Hmm... is your problem that you want only certain objects to be illuminated, not everything the spotlight is over?
 
U

Unportant

Guest
Hmm... is your problem that you want only certain objects to be illuminated, not everything the spotlight is over?
No, I want absolutely anything under the spotlight to illuminate, just not the spotlight itself. I want that blend mode (bm_add) to work exactly as it normally would ..... just without the parts of that spotlight (or circle, in your example) that aren't over other objects to be hidden.
 

Yal

🐧 *penguin noises*
GMC Elder
No, I want absolutely anything under the spotlight to illuminate, just not the spotlight itself.
. just without the parts of that spotlight (or circle, in your example) that aren't over other objects to be hidden.
So you want everything the spotlight covers to light up, but not the spotlight itself... and the part of the spotlight that doesn't cover anything to NOT be hidden? AKA the spotlight should both be visible and hidden at the same time... could you make up your mind? ^^'
 
U

Unportant

Guest
I think I miswrote that last bit. What I meant is that the parts of the spotlight that aren't over other objects should be hidden.
 

Yal

🐧 *penguin noises*
GMC Elder
Is it important that objects on the edge of the spotlight gets a round edge, or is it OK if they're fully illuminated? Because if it's OK, you could do something like this...
Code:
draw_set_blend_mode(bm_add)
with(all){
  if(point_distance(x,y,spotlight_x,spotlight_y) < spotlight_radius){
    draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,image_blend,image_alpha*0.2)
  }
}
draw_set_blend_mode(bm_normal)
 
Top