Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-02-11 16:23:08 +0300
committerTon Roosendaal <ton@blender.org>2006-02-11 16:23:08 +0300
commitfbbe5925ffc3e24289bc747557483d4fcdabb33f (patch)
treee1c5de06a3bfe1bcaa3aa840701a46392a2066ef /source/blender/makesdna/DNA_node_types.h
parenta0569049ac3a8f078795a90ff2eb4a977aea0cad (diff)
Two significant improvements in vectorblur:
1) Accumulation buffer alpha handling Accumulating colors in an accumulation is simple; a weighting factor can make sure colors don't over- or undersaturate. For alpha this is a bit more complex... especially because the masks for vectorblur are anti-aliased themselves with alpha values. Up to now I just premultiplied the mask-alpha with the actual color alpha, which worked OK for solid masks, but not for transparent ones. I thought that would be an acceptable situation, since 'ztra' faces only get blurred with alpha==1. However, it gives bad results when using 'mist' in Blender, which just gives pixels an alpha value based on camera distance. In these cases the alpha became oversaturated, accumulating into too high values. The solution is to store the mask-alpha separately, only premultiply this alpha with the weighting factor to define the accumulation amount. This is the math: blendfactor: the accumulation factor for a vectorblur pass passRGBA: color and alpha value of the current to be accumulated pass accRGBA: color and alpha value of accumulation buffer (initialized with original picture values) maskA: the mask's alpha itself accRGBA = (1 - maskA*blendfactor)*accRGBA + (maskA*blendfactor)*passRGBA This formula accumulates alpha values equally to colors, only using the mask-alpha as 'alpha-over' operation. It all sounds very logical, I just write this extensive log because I couldn't find any technical doc about this case. :) 2) Creating efficient masks with camera-shake Vector blur can only work well when there's a clear distinction between what moves, and what doesn't move. This you can solve for example by rendering complex scenes in multiple layers. This isn't always easy, or just a lot of work. Especially when the camera itself moves, the mask created by the vectorblur code becomes the entire image. A very simple solution is to introduce a small threshold for moving pixels, which can efficiently separate the hardly-moving pixels from the moving ones, and thus create nice looking masks. You can find this new option in the VectorBlur node, as 'min speed'. This mimimum speed is in pixel units. A value of just 3 will already clearly separate the background from foreground. Note; to make this work OK, all vectors in an image are scaled 3 pixels smaller, to ensure everything keeps looking coherent. Test renders; 'Elephants Dream' scene with lotsof moving parts; rendered without OSA, image textures, shadow or color correction. No vectorblur: http://www.blender.org/bf/vblur.jpg With vectorblur, showing the alpha-saturation for mist: http://www.blender.org/bf/vblur1.jpg New accumulation formula: http://www.blender.org/bf/vblur2.jpg Same image, but now with a 3 pixel minimum speed threshold: http://www.blender.org/bf/vblur3.jpg Next frame, without minimum speed http://www.blender.org/bf/vblur4.jpg Same frame with speed threshold: http://www.blender.org/bf/vblur5.jpg (Only 20 steps of vectorblur were applied for clarity).
Diffstat (limited to 'source/blender/makesdna/DNA_node_types.h')
-rw-r--r--source/blender/makesdna/DNA_node_types.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 86b13466af9..a4552af3b20 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -186,10 +186,11 @@ typedef struct NodeImageAnim {
} NodeImageAnim;
typedef struct NodeBlurData {
- short sizex, sizey, samples, maxspeed;
+ short sizex, sizey, samples, maxspeed, minspeed, pad1;
float fac;
short filtertype;
char bokeh, gamma;
+ int pad2;
} NodeBlurData;
#endif