Motion Blur/Chromatic Aberration?

Skull Kingz

Active member
Hey I was looking at some effects in modern video games and started thinking, what if OpenBor had some kind of motion blur/Chromatic Aberration type of effect. Has anyone ever explored adding this type of function to their gameplay? How would you go about adding something like this to the game?

I've seen this engine do some things that I've would have labeled impossible, so I'm sure it could do this with enough practice.
 
It's not supported directly, but you could do it with very carefully set up sub-screens and alpha masks around the object. I haven't scripted it yet, but already had a similar idea for sword motion blurs and worked the method out in my head. I'm too busy trying to get the 4.0 release out right now, but soon as I can I'll get back to module making and try it out.

DC
 
I figured out how to make Chromatic Aberration building off of @DCurrent Exhibition - Anaglyph Demo

There is some pretty big issue in that it cancels out a lot of other screen effects like zoom ins and overlays (like a custom fade out object)

Here it is anyways, it looks good
void dc_anaglyph_draw()
{
void screen_object_background = NULL();
void screen_object_left = NULL();
void screen_object_right = NULL();
void dm_common = NULL();
int new_only = 0;
int min_z = 0;
int max_z = 0;
int offset_x = 0;
int offset_y = 0;
int screen_pos_x = 0;
int screen_pos_y = 0;
int screen_pos_z = 0;


if (openborvariant("pause"))
{
return;
}

/*
* Get the screen objects. if they don't exist
* for some reason, we exit.
*/

screen_object_background = getlocalvar("screen_object_background");
screen_object_left = getlocalvar("screen_object_left");
screen_object_right = getlocalvar("screen_object_right");

if (!screen_object_left || !screen_object_right || !screen_object_background)
{
return;
}

/*
* If we're not in a level or the effect
* isn't turned on, clear the screens
* first, then exit.
*/

if (!openborvariant("in_level") || !getglobalvar("anaglyph_enabled"))
{
clearscreen(screen_object_left);
clearscreen(screen_object_right);

return;
}

/*
* This screen is just to give us a
* black matte between our anaglyph
* screens and the native sprite layers.
*
* We could use a draw box but screens
* are eaiser to do with during pauses.
*/

screen_pos_x = 0;
screen_pos_y = 0;
screen_pos_z = openborvariant("FRONT_PANEL_Z") + 9501;

changedrawmethod(dm_common, "reset", 1);
changedrawmethod(dm_common, "enabled", 1);
changedrawmethod(dm_common, "transbg", 0);

drawscreen(screen_object_background, screen_pos_x, screen_pos_y, screen_pos_z);

/*
* Left screen. Using the alpha 6 flag enables
* 50% transparency, but then allows us to
* override the transparency level for each
* color channel. Filter out Green by setting
* it to 0 and the other channels fully opaque.
*
* Then we draw the screen in our "play area"
* between HUD and all the other sprite que
* items.
*/

min_z = openborconstant("MIN_INT");
max_z = openborvariant("FRONT_PANEL_Z") + 9500; // The native HUD is FRONTPANEL_Z + 10000
screen_pos_x = -2;
screen_pos_y = -1;
screen_pos_z = openborvariant("FRONT_PANEL_Z") + 9502;

clearscreen(screen_object_left);
drawspriteq(screen_object_left, new_only, min_z, max_z, offset_x, offset_y);

changedrawmethod(dm_common, "reset", 1);
changedrawmethod(dm_common, "transbg", 0);
changedrawmethod(dm_common, "enabled", 1);
changedrawmethod(dm_common, "alpha", 6);
changedrawmethod(dm_common, "channelr", 0);
changedrawmethod(dm_common, "channelg", 255);
changedrawmethod(dm_common, "channelb", 255);

drawscreen(screen_object_left, screen_pos_x, screen_pos_y, screen_pos_z);

/*
* Right screen. Use same procedure as above
* to filter the Red channel, and then draw
* just in front of Left screen with a minor
* offset.
*/

screen_pos_x = 0;
screen_pos_y = 0;
screen_pos_z = openborvariant("FRONT_PANEL_Z") + 9503;

clearscreen(screen_object_right);
drawspriteq(screen_object_right, new_only, min_z, max_z, offset_x, offset_y);

changedrawmethod(dm_common, "channelr", 255);
changedrawmethod(dm_common, "channelg", 0);
changedrawmethod(dm_common, "channelb", 255);

drawscreen(screen_object_right, screen_pos_x, screen_pos_y, screen_pos_z);

/*
* Clean up the mess we made of
* drawmethod.
*/
changedrawmethod(dm_common, "reset", 1);

}
 
Back
Top Bottom