Commit Graph

11 Commits

Author SHA1 Message Date
Omar Emara fa3e47523e Compositor: Port GLSL SMAA to CPU compositor
This patch ports the GLSL SMAA library to the CPU compositor in order to
unify the anti-aliasing behavior between the CPU and GPU compositor.
Additionally, the SMAA texture generator was removed since it is now
unused.

Previously, we used an external C++ library for SMAA anti-aliasing,
which is itself a port of the GLSL SMAA library. However, the code
structure and results of the library were different, which made it quite
difficult to match results between CPU and GPU, hence the decision to
port the library ourselves.

The port was performed through a complete copy of the library to C++,
retaining the same function and variable names, even if they are
different from Blender's naming conversions. The necessary code changes
were done to make it work in C++, including manually doing swizzling
which changes the code structure a bit.

Even after porting the library, there were still major differences
between CPU and GPU, due to different arithmetic precision. To fix this
some of the bilinear samplers used in branches and selections were
carefully changed to use point samplers to avoid discontinuities around
branches, also resulting in a nice performance improvement. Some slight
differences still exist due to different bilinear interpolation, but
they shall be looked into later once we have a baseline implementation.

The new implementation is slower than the existing implementation, most
likely due to the liberal use of bilinear interpolation, since it is
quite cheap on GPUs and the code even does more work to use bilinear
interpolation to avoid multiple texture fetches, except this causes a
slow down on CPUs. Some of those were alleviated as mentioned in the
previous section, but we can probably look into optimizing it further.

Pull Request: https://projects.blender.org/blender/blender/pulls/119414
2024-03-25 14:21:00 +01:00
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Campbell Barton 65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
Sergey Sharybin c1bc70b711 Cleanup: Add a copyright notice to files and use SPDX format
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.

This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.

Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.

Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:

    https://reuse.software/faq/
2023-05-31 16:19:06 +02:00
Hans Goudey 91d9f46aec Cleanup: Use const for node data in compositor
Push the const usage a bit further for compositor nodes, so that they
are more explicit about not modifying original nodes from the editor.

Differential Revision: https://developer.blender.org/D15822
2022-08-31 12:06:13 -05:00
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
Campbell Barton 59a7095f79 Cleanup: use consistent copyright location, move descriptions
Order copyright immediately after the license block,
this was done almost everywhere with a few exceptions.

Remove authors from a few files (we had already removed "Contributors"
section however with old patches being applied this gets added back in).

Also move descriptive text into the doxygen comment block under \file.
In some cases remove the text as it was accidentally copied.
2022-02-09 16:00:16 +11:00
Manuel Castilla 1c42d4930a Cleanup: convert camelCase naming to snake_case in Compositor
To convert old code to the current convention and
use a single code style.
2021-10-13 23:41:14 +02:00
Manuel Castilla ecb8a574c7 Cleanup: remove unused includes in Compositor
And move unneeded includes in frequently used headers
to source files.

Slightly reduces compile time.
2021-10-13 23:41:14 +02:00
Jeroen Bakker 25c02ea703 Cleanup: Add namespace to compositor. 2021-03-29 08:18:33 +02:00
Habib Gahbiche 805d947810 Compositor: Add Anti-Aliasing node
This is an implementation of Enhanced Subpixel Morphological Antialiasing (SMAA)

The algorithm was proposed by:
  Jorge Jimenez, Jose I. Echevarria, Tiago Sousa, Diego Gutierrez

This node provides only SMAA 1x mode, so the operation will be done with no spatial
multisampling nor temporal supersampling. See Patch for comparisons.

The existing AA operation seems to be used only for binary images by some other nodes.
Using SMAA for binary images needs no important parameter such as "threshold", so we
perhaps can switch the operation to SMAA, though that changes existing behavior.

Notes:
1. The program code assumes the screen coordinates are DirectX style that the
   vertical direction is upside-down, so "top" and "bottom" actually represent bottom
   and top, respectively.

Thanks for Habib Gahbiche (zazizizou) to polish and finalize this patch.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D2411
2021-03-29 07:56:58 +02:00