BLI code for enums that are meant to be used as "bit flags" defined
an ENUM_OPERATORS macro in BLI_utildefines.h. This cleans up things
related to said macro:
- Move it out into a separate BLI_enum_flags.hh header, instead of
"random bag of things" that is the current place,
- Update it to no longer need manual indication of highest individual
bit value. This originally was added in a31a87f89 (2020 Oct), in
order to silence some UBSan warnings that were coming
from GPU related structures (looking at current GPU code, I don't
think this is happening anymore). However, that caused actual
user-visible bugs due to incorrectly specified max. enum bit value,
and today 14% of all usages have incorrect highest individual
bit value spelled out.
- I have reviewed all usages of operator ~ and none of them are
used for directly producing a DNA-serialized value; all the
usages are for masking out other bits for which the new ~
behavior that just flips all bits is fine.
- Make the macro define flag_is_set() function to ease check of bits
that are set in C++ enum class cases; update existing cases to use
that instead of three other ways that were used.
Pull Request: https://projects.blender.org/blender/blender/pulls/148230
This patch adds proper internal support for 2D vectors in GPU materials,
while previously it used a 3D vector with the Z component ignored as a
workaround. This has no user-facing consequences.
The type conversion file was split into an additional code generation
file for easier refactoring.
Pull Request: https://projects.blender.org/blender/blender/pulls/147983
The Kernel mode of the Glare node is dependent on the quality input of
the node. This patch makes it such that it is independent. This is down
by downsampling the kernel with the same amount the image was
downsampled.
Pull Request: https://projects.blender.org/blender/blender/pulls/147811
Scaling images in the compositor sometimes causes images to shift, this
is because the realization domain was computed using the center of the
original image before scaling. To fix this, we make sure the
transformation is actually centered.
This is rarely apparent and thus no tests need to be updated and this
should not be backported for safety.
Pull Request: https://projects.blender.org/blender/blender/pulls/147805
Compositor crashes when connecting a menu output to a float input, this
is because no implicit conversion is supported between the two, and no
handling was done in this case. To fix this, we fallback to a default
value for unsupported implicit conversions.
Pull Request: https://projects.blender.org/blender/blender/pulls/147801
This patch adjusts the LGG Color Balance mode to operate in linear space
as opposed to sRGB space, which is more inline with other software and
is more expected to the user.
Versioning was added using pre and post gamma correction, but it is
very slightly different in the blacks because the gamma node only does
power correction.
Pull Request: https://projects.blender.org/blender/blender/pulls/147533
Currently when a strip has a transform that does not fill the whole
render area, first the image of the strip is transformed, and then
any modifiers are applied on that. This is mostly in the new
Compositor modifier, where procedural textures, gradients, image
coordinates "stick to the screen" instead of following the transformed
strip.
This changes the behavior so that first the modifiers are applied
to the strip image, and then the strip is transformed. This is
potentially a visually breaking change:
- This can alter visual look of existing strip, especially if they are
scaled. Previous behavior was first scale filtering, then modifier;
now it is first modifier, then scale filtering.
- Most obvious change is Compositor modifier (which is new in 5.0).
- Compositor modifier can actually expand the input image (e.g. Blur
node with "expand bounds" option set), and that works.
- Note that Masks continue to be applied in global/screen space. There
can be small look differences with rotated/scaled strips that use
masks, due to Mask application now needing to do filtered mask image
lookups.
- If anyone needs previous behavior (modifier is applied on the
"whole screen"), they can put transformed strip into a meta strip,
and apply the modifier on the meta strip itself.
Compositor modifier examples with images in the PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/146181
This patch makes a distinction between passes accessed through nodes
like the Render Layers node, and inputs accessed through nodes like the
Group Input node. Previously, the Group Input node returned the passes
of the active scene and view layer accordingly to the name, while now,
it only returns the Image (Combined) pass and the result will be zeros.
Pull Request: https://projects.blender.org/blender/blender/pulls/146831
This is the first step of moving the create infos
back inside shader sources.
All info files are now treated as source files.
However, they are not considered in the include tree
yet. This will come in another following PR.
Each shader source file now generate a `.info` file
containing only the create info declarations.
This renames all info files so that they do not
conflict with their previous versions that were
copied (non-generated).
Pull Request: https://projects.blender.org/blender/blender/pulls/146676
This patch removes the XY scale inputs from the Displace node. The
inputs were redundant since they were just multiplied by the vector.
This simplifies the node and improves performance slightly.
Additionally, the Vector input was renamed to Displacement since it no
longer specifies a direction.
Pull Request: https://projects.blender.org/blender/blender/pulls/146356
This patch reorders the inputs of some of the compositor nodes
accordingly to their importance. The importance is already quantified
internally using the domain priority of the input, so we needn't make
any subjective judgement and just order by the priority.
This breaks forward and backward compatibility if input indices were
used as opposed to input identifiers due to the different order.
Handling compatibility is not impossible, but is difficult, and it was
already ignored in many past node changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/146311
This allows to reduce the number of includes for each
tree graph (surface, volume, displacement) and
reduce the code size significantly for most vertex
shaders, speeding up compile time.
Rel #145347
Pull Request: https://projects.blender.org/blender/blender/pulls/146419
Dependencies were previously merged manually
inside the generated_sources by EEVEE.
This caused issues with double includes.
Instead, we now only gather the name of the
nodetree dependencies and add them to the
dependencies of the `GeneratedSource`.
This also make the compositor use the `GeneratedSource`
mechanism.
Pull Request: https://projects.blender.org/blender/blender/pulls/146106
The File Output node always appends the frame number even if the render
is not an animation. This patch makes it such that the frame number is
only written if the render is an animation. The user can use a frame
variable to manually append the frame number if needed.
The command line rendering interface already uses animation rendering in
all cases, so it should not be affected. However, rendering using the
render.render() operator with animation=False will see the behavior
change, however, setting animation=False and start_frame and end_frame
to the same frame number should be sufficient to restore the old
behavior.
Pull Request: https://projects.blender.org/blender/blender/pulls/141209
The Convolve node crashes Blender if used with GPU device and its output
is used multiple times. This is due to a use after free error, because
the convolve node ignored the reference count of the output.
To fix this, we retain the reference count of the output by stealing the
data of the GPU-side buffer, instead of overwriting the output with it.
Pull Request: https://projects.blender.org/blender/blender/pulls/146074
Blender compositor ignores nearest interpolation in Vulkan backend.
That's because anisotropic interpolation is used based on same left over
sampler state. To fix this, we clear anisotropic sampling in the
realization shader.
Pull Request: https://projects.blender.org/blender/blender/pulls/145905
The Movie Distortion node produces artifacts when used with half
precision context. This is because distortion grids require full
precision for high quality results, which this patch does.
Pull Request: https://projects.blender.org/blender/blender/pulls/145640
This applies an OpenColorIO display, view and look transform on a color
in the scene_linear colorspace.
In general, OpenColorIO configurations do not contain a colorspace for
every view + display, especially if they are modern configs using the
display colorspace and shared view mechanisms. Nor do they include looks.
So the Convert Colorspace node is not sufficient.
Additionally, we would like to avoid making the colorspace list too long
in the default config, as we are adding many new views and transforms.
Exposure, gamma curves and white point functionality are not included
in this node, as there are native ways of doing that in the compositor.
These settings are marked non-editable in the Python API.
Pull Request: https://projects.blender.org/blender/blender/pulls/145069
This patch optimizes nodes with Boolean and Menu inputs for GPU
execution. This is done by using constant links instead of uniforms for
those inputs. This will cause shader recompilation, but is okay since
those inputs rarely change.
Pull Request: https://projects.blender.org/blender/blender/pulls/145329
This patch turns node Menu options into menu inputs. This patch only
covers node operations like Filter, Distort, and so on. Pixel nodes like
Color Balance, Matte, and so on will be done in a separate patch.
Pull Request: https://projects.blender.org/blender/blender/pulls/144495
This patch introduces a new Jitter option for the Sun Beams mode of the
Glare node. If non-zero, is uses an approximation that is faster to
compute but makes the result more noisy.
Internally, this is computed by reducing the number of samples used to
integrate the results and introducing a random offset during
integration.
Pull Request: https://projects.blender.org/blender/blender/pulls/141789
This patch unifies the Gamma node across editors:
- Compositor now uses the Shader Gamma node implementation.
- Geometry Nodes also uses the node as a new addition.
- UI-wise in the Compositor, only socket labels change to "Color".
Forward compatibility is broken for the compositor, and the python API
changed, since the node's ID name is now ShaderNodeGamma as opposed to
CompositorNodeGamma.
Pull Request: https://projects.blender.org/blender/blender/pulls/142414
Previously, we always just used `int` when dealing with menu values on the C++
side. It's currently the only type where we have the same base type (`int`) for
two different socket types (integer and menu sockets). This has some downsides:
* It requires special cases in some places.
* There is no function from static base type to socket type (which is useful for
some utilities like `SocketValueVariant`).
* It implicitly allows operations on menu values that shouldn't be allowed such
as arithmetic operations and conversions to and from other types.
This patch adds a new `MenuValue` type that is used for menu sockets in Geometry
Nodes and the (CPU) Compositor, clarifying the distinction between integer and
menu values.
Pull Request: https://projects.blender.org/blender/blender/pulls/144476
This patch extends the support for menu sockets in the compositor to
also include pixel nodes. Menu sockets are not yet used in any node, so
this has no apparent effect.
Pull Request: https://projects.blender.org/blender/blender/pulls/144436
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