This adds the following features:
- `class` keyword support: checked by C++, mutated to struct for shader.
- `private` and `public` keywords: checked by C++, removed for shader.
- `static` methods.
- `const` and non-const methods.
What is not supported:
- Constructors
- Destructors
- operators
- Method definition outside of class definition
- member reference without `this` keyword.
This is implemented using a very simple lexer/parser allowing semantic traversal.
Pull Request: https://projects.blender.org/blender/blender/pulls/144025
The compositor ignores translation in certain nodes like Corner Pin.
Users find this unexpected as adjusting the translation of the input has
no effect on the output. The only alternative logical thing to do if
translation exists is to clip the image, which this patch do.
This affects the following nodes:
- File Output.
- Map UV (Image input).
- Corner Pin.
- Plane Track Deform.
- Bokeh Blur (Bokeh Kernel input).
Pull Request: https://projects.blender.org/blender/blender/pulls/144049
This commit introduces the extension modes to the corner pin node and
further streamlines the node properties by wrapping all props in the node
storage. Therefore, the interpolation mode has been removed from the
custom properties of the node and moved into the node storage.
Right now, the extension modes only work for non-anisotropic filtering.
Pull Request: https://projects.blender.org/blender/blender/pulls/141570
The Map UV node does not work when the UV input is a single value, where
it is expected that the output will also be single value. This was
simply not implemented for GPU, so this patch does that.
Pull Request: https://projects.blender.org/blender/blender/pulls/143096
The viewport compositor crashes if the user enters a group node if no
viewer node exists. This is because the code still allowed group output
nodes to be added as compositor outputs in none root contexts, which is
forbidden since e34e6373b6. To fix this, we refactor the code to
disallow such cases.
Pull Request: https://projects.blender.org/blender/blender/pulls/143933
The Dilate node Feather mode has artifacts on Intel Windows GPUs. This
is due to a wrong shader image format. So this patch fixes that by using
the correct single channel format.
Pull Request: https://projects.blender.org/blender/blender/pulls/143748
This patch improves the realism of the Fog Glow mode of the Glare node
based on the Photopic model described in:
Physically-Based Glare Effects for Digital Images" by G. Spencer, P.
Shirley, K. Zimmerman, and D. P. Greenberg.
This is a breaking change that can't be versioned, but it is worth it
for the superior realism of the new model.
Pull Request: https://projects.blender.org/blender/blender/pulls/140646
The compositor context has a number of pure virtual methods that could
be optional or removed altogether, so this patch refactors that by
reducing unnecessary pure virtual methods.
Pull Request: https://projects.blender.org/blender/blender/pulls/143091
This patch replaces the Composite node with the Group Output node as the
primary compositor output. The old node was removed and versioned. This
was done for consistency with Geometry Nodes and in preparation for more
generic use of the compositor in VSE modifiers, layered compositing, NPR
multi-stage compositing, and more.
The Group Output node relies on the node tree interface, so we now have
a default interface of a single input and a single output. For now, only
the first input is considered while the rest are ignored, just like the
Geometry Nodes design. Furthermore, the input is required to be of type
color. Warnings and errors are issues if any of those are not met, also
similar to Geometry Nodes.
This introduces a new limitation: Composite outputs can no longer exist
in node groups, since they obviously then act as their respective group
outputs.
A refactor for the compositor scheduler is needed to simplify the logic
after this change, but this will be done in a separate patch.
Pull Request: https://projects.blender.org/blender/blender/pulls/142232
The compositor crashes when a group node has an output that is connected
to the compositor output, but the group internally has no Group Output
node. That's because the derived node tree structure would return a null
origin socket for this case, but the null socket is not handled by the
code. To fix this, we assume the input socket in such cases.
Pull Request: https://projects.blender.org/blender/blender/pulls/142944
This patch allows allocating results on the host even if the context
uses GPU. It also adds support for uploading the host result into a GPU
allocated result. This is done to allow using results for storing data
that gets computed on the CPU be end up on the GPU, like some of the
cached resources used by the compositor. Those resources are refactored
accordingly in this patch as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/141745
Implicit conversion for single values always return zero in GPU device.
That's because the conversion data was only stored on the CPU and not
uploaded to the GPU, so we ensure it gets uploaded to GPU.
Pull Request: https://projects.blender.org/blender/blender/pulls/141658
The Dilate node clamps negative values on GPU but works fine on CPU.
This is because the minimum value was used as FLT_MIN, but it should
actually be -FLT_MAX.
Pull Request: https://projects.blender.org/blender/blender/pulls/141144
This patch introduces a new Extension Mode option to the Translate node,
replacing the current repeat option and adding an extra Extend mode when
the nearest boundary pixel is sampled. The option allows choosing from
Zero, Repeat, and Extend for each of the axis independently.
A new generic sample method was added to the Result class for sampling
with arbitrary interpolation and extension modes.
Pull Request: https://projects.blender.org/blender/blender/pulls/140607
This patch adds support for the experimental structure types currently
used bu Geometry Nodes. Pixel nodes were declared as function nodes,
which gives dynamic structures for all their sockets. Other nodes now
explicitly declared their inputs as dynamic if not single value, while
the compositor_expects_single_value marker was removed in favor of the
StructureType::Single type.
Pull Request: https://projects.blender.org/blender/blender/pulls/140910
The compositor crashes when using any image coordinates in GPU mode.
That's because the realization operation didn't support Float2 images so
far. To fix this, we handle Float2 images for realization.
This patch removes the Texture node from the compositor, which was based
on the legacy Internal Textures system in Blender. The main motivation
for removing this node is as follows:
- Procedural texturing nodes that previously existed in shading and
geometry nodes are now supported in the compositor, which cover 95% of
what is previously possible using and even adds new possibilities like
Gabor, Bricks, and various improvements to existing texture types.
- The old texture system did not support GPU evaluation, so it was
always computed and cached on the CPU, which causes bad performance
especially for interactive use in the viewport compositor. While the
new nodes are fully GPU accelerated and do not require any caching.
- The Texture node didn't support Texture nodes, so it was not fully
supported and we so far had a warning about that.
- The general direction in Blender is to remove the old texture system,
and the compositor was one of the last main users of it. 5.0 is thus
the ideal time to remove such use.
- The Texture node was always and still is a source of bugs, since it
relies on proper tagging for cache invalidation and updates, which is
so far not perfect. It also suffers from UI/UX issues, since it needs
to be adjusted from the properties panel, which can break if there are
other texture nodes in the context.
This is a breaking change and no versioning was attempted since:
1. It is impossible to get the same results as before due to the use of
different random number generators, so any versioning would just give us
the general look.
2. The Texture node supports a lot of possible configurations. For
instance, each general texture can have many options for the basis type,
and each basis type might have multiple options. So versioning all of
that will take a lot of time, code, and effort.
Pull Request: https://projects.blender.org/blender/blender/pulls/140545
Previously, Float2 images were internally stored as either Float3 or
Float4 images due to limitations in the implementation, which no longer
exists. So this patch refactors the compositor code to store Float2
images in actual Float2 containers, which gives better performance and
memory savings.
Some algorithms were adjusted to operate on Float2 instead of Float3 as
was previously the case.
Pull Request: https://projects.blender.org/blender/blender/pulls/140855
This patch removes the Dot output from the Normal node. This previously
computed negative the dot product of the normalized inputs. We are
removing it because we now have a Vector Math node that can compute the
dot product, and because it output is confusing, considering it computes
the negative of the product and it implicitly normalized the input.
The node was moved to the input category, and might be later extended to
allow normal picking from the scene or normal passes.
Fixed#132770.
Pull Request: https://projects.blender.org/blender/blender/pulls/140599
This patch enhances the quality setting of the Glare node. Previously,
Medium and Low quality were implemented using a single tap interpolation
downsampling filter, which means small highlights that only span a small
number of pixels could be missed during downsampling, and that might
change across frames, causing flickering.
To fix this, we use a higher quality downsampling filter that averages
the entire 2x2 or 4x4 pixel blocks for the Medium and Low quality
settings respectively.
The upsampling pass also needs to be improved to avoid offsets, but this
will be implemented separately.
Pull Request: https://projects.blender.org/blender/blender/pulls/140237
This commit introduces interpolation methods (Nearest, Bilinear,
Bicubic) for the Displace node in the compositor:
- Exposes a dropdown selector for interpolation selection.
- Introduces different methods for Anisotropic and other interpolation
methods.
Reference: #119592.
Pull Request: https://projects.blender.org/blender/blender/pulls/139802
The Extend Bounds input has no effect when the Fast Gaussian filter is
used. Similarly, it has no effect if the Bokeh Blur node is using
variable size. This is a known limitation and was just not implemented.
So to fix this, we implement a general solution that works globally
across the node by pre-padding the inputs of the blur. This uses more
memory but also speeds up the base case when Extend Bounds is disabled,
while also reducing the binary size due to fewer blur specializations.
The variable size Bokeh Blur test was updated since it Extend Bounds was
silently ignored.
Pull Request: https://projects.blender.org/blender/blender/pulls/140192
- Adds Anisotropic (EWA) sampling to the compositor's interpolation
enum.
- Any compositor nodes using EWA sampling are refactored and depend
now on the interpolation enum.
- More refactoring in the RNA properties and DNA nodes to unify usage.
Pull Request: https://projects.blender.org/blender/blender/pulls/139833
The alpha channel value was previously hard codded to one in the lens
distortion node. This patch solves that by integrating the alpha as well
in the radial distortion mode and taking the average alpha in the
horizontal case.
This breaks backward compatibility, but is what users what in most
cases, so it is acceptable.
Fixes#134658.
Pull Request: https://projects.blender.org/blender/blender/pulls/137994
The Movie distortion node crops its data if the movie size differs from
the input size. That's because boundary extensions do not take
calibration size into account. To fix this, we use the same coordinates
range as the distortion grid computation, which computes the distortion
in the space of the calibration size.
Pull Request: https://projects.blender.org/blender/blender/pulls/139822
Compilation constants are constants defined in the create info.
They cannot be changed after the shader is created.
It is a replacement to macros with added type safety.
Reuse most of the logic from Specialization constants.
Pull Request: https://projects.blender.org/blender/blender/pulls/139703
This patch takes virtual sockets into consideration in the compositor
code base. This mostly involves ignoring them as if they were
unavailable.
This is needed for use with nodes that use Extend sockets.
Pull Request: https://projects.blender.org/blender/blender/pulls/139582