After a couple of experiments with variable blur filters, I tried a more interesting, and who knows... original approach. :) First watch results here: http://www.blender.org/bf/rt0001_0030.avi http://www.blender.org/bf/hand0001_0060.avi These are the steps in producing such results: - In preprocess, the speed vectors to previous and next frame are calculated. Speed vectors are screen-aligned and in pixel size. - while rendering, these vectors get calculated per sample, and accumulated in the vector buffer checking for "minimum speed". (on start the vector buffer is initialized on max speed). - After render: - The entire image, all pixels, then is converted to quad polygons. - Also the z value of the pixels is assigned to the polygons - The vertices for the quads use averaged speed vectors (of the 4 corner faces), using a 'minimum but non-zero' speed rule. This minimal speed trick works very well to prevent 'tearing' apart when multiple faces move in different directions in a pixel, or to be able to separate moving pixels clearly from non-moving ones - So, now we have a sort of 'mask' of quad polygons. The previous steps guaranteed that this mask doesn't have antialias color info, and has speed vectors that ensure individual parts to move nicely without tearing effects. The Z allows multiple layers of moving masks. - Then, in temporal buffer, faces get tagged if they move or not - These tags then go to an anti-alias routine, which assigns alpha values to edge faces, based on the method we used in past to antialias bitmaps (still in our code, check the antialias.c in imbuf!) - finally, the tag buffer is used to tag which z values of the original image have to be included (to allow blur go behind stuff). - OK, now we're ready for accumulating! In a loop, all faces then get drawn (with zbuffer) with increasing influence of their speed vectors. The resulting image then is accumulated on top of the original with a decreasing weighting value. It sounds all quite complex... but the speed is still encouraging. Above images have 64 mblur steps, which takes about 1-3 seconds per frame. Usage notes: - Make sure the render-layer has passes 'Vector' and 'Z' on. - add in Compositor the VectorBlur node, and connect the image, Z and speed to the inputs. - The node allows to set amount of steps (10 steps = 10 forward, 10 back). and to set a maximum speed in pixels... to prevent extreme moving things to blur too wide.
117 lines
3.0 KiB
C++
117 lines
3.0 KiB
C++
/**
|
|
* $Id$
|
|
*
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*
|
|
* The Original Code is Copyright (C) 2006 by Blender Foundation
|
|
* All rights reserved.
|
|
*
|
|
* The Original Code is: all of this file.
|
|
*
|
|
* Contributor(s): none yet.
|
|
*
|
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
|
*/
|
|
|
|
#ifndef RE_SHADER_EXT_H
|
|
#define RE_SHADER_EXT_H
|
|
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
/* this include is for shading and texture exports */
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/* localized texture result data */
|
|
/* note; tr tg tb ta has to remain in this order */
|
|
typedef struct TexResult {
|
|
float tin, tr, tg, tb, ta;
|
|
int talpha;
|
|
float *nor;
|
|
} TexResult;
|
|
|
|
/* localized shade result data */
|
|
typedef struct ShadeResult
|
|
{
|
|
float combined[4];
|
|
float col[4];
|
|
float alpha;
|
|
float diff[3];
|
|
float spec[3];
|
|
float shad[3];
|
|
float ao[3];
|
|
float ray[3];
|
|
float nor[3];
|
|
float winspeed[4];
|
|
|
|
} ShadeResult;
|
|
|
|
/* localized renderloop data */
|
|
typedef struct ShadeInput
|
|
{
|
|
struct Material *mat;
|
|
struct VlakRen *vlr;
|
|
float co[3];
|
|
|
|
/* copy from material, keep synced so we can do memcopy */
|
|
/* current size: 23*4 */
|
|
float r, g, b;
|
|
float specr, specg, specb;
|
|
float mirr, mirg, mirb;
|
|
float ambr, ambb, ambg;
|
|
|
|
float amb, emit, ang, spectra, ray_mirror;
|
|
float alpha, refl, spec, zoffs, add;
|
|
float translucency;
|
|
/* end direct copy from material */
|
|
|
|
/* individual copies: */
|
|
int har;
|
|
float layerfac;
|
|
|
|
/* texture coordinates */
|
|
float lo[3], gl[3], uv[3], ref[3], orn[3], winco[3], sticky[3], vcol[3], rad[3];
|
|
float vn[3], vno[3], facenor[3], view[3], refcol[4], displace[3];
|
|
float strand, tang[3], stress, winspeed[4];
|
|
|
|
/* dx/dy OSA coordinates */
|
|
float dxco[3], dyco[3];
|
|
float dxlo[3], dylo[3], dxgl[3], dygl[3], dxuv[3], dyuv[3];
|
|
float dxref[3], dyref[3], dxorn[3], dyorn[3];
|
|
float dxno[3], dyno[3], dxview, dyview;
|
|
float dxlv[3], dylv[3];
|
|
float dxwin[3], dywin[3];
|
|
float dxsticky[3], dysticky[3];
|
|
float dxrefract[3], dyrefract[3];
|
|
float dxstrand, dystrand;
|
|
|
|
int xs, ys; /* pixel to be rendered */
|
|
short do_preview; /* for nodes, in previewrender */
|
|
short thread;
|
|
short osatex, puno;
|
|
int mask;
|
|
int depth;
|
|
unsigned int lay;
|
|
} ShadeInput;
|
|
|
|
|
|
/* node shaders... */
|
|
struct Tex;
|
|
int multitex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres);
|
|
|
|
|
|
#endif /* RE_SHADER_EXT_H */
|
|
|