
Since the mods haven't banned me for spamming all over the place, I wanted to share another cheap trick. This one is a poor-man's blur effect that attempts to mimic the way our eyes see (that is, the image is clearest towards the center of our vision and blurriest at the periphery). The topmost image is a normal, un-blurred shot; the center one blurs the edges slightly; and bottom one blurs the edges significantly. In the latter two images, the P. Pod text on the left appears blurred, while the center text is still crisp.
Here's the code (requires A6 Pro as well as the motion blur snippets from the other thread):
Code:
// Panels for the set_visual_field function:
panel panel_visual_field {
bmap bitmap_motion_blur;
layer = -1;
flags = transparent;
}
panel panel_visual_field_2 {
bmap bitmap_motion_blur;
layer = -2;
flags = transparent;
}
//
// Change how blurry the screen appears, and at what locations.
//
// zoomval (usually 0..100, but can go higher) determines how blurry the
// periphery is, while keeping the center of the screen crisp.
// x_offset and y_offset determine how much to blur the screen in the x and y
// directions, respectively.
//
// (Note: this is hardcoded to a 1024x768 screen, but can be made to be
// dynamic.)
//
function set_visual_field(zoomval, x_offset, y_offset) {
zoomval /= 1000;
// Turn the effect off:
if(zoomval==0 && x_offset==0 && y_offset==0) {
set_motion_blur(0); // Lazy way to reset camera.bmap.
// Make the blurry panels invisible:
panel_visual_field.visible=0;
panel_visual_field_2.visible=0;
return;
}
// Just a lazy way to set up camera.bmap:
set_motion_blur(100);
panel_motion_blur.transparent=0;
// Position the first blurred copy of the view halfway between the "real" one and panel_visual_field_2:
panel_visual_field.scale_x=1+zoomval/2;
panel_visual_field.scale_y=1+zoomval/2;
panel_visual_field.pos_x=0-(panel_visual_field.scale_x*1024-1024)/2+x_offset/2;
panel_visual_field.pos_y=0-(panel_visual_field.scale_y*768-768)/2+y_offset/2;
panel_visual_field.transparent=1;
panel_visual_field.alpha=50;
panel_visual_field.filter=1;
panel_visual_field.visible=1;
// Position the second blurred copy of the view:
panel_visual_field_2.scale_x=1+zoomval;
panel_visual_field_2.scale_y=1+zoomval;
panel_visual_field_2.pos_x=0-(panel_visual_field_2.scale_x*1024-1024)/2+x_offset;
panel_visual_field_2.pos_y=0-(panel_visual_field_2.scale_y*768-768)/2+y_offset;
panel_visual_field_2.transparent=1;
panel_visual_field_2.alpha=50;
panel_visual_field_2.filter=1;
panel_visual_field_2.visible=1;
}
To get the images in the above shots, I did:
set_visual_field(0, 0, 0); // Off
set_visual_field(10, 0, 0); // Slight edge blurring
set_visual_field(20, 0, 0); // Heavy edge blurring
You can also make the entire screen slightly blurry with this:
set_visual_field(0, 2, 0); // Horizontal smearing
Or make it look like the player's glasses have broken apart:
set_visual_field(50, 50, 50); // Yeesh
I'm posting here rather than User Contributions, as this is all still a work-in-progress; any feedback or suggestions are welcome.