This patch removes the Gamma option from the Defocus and Blur nodes. The
reasoning is as follows.
- The option was originally added when the compositor wasn't working on
a strictly linear workflow. So this is rarely needed now.
- It is easy to insert a Gamma node around Blur nodes to perform any
gamma correction if really needed.
- Since we are moving options to inputs, it doesn't seem worth it to
provide this option as an input in the process.
Pull Request: https://projects.blender.org/blender/blender/pulls/138673
Use a default case for blur type switch case, that's because adding all
types is not necessary, and I am trying to differentiate between switch
cases that need full type enumeration and those that do not.
This patch refactors the result class to replace proxy results with the
possibility of doing data sharing through a shared heap allocated data
reference count. This is more robust and simpler since proxy results no
longer need to be handled as a special case in a lot of the results
code. Additionally, it allows stronger const correctness since inputs to
operations can now be const.
This is somewhat similar to implicit sharing used in other parts of
Blender, so we can look into using that in the future.
Pull Request: https://projects.blender.org/blender/blender/pulls/135778
Replace `bNodeInstanceHash` with a `Map`. Move it to the node tree
runtime data. Simplify some code by removing the tag from the hash
value and collecting unused previews directly. Then just remove a
bunch of code that's now unused.
Note that texture node previews haven't been working for a while
anyway, and the experimental shader node previews seem to use
a different system (this one is a remnant of Blender Internal).
Pull Request: https://projects.blender.org/blender/blender/pulls/135310
Previously, the vector type in the compositor had 4-components to
accommodated float4 types, while the last component was ignored for the
rest of the vector types. But now that we have a dedicated type for
float4 in #134486. We can reduce that vector type to 3-components.
Pull Request: https://projects.blender.org/blender/blender/pulls/134570
The compositor previously overloaded the vector type to represent
multiple dimensions that are always stored in a 4D float vector. This
patch introduce a dedicated type for float4, leaving the vector type to
always represent a 3D vector, which will be done in a later commit.
This is not exposed to the user as a separate socket type with a
different color, it is only an internal type that uses the same vector
socket shape and color.
Since the vector socket represents both 4D and 3D vectors, code
generally assumes that such sockets represents 3D vectors, and the
developer is expected to set it to a 4D vector if needed in the node
operation constructor, or use the newly added skip_type_conversion flag
for nodes that do not care about types, like the File Output node.
Though this should be redundant once we add a dimension property for
vector sockets.
Pull Request: https://projects.blender.org/blender/blender/pulls/134486
This patch removes the compositor texture pool implementation which
relies on the DRW texture pool, and replaces it with the new texture
pool implementation from the GPU module.
Since the GPU module texture pool does not rely on the global DST, we
can use it for both the viewport compositor engine and the GPU
compositor, so the virtual texture pool implementation is removed and
the GPU texture pool is used directly.
The viewport compositor engine does not need to reset the pool because
that is done by the draw manager. But the GPU compositor needs to reset
the pool every evaluation. The pool is deleted directly after rendering
using the render pipeline or through RE_FreeUnusedGPUResources for the
interactive compositor.
Pull Request: https://projects.blender.org/blender/blender/pulls/134437
The symmetric separate blur operation in the compositor is two times
slower in 4.4 compared to 4.3. On Linux, this only happens when Blender
is compiled with GCC, because Clang inlines a small function that GCC
doesn't.
To fix this, we specialize an if statement using templates to help GCC
inline the function. This results in a 3.5 times faster execution.
Pull Request: https://projects.blender.org/blender/blender/pulls/134336
This patch delays applying transformations until realization happens on
some other domain.
Currently, transformations are applied immediately at the point of
transform nodes, this is problematic for a few reasons:
- If that result was then realized on some other domain, interpolation
will have happened two times, at the transform nodes and at the node
that required realization, causing less than ideal precision issues.
- It is not possible to repeat or extend a rotated result because its
empty areas will be zero filled, leaving gaps in its extension. So
this patch is a prerequisite for #132371 if we want full support for
repetition.
- Doing inverse transformations will introduce interpolation artifacts
which might be undesirable. Inverse transformations might be used to
do pixelation for instance, so this change will be undesirable in this
case. But we decided that this is not a use case that we want to
support, and we added explicit pixel size control to the pixelate node
as an alternative.
So this has four implications, two that might be considered bad:
- Transformations will now be higher quality and more precise.
- Repetition and other boundary extension methods will now be possible.
- Downsampling then upsampling will no longer produce pixelated results.
- Realization might happen multiple times with identical results in some
cases.
The last point not a big issue, since domain realization is not a big
bottleneck in the compositor, and the plan is to move realization into
pixel operations, so it will even be more efficient than it is now.
Pull Request: https://projects.blender.org/blender/blender/pulls/133158
The wrap member in realization options is no longer used to indicate
wrapping since 8f8ae302ba. So rename it to repeat since the only user is
now repeating in the realization algorithm.
This patch moves wrapped translation from a special case of the general
transform algorithm to the Translate node. Since the Translate node is
the only user of this special case, it doesn't make sense to complicate
a generate algorithm with it. This will make future refactors of this
code easier.
Pull Request: https://projects.blender.org/blender/blender/pulls/132793
This patch adds support for using integer sockets in compositor nodes.
This involves updating the Result class, node tree compiler, implicit
conversion operation, multi-function procedure operation, shader
operation, and some operations that supports multiple types.
Shader operation internally treats integers as floats, doing conversion
to and from int when reading and writing. That's because the GPUMaterial
compiler doesn't support integers. This is also the same workaround used
by the shader system. Though the GPU module are eyeing adding support
for integers, so we will update the code once they do that.
Domain realization is not yet supported for integer types, but this is
an internal limitation so far, as we do not plan to add nodes that
outputs integers soon. We are not yet sure how realization should happen
with regards to interpolation and we do not have base functions to
sample integer images, that's why I decided to delay its implementation
when it is actually needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/132599
This patch changes how transformations are realized by adjusting the
computed size of the new domain after transformation. Previously, this
was computed with the lower left corner of the domain as the origin of
transformation, while now, the center of the domain is used as the
origin. Consequently, domains shrinks/grows around their center, which
results in a more stable output as transforms are animated.
A consequence of this change is that we can no longer scale odd sized
domains to even sized domains or vice versa, since it grows/shrinks by
the same amount on both sides. Supporting this case requires further
investigation and will probably require passing down information to the
realization functions themselves.
By now it is just a "compositor", so move the files one folder up.
Things that were under realtime_compositor/intern move into
already existing intern folder.
Pull Request: https://projects.blender.org/blender/blender/pulls/132004
This patch ports the newly redesigned GPU Inpaint node to the CPU. The
code is mostly identical to the GPU code with the necessary adjustments
to make it work with CPU.
See #114849 for more information.
Pull Request: https://projects.blender.org/blender/blender/pulls/117716
This patch rewrites and optimizes the Double Edge Mask node to be orders
of magnitude faster. For a 1k complex mask, it is 650x faster, while for
a 1k simple mask, it is only 50x faster.
This improvement is attributed to the use of a new Jump Flooding
algorithm as well as multi-threading, matching the GPU implementation.
The result of the new implementation differs in that the boundaries of
the masks are now identified as the last pixels inside the mask.
Pull Request: https://projects.blender.org/blender/blender/pulls/117545