Reputation: 71
I'm attempting to recreate a certain fadeout effect the Playstation 1 game Megaman X6 does. The screen darkens with the darker colors becoming black first, and the lighter colors becoming black later on in the fade. It's like using bm_add but for making things darker instead of lighter. I've tried using bm_subtract, but it's the same as drawing a black rectangle that gradually increases its opacity over the entire screen. All the colors become fully black at the same. I have almost no prior experience with color blending and I still haven't wrapped my head around it yet, so I'm not sure what to do. All the blend modes I've tried don't work, and my internet searches have turned up nothing. I've become really frustrated, and I would appreciate it if someone could just tell me what I need to do.
My current code (sprDot is just a 1x1 image of a white pixel, and fadeAlpha stays between 0 and 1):
draw_set_blend_mode(bm_subtract);
draw_sprite_ext(sprDot, 0, view_xview[0], view_yview[0], view_wview[0], view_hview[0], 0, make_color_rgb(fadeAlpha * 255, fadeAlpha * 255, fadeAlpha * 255), 1);
draw_set_blend_mode(bm_normal);
My game's screen no fade: https://i.sstatic.net/rkhDi.png
My game's screen partially faded: https://i.sstatic.net/uY1jl.png
Original game's screen no fade: https://i.sstatic.net/VxSMO.png
Original game's screen partially faded: https://i.sstatic.net/kgdis.png
Upvotes: 0
Views: 117
Reputation: 3192
The original's fade is definitely not as simple as bm_subtract - I would say that it most closely resembles Color Burn. Here's a mockup done in PDN:
With this in mind, the best way to approach the problem would be to write a [fragment] shader. Such a shader would be pretty simple, requiring a single uniform (fade factor in 0..1 range), but you'll want to play around with a formula for modifying output colors in accordance with that uniform's value.
Upvotes: 1