Commit Graph

24 Commits

Author SHA1 Message Date
3316853323 Cleanup: conform headers to have license first
Also remove doxy comments for licenses and add missing GPL header.
2019-02-18 08:22:11 +11:00
65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
d7f55c4ff5 Cleanup: comment block tabs 2018-11-14 17:10:56 +11:00
a262ea8c47 Cleanup: trailing space for compositor 2018-06-17 17:05:29 +02:00
96fba1e101 Color: Assume Rec 709 in remaining comp nodes
Part of T54798
2018-05-17 17:20:32 -04:00
09874df135 Structural cleanup and improvements for the compositor.
Many parts of the compositor are unnecessarily complicated. This patch
aims at reducing the complexity of writing nodes and making the code
more transparent.

== Separating Nodes and Operations ==

Currently these are both mixed in the same graph, even though they have
very different purposes and are used at distinct stages in the
compositing process. The patch introduces dedicated graph classes for
nodes and for operations.

This removes the need for a lot of special case checks (isOperation etc.)
and explicit type casts. It simplifies the code since it becomes clear
at every stage what type of node we are dealing with. The compiler can
use static typing to avoid common bugs from mixing up these types and
fewer runtime sanity checks are needed.

== Simplified Node Conversion ==

Converting nodes to operations was previously based on "relinking", i.e.
nodes would start with by mirroring links in the Blender DNA node trees,
then add operations and redirect these links to them. This was very hard
to follow in many cases and required a lot of attention to avoid invalid
states.

Now there is a helper class called the NodeConverter, which is passed to
nodes and implements a much simpler API for this process. Nodes can add
operations and explicit connections as before, but defining "external"
links to the inputs/outputs of the original node now uses mapping
instead of directly modifying link data. Input data (node graph) and
result (operations graph) are cleanly separated.

== Removed Redundant Data Structures ==

A few redundant data structures have been removed, notably the
SocketConnection. These are only needed temporarily during graph
construction. For executing the compositor operations it is perfectly
sufficient to store only the direct input link pointers. A common
pointer indirection is avoided this way (which might also give a little
performance improvement).

== Avoid virtual recursive functions ==

Recursive virtual functions are evil. They are very hard to follow
during debugging. At least in the parts this patch is concerned with
these functions have been replaced by a non-virtual recursive core
function (which might then call virtual non-recursive functions if
needed). See for example NodeOperationBuilder::group_operations.
2014-04-15 16:28:10 +02:00
Lukas Toenne
028371c174 Compositor cleanup: Merge conversion operations into a single file (see also r59820).
Most convert operations can share a common base class with a single socket reader (except channel separate/combine nodes).
2013-09-05 13:32:14 +00:00
27e54f4d37 code cleanup: remove redundant casts. quiet some qualifier warnings. 2012-10-14 07:40:16 +00:00
4c22d38f92 Keying: apply garbage / core mattes after clamping
Applying this mattes before clamping produced ugly outline around
matte boundaries.
2012-07-23 18:27:06 +00:00
ba8154e24a Keying screen: small fixes and improvements from tomato
- Fixed issues with calculating matte with balance != 0.5
  It used to be used concave combination of minimal and maximal
  channel values which could be inpredictable.
  Use concave combination of two non-major channels sorted
  by their index, so such combination would always use the same
  coefficients for particular non-major channels.

- Added despill balance slider which defines balance between
  non-major channels used for calculating average of two
  colors. Difference between average value and pixel value of
  major screen channel defines amount of despill. Balance of
  0.5 gives the same behavior as it was before this slider
  was added.

---
svn merge -r48678:48679 -r48789:48790 ^/branches/soc-2011-tomato
2012-07-10 14:53:36 +00:00
33e12a2983 Highlight nodes that are being processed 2012-07-04 10:01:45 +00:00
69ab13a7db rename remaining class members with m_ prefix. 2012-06-26 07:09:49 +00:00
1755a0ada6 Added feather control to keying node
Behaves in the same way as feather dilate/erode node, applies
after dilate/erode in node.

