テンプレート:Release Notes/2.42/Compositing nodes

提供: wiki
移動先: 案内検索

See CMS release notes for 2.42 at blender.org. Information about Vector Blur.

Compositing render in pipeline

- New Node "Composite" is output node that puts composited result back in render pipeline. - This then also displays in the render window while editing - But, only with Scene buttons option "Do Compositor" set - Then, just press F12 or render anims to see the magic!

For clarity, the former 'Output" node is renamed to "Viewer".

Curves

- Image curves are only applied now when curves panel is in use. Closing the panel will disable curves, reopen Panel enable curves. You can minimize the Curves panel to keep it active. That latter then works as visualization curves are being applied.

- Compositor output now also uses Image window curves, if active.

Interface/Nodes

Modification to allow adding a point in a curve button by LMB clicking/dragging directly on the curve, as in GIMP/Photoshop/etc.

  • Put the Add->Group menu in the top info header too.

New Blur options

The existing Blur Node (compositor) now has an optional input image. This has to be a 'value buffer', which can be a Zbuffer, or any mask you can think of. The input values have to be in the 0-1 range, so another new node was added too "Map Value". The value input can also be used to tweak blur size with the (todo) Time Node.


Vector buffer support & preliminary vector-blur Node

Using the "Render Layer" panel "Vector" pass button, the motion vectors per pixel are calculated and stored. Accessible via the Compositor.

The vector-blur node is horrible btw! It just uses the length of the vector to apply a filter like with current (z)blur.

I'm committing it anyway, I'll experiment with it further, and who knows some surprise code shows up!

blur filters composite

Redoing the blur filters for composit;

http://www.blender.org/bf/filters/

I found out current blur actually doesn't do gauss, but more did regular quadratic. Now you can choose common filter types, but more specifically;

- set gamma on, to emphasize bright parts in blur more than darker parts - use the bokeh option for (current circlular only) blur based on true area filters (meaning, for each pixel it samples the entire surrounding).This enables more effects, but is also much slower. Have to check on optimization for this still... use with care!

Nodes

Log: Group Nodes made functional: each group now can be re-used (instanced) with SHIFT+G. This works as well for local groups as library-linked groups.

Also fixed that group nodes were copying internal data to the outside, which made it impossible to use the socket-buttons to set individual values for each group-instance.

Library-linked groups are prevented from editing.

But, try to open a group and it will give a request for 'make local'.

The make local rule is identical to other library data in blender, meaning: - if all users of the library data are local -> the library data is flagged 'local', and if needed a unique name is made - if there's mixed users (local and from other library data) it makes a full copy, and assigns this copy to all local users.

compositing

Compositing workflow upgrade;

You now can set a Preview panel in the Image window, to define a sub-rect of an image to be processed. Works like the preview in 3D Window. Just press SHIFT+P to get it activated. Very nice speedup!

This is how it works:

- The compositor still uses the scene image size (including % setting) for Viewer or Composite output size - If a preview exists, it calculates the cropped rect from its position in the Image window, and stores that in the Scene render data - On composite execute, it copies only this part from the 'generator nodes',right now Images or Render Results. That makes the entire composite tree only using small rects, so it will execute fast. - Also the render window will only display the cropped rect, and on F12 only the cropped part is being executed - On rendering in background mode, the cropping is ignored though.

Usability notes:

- translating or zooming view will automatically invoke a recalculation - if you zoom in on details, the calculated rect will even become smaller - only one Imagewindow can have this Preview Panel, to prevent conflicts of what the cropped area should be. Compositing is on Scene level, not local per image window. (Note; 3D Previews are local per window!) - Closing the preview panel will invoke a full-size recalculation - All passes/layers from rendering are nicely cropped, including Z and vectors. The work to make the compositor do cropping was simple, but getting the Image window displaying correctly and get all events OK was a lot of work...indeed, we need to refactor Image Window usage once.

Sorry for making the mess even bigger now. :) I've tried not to interfere with UV edit or Paint though... only when you're in compositing mode the panel will work.

nodes

Upgrade for Node type definitions: the min/max allowed values for input sockets were not used yet... now they're verified on read, and written in socket stack data on adding new nodes. Also the buttons in Nodes use these values now.

Special request from Nathan Vegdahl who seems to be messing around with my precious nodes! :)

compositor

- Compositor now frees memory of buffers internally used in groups immediately. This wasn't part of the event-based cache anyway

- New option: "Free Texture Images" (in render Output panel). This frees after each render of each scene all images and mipmaps as used by textures. As reference it prints total amount of MB freed.

- Render stage 'creating speed vectors' had no ESC checking yet

- Made drawing scanline updates during render draw 1 scanline less...dunno, still hunting for weird opengl crashes.

- 3D preview render didn't properly skip sequence or composit render.

blend type overlay

Added blending type "Overlay" to options for Mix node & ramp shaders. The description is here; it blends nicely bright parts.

http://www.pegtop.net/delphi/articles/blendmodes/overlay.htm

Added 'screen' to texture mixing menu as well.

composite nodes

- Added option 'convert to premul' to AlphaOver node in Compositor - Fixed mix mode "Overlay", it was missing a multiplication with 2 :)

composite and node stuff

Log: Four-in-one commit:

(NOTE: new include dependency in Render module, might need MSVC update! It has to include the imbuf/intern/openexr/ directory in search path)

