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/scripts/startup/bl_ui | |
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/scripts/startup/bl_ui')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_view_layer.py | 50 |
1 files changed, 44 insertions, 6 deletions
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. |