diff options
author | Jeroen Bakker <jbakker> | 2020-12-04 10:13:54 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-12-04 10:14:07 +0300 |
commit | 2bae11d5c08a9095f2c8ec5e465e73ada9840ed1 (patch) | |
tree | 1b256d7acff23d763758daa33282b9238ba72f5b /release | |
parent | 2bd0263fbf2175c672d46c9df9eff7fd3ceecbce (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 'release')
m--------- | release/datafiles/locale | 0 | ||||
m--------- | release/scripts/addons | 0 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_view_layer.py | 50 | ||||
-rw-r--r-- | release/scripts/startup/nodeitems_builtins.py | 7 |
4 files changed, 45 insertions, 12 deletions
diff --git a/release/datafiles/locale b/release/datafiles/locale -Subproject ae7e6c215c9fc715cdedbc1c1e33e946fc90b49 +Subproject 1c0e9c29fd33963ff42ff9252a64016abda8d2a diff --git a/release/scripts/addons b/release/scripts/addons -Subproject ca74197440127e56c9f6f2a277c30957f34fd07 +Subproject 672cfe9c85e2ac71b97b5331d9034d23c9723d7 diff --git a/release/scripts/startup/bl_ui/properties_view_layer.py b/release/scripts/startup/bl_ui/properties_view_layer.py index afa00bb50c2..35cd7ae5ab9 100644 --- a/release/scripts/startup/bl_ui/properties_view_layer.py +++ b/release/scripts/startup/bl_ui/properties_view_layer.py @@ -17,7 +17,16 @@ # ##### END GPL LICENSE BLOCK ##### # <pep8 compliant> -from bpy.types import Panel +from bpy.types import Panel, UIList + + +class VIEWLAYER_UL_aov(UIList): + def draw_item(self, context, layout, data, item, icon, active_data, active_propname): + row = layout.row() + split = row.split(factor=0.65) + icon = 'NONE' if item.is_valid else 'ERROR' + split.row().prop(item, "name", text="", icon=icon, emboss=False) + split.row().prop(item, "type", text="", emboss=False) class ViewLayerButtonsPanel: @@ -49,7 +58,7 @@ class VIEWLAYER_PT_layer(ViewLayerButtonsPanel, Panel): col.prop(rd, "use_single_layer", text="Render Single Layer") -class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel): +class VIEWLAYER_PT_layer_passes(ViewLayerButtonsPanel, Panel): bl_label = "Passes" COMPAT_ENGINES = {'BLENDER_EEVEE'} @@ -59,7 +68,7 @@ class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel): class VIEWLAYER_PT_eevee_layer_passes_data(ViewLayerButtonsPanel, Panel): bl_label = "Data" - bl_parent_id = "VIEWLAYER_PT_eevee_layer_passes" + bl_parent_id = "VIEWLAYER_PT_layer_passes" COMPAT_ENGINES = {'BLENDER_EEVEE'} @@ -81,7 +90,7 @@ class VIEWLAYER_PT_eevee_layer_passes_data(ViewLayerButtonsPanel, Panel): class VIEWLAYER_PT_eevee_layer_passes_light(ViewLayerButtonsPanel, Panel): bl_label = "Light" - bl_parent_id = "VIEWLAYER_PT_eevee_layer_passes" + bl_parent_id = "VIEWLAYER_PT_layer_passes" COMPAT_ENGINES = {'BLENDER_EEVEE'} def draw(self, context): @@ -116,7 +125,7 @@ class VIEWLAYER_PT_eevee_layer_passes_light(ViewLayerButtonsPanel, Panel): class VIEWLAYER_PT_eevee_layer_passes_effects(ViewLayerButtonsPanel, Panel): bl_label = "Effects" - bl_parent_id = "VIEWLAYER_PT_eevee_layer_passes" + bl_parent_id = "VIEWLAYER_PT_layer_passes" COMPAT_ENGINES = {'BLENDER_EEVEE'} def draw(self, context): @@ -135,12 +144,41 @@ class VIEWLAYER_PT_eevee_layer_passes_effects(ViewLayerButtonsPanel, Panel): col.active = scene_eevee.use_bloom +class VIEWLAYER_PT_layer_passes_aov(ViewLayerButtonsPanel, Panel): + bl_label = "Shader AOV" + bl_parent_id = "VIEWLAYER_PT_layer_passes" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + + layout.use_property_split = True + layout.use_property_decorate = False + + view_layer = context.view_layer + + row = layout.row() + col = row.column() + col.template_list("VIEWLAYER_UL_aov", "aovs", view_layer, "aovs", view_layer, "active_aov_index", rows=2) + + col = row.column() + sub = col.column(align=True) + sub.operator("scene.view_layer_add_aov", icon='ADD', text="") + sub.operator("scene.view_layer_remove_aov", icon='REMOVE', text="") + + aov = view_layer.active_aov + if aov and not aov.is_valid: + layout.label(text="Conflicts with another render pass with the same name", icon='ERROR') + + classes = ( VIEWLAYER_PT_layer, - VIEWLAYER_PT_eevee_layer_passes, + VIEWLAYER_PT_layer_passes, VIEWLAYER_PT_eevee_layer_passes_data, VIEWLAYER_PT_eevee_layer_passes_light, VIEWLAYER_PT_eevee_layer_passes_effects, + VIEWLAYER_PT_layer_passes_aov, + VIEWLAYER_UL_aov, ) if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py index b1789776728..abab50b95a2 100644 --- a/release/scripts/startup/nodeitems_builtins.py +++ b/release/scripts/startup/nodeitems_builtins.py @@ -165,11 +165,6 @@ def object_cycles_shader_nodes_poll(context): cycles_shader_nodes_poll(context)) -def cycles_aov_node_poll(context): - return (object_cycles_shader_nodes_poll(context) or - world_shader_nodes_poll(context)) - - def object_eevee_shader_nodes_poll(context): return (object_shader_nodes_poll(context) and eevee_shader_nodes_poll(context)) @@ -210,7 +205,7 @@ shader_node_categories = [ ShaderNodeCategory("SH_NEW_OUTPUT", "Output", items=[ NodeItem("ShaderNodeOutputMaterial", poll=object_eevee_cycles_shader_nodes_poll), NodeItem("ShaderNodeOutputLight", poll=object_cycles_shader_nodes_poll), - NodeItem("ShaderNodeOutputAOV", poll=cycles_aov_node_poll), + NodeItem("ShaderNodeOutputAOV"), NodeItem("ShaderNodeOutputWorld", poll=world_shader_nodes_poll), NodeItem("ShaderNodeOutputLineStyle", poll=line_style_shader_nodes_poll), NodeItem("NodeGroupOutput", poll=group_input_output_item_poll), |