-> New Composite node: "Hue Saturation". Works like the former 'post process' menu. There's no gamma, brightness or multiply needed in this node, for that the Curves

Node functions better.

-> Enabled Toolbox in Node editor This now also replaces the SHIFT+A for adding nodes.

The nodes are automatically added to the menus, using the 'class' category from the type definition.


Current classes are (compositor examples):

Inputs: RenderResult, Image Outputs: Composite, Viewer Color Ops: RGB Curves, Mix, Hue Saturation,

AlphaOver Vector Ops: Normal, Vector Curves, Map Value Filters: Filter, Blur, VectorBlur Convertors: ColorRamp, RGBtoBW, Separate RGBA,

Separate HSVA, Set Alpha Generators: RGB, Value, Time Groups: the list of custom defined nodes

-> OpenEXR tile saving support Created an API for for saving tile-based Images with an unlimited amount of layers/channels. I've tested it for 'render result' now, with the idea that this can (optionally) replace the current inserting of tiles in the main result buffers. Especially with a lot of layers, the used memory for these buffers can easily go into the 100s of megs.

Two other advantages: - all 'render result' layers can be saved entirely in a single file, for later use in compositing, also for animation output. - on each render, per scene, a unique temp file can be stored, allowing to re-use these temp files on starting Blender or loading files, showing the last result of a render command.

The option is currently disabled, needs more work... but I had to commit this because of the rest of the work I did!

-> Bug fix The Image node didn't call an execute event when browsing another image.

dither

Log: - Restored "dither" option for conversion from float -> byte images. This now is a post-process option only (used to be in render). It is only handled within the Imbuf/ module, on conversions from float to byte rect, which atm mostly happens on saving images.

- Small fix: when using Scene RenderLayer nodes, the speed vectors for these nodes were not created when that scene had "Do Composite" off.

compositor upgrade

- Links now can be made between any socket type. The nodes recognize amount of channels, and will convert types if needed. Conversions from RGBA to 1 channel will use the 'RGB to BW' formula.

Also note that conversions only happen when required. So you can blur an alpha channel, filter it, and put this in a 1-channel socket without any conversion to happen, which saves memory & cpu time.

http://www.blender.org/bf/rt.jpg

The blur nodes don't accept Vector input yet...

But filter does.

- RGB Curve Nodes now have the premultiply option restored, 2 x faster

- Fixed some confusing code in Node Group handling... much stabler now

z combine node

 Compositor: new node "Z Combine", to combine two images with comparing depth values. Current version doesn't make nice AA though... that I check on next.

composite fix

Composite fix: Blur node with option "Bokeh" didn't survive on very small filtersizes (below 2 pixels). This because Bokeh actually does 2 peaks...

  /\  /\
 /  \/  \
 

I've added some fixes in the filter calculus though, and made sure that on size 1 at least the image gets copied straight away. Also fixed error, Bokeh shifted image 1 pixel up.

Todo; make filters become real floats in size...

Brought back "mapping to translucency" for materials, was temporal replaced with tests with material layer mapping...

Log: Composite: filter node now includes image edge in calculation, the outer pixels even had alpha zero...


speed vector

Tweak for Speed vector calculus for Ztransp render layer; it used to mask out moving transparent pixels by checking for alpha>0.95, now it also checks the solid layer (if present), and if there's no solid face in a pixel, the speed vector gets also added and used for transparent pixels.

This solves the 'ugly' hard outlines for vectorblur of moving hair.

Before: http://www.blender.org/bf/h1.jpg After: http://www.blender.org/bf/h2.jpg


start frame higher

Log: Composite: Image node now supports "start frame" values up to 10k.

link select

Added CTRL+L link copy and SHIFT+L link select for group-duplicators.

vectorbuffer

Added security to vectorbuffer code... before it gets used, it checks for leftover initialized max-speed values, and clears it. Also gives a giant print then... I want to know when it happens, and howto redo!

(error print = "tsk tsk! PASS_VECTOR_MAX left in buffer...")

A couple of render improvements;

- Bug fix: the upper tile in a collumn for Panorama render didn't put the mainthread to sleep properly. Now panorama renders 25% faster if you had set Y-Parts to 4.

- Enabling Compositing in Scene for first time now adds a "Composite" node too, so render output gets applied. - An attempt to render with "Do Composite" without "Composite" node will throw an error and stops rendering. In background mode it will just not render at all, and print errors. - Errors that prevent rendering now give a popup menu again. - Having MBlur or Fields option on will now normally render, but with an error print in console (not done yet...)

compositing

- Added pass rendering, tested now with only regular Materials. For Material nodes this is quite more complex... since they cannot be easily separated in passes (each Material does a full shade). In this commit all pass render is disabled though, will continue work on that later.

   Sneak preview: http://www.blender.org/bf/rt.jpg  (temporal image)
 

- What did remain is the 'Normal' pass output. Normal works very nice for relighting effects. Use the "Normal Node" to define where more or less light should be. (Use "Value Map" node to tweak influence of the Normal node 'dot' output.)

vector blur

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).

Log: iImage based Vector Blur

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.

Further tweak of Vector Blur and alpha;

- it now correctly pre-multiplies with alpha the RGB values for the antialised mask (alpha artefacts were visible) - The transparent layer will add speed vectors on top of the solid layer,cancelling out cases where the solid layer was not moving (like in its own antialising. This works fine, for as long you don't render in a single pass transparent faces that move on top of not-moving solid faces.