Also use distance dilate/erode instead of size.
2012-06-25 10:50:24 +00:00
44c82198d4 Optimization of Keying Blur operation
Separate X and Y passes of blurring like it's done for flat
gaussian blur. This reduces computing difficulty from size^2
to 2*size without any visual changes in matte.
2012-06-25 08:21:55 +00:00
93fd3f11f7 Skip edge matte operation creation if output socket is not connected. 2012-06-24 17:38:14 +00:00
49a9d8d4ae Remove unused header include. 2012-06-24 09:55:10 +00:00
cde4d72848 style cleanup: more nodes 2012-06-15 17:57:39 +00:00
82473f67b3 Core matte input for keying node
This matte could be used to force alpha be at high values in areas where
algorithm detects it as edge or background color.
2012-06-15 11:53:51 +00:00
c9f1477fb0 Garbage mate input for keying node
This adds garbage matte input to new keying node which is used to
force occluding things which can not be eliminated by color operations.

White areas defines areas which should be removed from final result.
2012-06-15 08:26:49 +00:00
1f19bacf8e Kaying node from tomato branch
Merge keying node from tomato branch into trunk.

It was considered stable and helpful by Mango team and it'll help
studio pipeline, because nodes would stop disappearing when opening
files in current trunk.

Full information about keying nodes could be found there:
http://wiki.blender.org/index.php/User:Nazg-gul/Keying
2012-06-14 12:19:13 +00:00
ecbd2842dc Add screen balance into interface
Could be helpful to be played around. Default value is 0.5,
Most probably this default value should be set manually for
older files.
2012-06-10 17:41:04 +00:00
6b13203a9c Changes to keying nodes:
- Replace FastGaussian blur with GaussianBokeh blur which should give better results.
- Changes a bit formula of saturation which in some cases gives better result.
  Also included (commented out) original formula which was also checked by Brecht
  and which gave better result in some other cases.
- Made clipping white/black temporal dependent, so hopefully it wouldn't destroy
  gradients on edges.
2012-06-09 17:15:38 +00:00
ec4f675055 Fixed stupid typo: dispill vs. despill 2012-05-29 14:55:01 +00:00
876665ac25 Initial commit of new keying nodes
First node is called Keying Screen (Add -> Matte -> Keying Screen) and it's
aimed to resolve issues with gradients on green screens by producing image
with gradient which is later used as an input for screen color in keying nodes.

This node gets motion tracks from given movie clip and trackign object and uses
them to define color and position of points of gradient: for position marker's
position on current frame is sued, for color average color of pattern area is
used.

Gradient is calculating in the following way:
- On first step voronoi diagram is creating for given tracks.
- On second step triangulation of this diagram happens by connecting sites
  to edges which defines area this site belongs to.
- On third step gradient filling of this triangles happens. One of triangle
  vertices is colored with average track color, two rest vertoces are colored
  with average color between two neighbor sites. Current pixel's color in
  triangle is calculating as linear combination of vertices colors and
  barycentric coordinates of this pixel.

This node is implemented for both tile and legacy compositor systems.

Second node is basically a combination of several existing nodes to make keying
more straighforward and reduce spagetti mess in the compositor, but it also
ships some fresh approaches calculating matte which seems to be working better
for not actually green screens.

This node supports:
- Chroma preblur
- Dispilling
- Clip white/black
- Dilate/Erode
- Matte post blur

This node doesn't support chroma pre-blur for legacy compositor (yet).

There're still lots of stuff to be improved here, but this nodes night already
be used i think.

Some details might be found on this wiki page:
http://wiki.blender.org/index.php/User:Nazg-gul/Keying

This patch also contains some currently unused code from color math module, but
it was used for tests and might be used for tests in the future. Think it's ok
to have it in branch at least.
2012-05-29 14:00:47 +00:00