Blender Git Loki

Git Commits -> Revision 76a0b32

Revision 76a0b32 by Jeroen Bakker (master)
December 4, 2020, 07:46 (GMT)
EEVEE Cryptomatte

Cryptomatte is a standard to efficiently create mattes for compositing. The
renderer outputs the required render passes, which can then be used in the
compositor to create masks for specified objects. Unlike the Material and Object
Index passes, the objects to isolate are selected in compositing, and mattes
will be anti-aliased.

Cryptomatte was already available in Cycles this patch adds it to the EEVEE
render engine. Original specification can be found at
https://raw.githubusercontent.com/Psyop/Cryptomatte/master/specification/IDmattes_poster.pdf

**Accurate mode**

Following Cycles, there are two accuracy modes. The difference between the two
modes is the number of render samples they take into account to create the
render passes. When accurate mode is off the number of levels is used. When
accuracy mode is active, the number of render samples is used.

**Deviation from standard**

Cryptomatte specification is based on a path trace approach where samples and
coverage are calculated at the same time. In EEVEE a sample is an exact match on
top of a prepared depth buffer. Coverage is at that moment always 1. By sampling
multiple times the number of surface hits decides the actual surface coverage
for a matte per pixel.

**Implementation Overview**

When drawing to the cryptomatte GPU buffer the depth of the fragment is matched
to the active depth buffer. The hashes of each cryptomatte layer is written in
the GPU buffer. The exact layout depends on the active cryptomatte layers. The
GPU buffer is downloaded and integrated into an accumulation buffer (stored in
CPU RAM).

The accumulation buffer stores the hashes + weights for a number of levels,
layers per pixel. When a hash already exists the weight will be increased. When
the hash doesn't exists it will be added to the buffer.

After all the samples have been calculated the accumulation buffer is processed.
During this phase the total pixel weights of each layer is mapped to be in a
range between 0 and 1. The hashes are also sorted (highest weight first).

Blender Kernel now has a `BKE_cryptomatte` header that access to common
functions for cryptomatte. This will in the future be used by the API.

* Alpha blended materials aren't supported. Alpha blended materials support in
render passes needs research how to implement it in a maintainable way for any
render pass.

This is a list of tasks that needs to be done for the same release that this
patch lands on (Blender 2.92)

* T82571 Add render tests.
* T82572 Documentation.
* T82573 Store hashes + Object names in the render result header.
* T82574 Use threading to increase performance in accumulation and post
processing.
* T82575 Merge the cycles and EEVEE settings as they are identical.
* T82576 Add RNA to extract the cryptomatte hashes to use in python scripts.

Reviewed By: Cl�ment Foucault

Maniphest Tasks: T81058

Differential Revision: https://developer.blender.org/D9165

Commit Details:

Full Hash: 76a0b322e4d3244e59a154c8255b84a4fbc33117
Parent Commit: 2bae11d
Lines Changed: +1001, -3

4 Added Paths:

/source/blender/blenkernel/BKE_cryptomatte.h (+42, -0) (View)
/source/blender/blenkernel/intern/cryptomatte.c (+87, -0) (View)
/source/blender/draw/engines/eevee/eevee_cryptomatte.c (+654, -0) (View)
/source/blender/draw/engines/eevee/shaders/cryptomatte_frag.glsl (+7, -0) (View)

13 Modified Paths:

/release/scripts/startup/bl_ui/properties_view_layer.py (+26, -0) (Diff)
/source/blender/blenkernel/CMakeLists.txt (+1, -0) (Diff)
/source/blender/blenkernel/intern/layer.c (+2, -0) (Diff)
/source/blender/blenloader/intern/versioning_290.c (+10, -0) (Diff)
/source/blender/draw/CMakeLists.txt (+2, -0) (Diff)
/source/blender/draw/engines/eevee/eevee_engine.c (+2, -0) (Diff)
/source/blender/draw/engines/eevee/eevee_private.h (+38, -0) (Diff)
/source/blender/draw/engines/eevee/eevee_render.c (+30, -0) (Diff)
/source/blender/draw/engines/eevee/eevee_renderpasses.c (+9, -0) (Diff)
/source/blender/draw/engines/eevee/eevee_shaders.c (+32, -0) (Diff)
/source/blender/draw/tests/shaders_test.cc (+2, -0) (Diff)
/source/blender/makesdna/DNA_layer_types.h (+17, -3) (Diff)
/source/blender/makesrna/intern/rna_scene.c (+40, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021