Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jbakker>2020-12-04 10:13:54 +0300
committerJeroen Bakker <jeroen@blender.org>2020-12-04 10:14:07 +0300
commit2bae11d5c08a9095f2c8ec5e465e73ada9840ed1 (patch)
tree1b256d7acff23d763758daa33282b9238ba72f5b /source/blender/makesdna
parent2bd0263fbf2175c672d46c9df9eff7fd3ceecbce (diff)
EEVEE: Arbitrary Output Variables
This patch adds support for AOVs in EEVEE. AOV Outputs can be defined in the render pass tab and used in shader materials. Both Object and World based shaders are supported. The AOV can be previewed in the viewport using the renderpass selector in the shading popover. AOV names that conflict with other AOVs are automatically corrected. AOV conflicts with render passes get a warning icon. The reason behind this is that changing render engines/passes can change the conflict, but you might not notice it. Changing this automatically would also make the materials incorrect, so best to leave this to the user. **Implementation** The patch adds a copies the AOV structures of Cycles into Blender. The goal is that the Cycles will use Blenders AOV defintions. In the Blender kernel (`layer.c`) the logic of these structures are implemented. The GLSL shader of any GPUMaterial can hold multiple outputs (the main output and the AOV outputs) based on the renderPassUBO the right output is selected. This selection uses an hash that encodes the AOV structure. The full AOV needed to be encoded when actually drawing the material pass as the AOV type changes the behavior of the AOV. This isn't known yet when the GLSL is compiled. **Future Developments** * The AOV definitions in the render layer panel isn't shared with Cycles. Cycles should be migrated to use the same viewlayer aovs. During a previous attempt this failed as the AOV validation in cycles and in Blender have implementation differences what made it crash when an aov name was invalid. This could be fixed by extending the external render engine API. * Add support to Cycles to render AOVs in the 3d viewport. * Use a drop down list for selecting AOVs in the AOV Output node. * Give user feedback when multiple AOV output nodes with the same AOV name exists in the same shader. * Fix viewing single channel images in the image editor [T83314] * Reduce viewport render time by only render needed draw passes. [T83316] Reviewed By: Brecht van Lommel, Clément Foucault Differential Revision: https://developer.blender.org/D7010
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_layer_types.h29
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h1
2 files changed, 29 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h
index 85065ba35d4..f2e3e0a3c9c 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -47,8 +47,20 @@ typedef enum eViewLayerEEVEEPassType {
EEVEE_RENDER_PASS_SHADOW = (1 << 12),
EEVEE_RENDER_PASS_AO = (1 << 13),
EEVEE_RENDER_PASS_BLOOM = (1 << 14),
+ EEVEE_RENDER_PASS_AOV = (1 << 15),
} eViewLayerEEVEEPassType;
-#define EEVEE_RENDER_PASS_MAX_BIT 15
+#define EEVEE_RENDER_PASS_MAX_BIT 16
+
+/* ViewLayerAOV.type */
+typedef enum eViewLayerAOVType {
+ AOV_TYPE_VALUE = 0,
+ AOV_TYPE_COLOR = 1,
+} eViewLayerAOVType;
+
+/* ViewLayerAOV.type */
+typedef enum eViewLayerAOVFlag {
+ AOV_CONFLICT = (1 << 0),
+} eViewLayerAOVFlag;
typedef struct Base {
struct Base *next, *prev;
@@ -104,6 +116,17 @@ typedef struct ViewLayerEEVEE {
int _pad[1];
} ViewLayerEEVEE;
+/* AOV Renderpass definition. */
+typedef struct ViewLayerAOV {
+ struct ViewLayerAOV *next, *prev;
+
+ /* Name of the AOV */
+ char name[64];
+ int flag;
+ /* Type of AOV (color/value)
+ * matches `eViewLayerAOVType` */
+ int type;
+} ViewLayerAOV;
typedef struct ViewLayer {
struct ViewLayer *next, *prev;
/** MAX_NAME. */
@@ -136,6 +159,10 @@ typedef struct ViewLayer {
struct FreestyleConfig freestyle_config;
struct ViewLayerEEVEE eevee;
+ /* List containing the `ViewLayerAOV`s */
+ ListBase aovs;
+ ViewLayerAOV *active_aov;
+
/* Runtime data */
/** ViewLayerEngineData. */
ListBase drawdata;
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 9a233878840..b8e2256c3c6 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -192,6 +192,7 @@ typedef struct View3DShading {
/* Render pass displayed in the viewport. Is an `eScenePassType` where one bit is set */
int render_pass;
+ char aov_name[64];
struct IDProperty *prop;
void *_pad2;