From ca533a9ebed6f17351e191977a47ea21347e7586 Mon Sep 17 00:00:00 2001 From: Bogdan Nagirniak <33626169+bnagirniak@users.noreply.github.com> Date: Tue, 7 Feb 2023 19:40:15 +0200 Subject: [PATCH 01/21] BLEN-327: Add Storm Hydra render addon to blender_addons repo. (#19) Added code --- hydra_storm/__init__.py | 36 ++++++++ hydra_storm/engine.py | 33 +++++++ hydra_storm/properties.py | 57 ++++++++++++ hydra_storm/ui.py | 176 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 302 insertions(+) create mode 100644 hydra_storm/__init__.py create mode 100644 hydra_storm/engine.py create mode 100644 hydra_storm/properties.py create mode 100644 hydra_storm/ui.py diff --git a/hydra_storm/__init__.py b/hydra_storm/__init__.py new file mode 100644 index 000000000..f75a59b2c --- /dev/null +++ b/hydra_storm/__init__.py @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2011-2022 Blender Foundation + +# + + +bl_info = { + "name": "Hydra render engine: Storm", + "author": "AMD", + "version": (1, 0, 0), + "blender": (3, 5, 0), + "location": "Info header > Render engine menu", + "description": "Storm GL delegate for Hydra render engine", + "tracker_url": "", + "doc_url": "", + "community": "", + "downloads": "", + "main_web": "", + "support": 'TESTING', + "category": "Render" +} + + +from . import engine, properties, ui + + +def register(): + engine.register() + properties.register() + ui.register() + + +def unregister(): + ui.unregister() + properties.unregister() + engine.unregister() diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py new file mode 100644 index 000000000..4abaf35d1 --- /dev/null +++ b/hydra_storm/engine.py @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2011-2022 Blender Foundation + +# + +import bpy +from hydra import HydraRenderEngine + + +class StormHydraRenderEngine(HydraRenderEngine): + bl_idname = 'StormHydraRenderEngine' + bl_label = "Hydra: Storm" + bl_info = "Hydra Storm (OpenGL) render delegate" + + bl_use_preview = False + bl_use_gpu_context = True + + delegate_id = 'HdStormRendererPlugin' + + def get_delegate_settings(self, engine_type): + settings = bpy.context.scene.hydra_storm + return { + 'enableTinyPrimCulling': settings.enable_tiny_prim_culling, + 'volumeRaymarchingStepSize': settings.volume_raymarching_step_size, + 'volumeRaymarchingStepSizeLighting': settings.volume_raymarching_step_size_lighting, + 'volumeMaxTextureMemoryPerField': settings.volume_max_texture_memory_per_field, + 'maxLights': settings.max_lights, + } + + +register, unregister = bpy.utils.register_classes_factory(( + StormHydraRenderEngine, +)) diff --git a/hydra_storm/properties.py b/hydra_storm/properties.py new file mode 100644 index 000000000..1200a5ec1 --- /dev/null +++ b/hydra_storm/properties.py @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2011-2022 Blender Foundation + +# + +import bpy + + +class Properties(bpy.types.PropertyGroup): + bl_type = None + + @classmethod + def register(cls): + cls.bl_type.hydra_storm = bpy.props.PointerProperty( + name="Hydra Storm", + description="Hydra Storm properties", + type=cls, + ) + + @classmethod + def unregister(cls): + del cls.bl_type.hydra_storm + + +class SceneProperties(Properties): + bl_type = bpy.types.Scene + + enable_tiny_prim_culling: bpy.props.BoolProperty( + name="Tiny Prim Culling", + description="Enable Tiny Prim Culling", + default=False, + ) + volume_raymarching_step_size: bpy.props.FloatProperty( + name="Volume Raymarching Step Size", + description="Step size when raymarching volume", + default=1.0, + ) + volume_raymarching_step_size_lighting: bpy.props.FloatProperty( + name="Volume Raymarching Step Size", + description="Step size when raymarching volume for lighting computation", + default=10.0, + ) + volume_max_texture_memory_per_field: bpy.props.FloatProperty( + name="Volume Max Texture Memory Per Field", + description="Maximum memory for a volume field texture in Mb (unless overridden by field prim)", + default=128.0, + ) + max_lights: bpy.props.IntProperty( + name="Max Lights", + description="Maximum number of lights", + default=16, min=0, + ) + + +register, unregister = bpy.utils.register_classes_factory(( + SceneProperties, +)) diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py new file mode 100644 index 000000000..a7ca58b2f --- /dev/null +++ b/hydra_storm/ui.py @@ -0,0 +1,176 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2011-2022 Blender Foundation + +# + +import bpy + +from .engine import StormHydraRenderEngine + + +class Panel(bpy.types.Panel): + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = 'render' + COMPAT_ENGINES = {StormHydraRenderEngine.bl_idname} + + @classmethod + def poll(cls, context): + return context.engine in cls.COMPAT_ENGINES + + +class STORM_HYDRA_RENDER_PT_render_settings(Panel): + """Final render delegate and settings""" + bl_label = "Storm Render Settings" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + settings = context.scene.hydra_storm + layout.prop(settings, 'enable_tiny_prim_culling') + layout.prop(settings, 'max_lights') + + +class STORM_HYDRA_LIGHT_PT_light(Panel): + """ + Physical light sources + """ + bl_label = "Light" + bl_context = 'data' + + @classmethod + def poll(cls, context): + return super().poll(context) and context.light + + def draw(self, context): + layout = self.layout + + light = context.light + + layout.prop(light, "type", expand=True) + + layout.use_property_split = True + layout.use_property_decorate = False + + main_col = layout.column() + + main_col.prop(light, "color") + main_col.prop(light, "energy") + main_col.separator() + + if light.type == 'POINT': + row = main_col.row(align=True) + row.prop(light, "shadow_soft_size", text="Radius") + + elif light.type == 'SPOT': + col = main_col.column(align=True) + col.prop(light, 'spot_size', slider=True) + col.prop(light, 'spot_blend', slider=True) + + main_col.prop(light, 'show_cone') + + elif light.type == 'SUN': + main_col.prop(light, "angle") + + elif light.type == 'AREA': + main_col.prop(light, "shape", text="Shape") + sub = main_col.column(align=True) + + if light.shape in {'SQUARE', 'DISK'}: + sub.prop(light, "size") + elif light.shape in {'RECTANGLE', 'ELLIPSE'}: + sub.prop(light, "size", text="Size X") + sub.prop(light, "size_y", text="Y") + + else: + main_col.prop(light, 'size') + + + +register_classes, unregister_classes = bpy.utils.register_classes_factory(( + STORM_HYDRA_RENDER_PT_render_settings, + STORM_HYDRA_LIGHT_PT_light, +)) + + +def get_panels(): + # follow the Cycles model of excluding panels we don't want + exclude_panels = { + 'DATA_PT_area', + 'DATA_PT_falloff_curve', + 'DATA_PT_shadow', + 'DATA_PT_spot', + 'DATA_PT_sunsky', + 'DATA_PT_light', + 'MATERIAL_PT_diffuse', + 'MATERIAL_PT_flare', + 'MATERIAL_PT_halo', + 'MATERIAL_PT_mirror', + 'MATERIAL_PT_options', + 'MATERIAL_PT_pipeline', + 'MATERIAL_PT_shading', + 'MATERIAL_PT_shadow', + 'MATERIAL_PT_specular', + 'MATERIAL_PT_sss', + 'MATERIAL_PT_strand', + 'MATERIAL_PT_transp', + 'MATERIAL_PT_volume_density', + 'MATERIAL_PT_volume_integration', + 'MATERIAL_PT_volume_lighting', + 'MATERIAL_PT_volume_options', + 'MATERIAL_PT_volume_shading', + 'MATERIAL_PT_volume_transp', + 'RENDERLAYER_PT_layer_options', + 'RENDERLAYER_PT_layer_passes', + 'RENDERLAYER_PT_views', + 'RENDER_PT_antialiasing', + 'RENDER_PT_bake', + 'RENDER_PT_motion_blur', + 'RENDER_PT_performance', + 'RENDER_PT_freestyle', + 'RENDER_PT_post_processing', + 'RENDER_PT_shading', + 'RENDER_PT_simplify', + 'RENDER_PT_stamp', + 'SCENE_PT_simplify', + 'SCENE_PT_audio', + 'WORLD_PT_ambient_occlusion', + 'WORLD_PT_environment_lighting', + 'WORLD_PT_gather', + 'WORLD_PT_indirect_lighting', + 'WORLD_PT_mist', + 'WORLD_PT_preview', + 'WORLD_PT_world', + 'NODE_DATA_PT_light', + } + include_eevee_panels = { + 'MATERIAL_PT_preview', + 'EEVEE_MATERIAL_PT_context_material', + 'EEVEE_MATERIAL_PT_surface', + 'EEVEE_MATERIAL_PT_volume', + 'EEVEE_MATERIAL_PT_settings', + } + + for panel_cls in bpy.types.Panel.__subclasses__(): + if hasattr(panel_cls, 'COMPAT_ENGINES') and ( + ('BLENDER_RENDER' in panel_cls.COMPAT_ENGINES and panel_cls.__name__ not in exclude_panels) or + ('BLENDER_EEVEE' in panel_cls.COMPAT_ENGINES and panel_cls.__name__ in include_eevee_panels) + ): + yield panel_cls + + +def register(): + register_classes() + + for panel_cls in get_panels(): + panel_cls.COMPAT_ENGINES.add(StormHydraRenderEngine.bl_idname) + + +def unregister(): + unregister_classes() + + for panel_cls in get_panels(): + if StormHydraRenderEngine.bl_idname in panel_cls.COMPAT_ENGINES: + panel_cls.COMPAT_ENGINES.remove(StormHydraRenderEngine.bl_idname) -- 2.30.2 From a838c964e4d6665e19fd92f45cee6600cf5b9dcf Mon Sep 17 00:00:00 2001 From: Georgiy Markelov Date: Fri, 17 Feb 2023 13:46:18 +0100 Subject: [PATCH 02/21] BLEN-335: Export environment light Added EEVEE world light panel Co-authored-by: georgiy.m.markelov@gmail.com Pull Request #1 --- hydra_storm/ui.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index a7ca58b2f..7051079d3 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -88,9 +88,9 @@ class STORM_HYDRA_LIGHT_PT_light(Panel): main_col.prop(light, 'size') - register_classes, unregister_classes = bpy.utils.register_classes_factory(( STORM_HYDRA_RENDER_PT_render_settings, + STORM_HYDRA_LIGHT_PT_light, )) @@ -151,6 +151,7 @@ def get_panels(): 'EEVEE_MATERIAL_PT_surface', 'EEVEE_MATERIAL_PT_volume', 'EEVEE_MATERIAL_PT_settings', + 'EEVEE_WORLD_PT_surface', } for panel_cls in bpy.types.Panel.__subclasses__(): -- 2.30.2 From f39b21d4906e66785b8c215f6661357f32d09e0d Mon Sep 17 00:00:00 2001 From: Bogdan Nagirniak Date: Thu, 16 Mar 2023 16:02:58 +0100 Subject: [PATCH 03/21] BLEN-368: Fixes in hydra.py Adjust code due rename module hydra.py -> bpy_hydra.py Pull Request #2 --- hydra_storm/engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 4abaf35d1..909908c7e 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -4,7 +4,7 @@ # import bpy -from hydra import HydraRenderEngine +from bpy_hydra import HydraRenderEngine class StormHydraRenderEngine(HydraRenderEngine): -- 2.30.2 From a5da05eac102741a94a892f1016cc46b541de9b6 Mon Sep 17 00:00:00 2001 From: Bogdan Nagirniak Date: Fri, 24 Mar 2023 18:10:03 +0100 Subject: [PATCH 04/21] Added plugin folder with hdStorm Added plugin/usd/hdStorm Pull Request #6 --- hydra_storm/engine.py | 12 ++++++++-- hydra_storm/plugin/plugInfo.json | 3 +++ .../usd/hdStorm/resources/plugInfo.json | 22 +++++++++++++++++++ hydra_storm/plugin/usd/plugInfo.json | 3 +++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 hydra_storm/plugin/plugInfo.json create mode 100644 hydra_storm/plugin/usd/hdStorm/resources/plugInfo.json create mode 100644 hydra_storm/plugin/usd/plugInfo.json diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 909908c7e..5fc1cab7f 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -3,11 +3,13 @@ # +from pathlib import Path + import bpy -from bpy_hydra import HydraRenderEngine +import bpy_hydra -class StormHydraRenderEngine(HydraRenderEngine): +class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): bl_idname = 'StormHydraRenderEngine' bl_label = "Hydra: Storm" bl_info = "Hydra Storm (OpenGL) render delegate" @@ -17,6 +19,12 @@ class StormHydraRenderEngine(HydraRenderEngine): delegate_id = 'HdStormRendererPlugin' + @classmethod + def register(cls): + super().register() + + bpy_hydra.register_plugins([str(Path(__file__).parent / "plugin")], []) + def get_delegate_settings(self, engine_type): settings = bpy.context.scene.hydra_storm return { diff --git a/hydra_storm/plugin/plugInfo.json b/hydra_storm/plugin/plugInfo.json new file mode 100644 index 000000000..45968d6c1 --- /dev/null +++ b/hydra_storm/plugin/plugInfo.json @@ -0,0 +1,3 @@ +{ + "Includes": [ "usd/*/resources/" ] +} \ No newline at end of file diff --git a/hydra_storm/plugin/usd/hdStorm/resources/plugInfo.json b/hydra_storm/plugin/usd/hdStorm/resources/plugInfo.json new file mode 100644 index 000000000..cd4ab743d --- /dev/null +++ b/hydra_storm/plugin/usd/hdStorm/resources/plugInfo.json @@ -0,0 +1,22 @@ +{ + "Plugins": [ + { + "Info": { + "Types": { + "HdStormRendererPlugin": { + "bases": [ + "HdRendererPlugin" + ], + "displayName": "GL", + "priority": 0 + } + } + }, + "LibraryPath": "", + "Name": "hdStorm", + "ResourcePath": "resources", + "Root": "..", + "Type": "library" + } + ] +} diff --git a/hydra_storm/plugin/usd/plugInfo.json b/hydra_storm/plugin/usd/plugInfo.json new file mode 100644 index 000000000..2e20f3d66 --- /dev/null +++ b/hydra_storm/plugin/usd/plugInfo.json @@ -0,0 +1,3 @@ +{ + "Includes": [ "*/resources/" ] +} -- 2.30.2 From f1bf91476c49db6f33a40694f30a2070b4d29319 Mon Sep 17 00:00:00 2001 From: Bogdan Nagirniak Date: Mon, 27 Mar 2023 16:04:40 +0300 Subject: [PATCH 05/21] Fixed bpy_hydra.register_plugins() call after https://projects.blender.org/BogdanNagirniak/blender/pulls/17 --- hydra_storm/engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 5fc1cab7f..a93925ba0 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -23,7 +23,7 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): def register(cls): super().register() - bpy_hydra.register_plugins([str(Path(__file__).parent / "plugin")], []) + bpy_hydra.register_plugins([str(Path(__file__).parent / "plugin")]) def get_delegate_settings(self, engine_type): settings = bpy.context.scene.hydra_storm -- 2.30.2 From 9dd076705ee8218b5a14d6091fd146e3ff3a9ca4 Mon Sep 17 00:00:00 2001 From: Bogdan Nagirniak Date: Fri, 19 May 2023 20:29:31 +0200 Subject: [PATCH 06/21] Create possibility to provide render settings via BlenderSceneDelegate. ### Purpose Required changes for https://projects.blender.org/BogdanNagirniak/blender/pulls/41 ### Technical steps Adjusted code: renamed function. Pull Request https://projects.blender.org/BogdanNagirniak/blender-addons/pulls/12 --- hydra_storm/engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index a93925ba0..222ce87cc 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -25,7 +25,7 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): bpy_hydra.register_plugins([str(Path(__file__).parent / "plugin")]) - def get_delegate_settings(self, engine_type): + def get_render_settings(self, engine_type): settings = bpy.context.scene.hydra_storm return { 'enableTinyPrimCulling': settings.enable_tiny_prim_culling, -- 2.30.2 From 163daadfdf1e8158d852173a280c2f140e6a6d40 Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Thu, 1 Jun 2023 02:36:49 +0200 Subject: [PATCH 07/21] Refactoring of Storm Hydra render addon ### Purpose Fix review comments and refactoring ### Technical steps * Added viewport settings * added properties to UI * various UI improvements Pull Request https://projects.blender.org/BogdanNagirniak/blender-addons/pulls/13 --- hydra_storm/__init__.py | 7 +- hydra_storm/engine.py | 13 +- hydra_storm/plugin/plugInfo.json | 3 - .../usd/hdStorm/resources/plugInfo.json | 22 --- hydra_storm/plugin/usd/plugInfo.json | 3 - hydra_storm/properties.py | 26 ++-- hydra_storm/ui.py | 136 +++++++++++------- 7 files changed, 111 insertions(+), 99 deletions(-) delete mode 100644 hydra_storm/plugin/plugInfo.json delete mode 100644 hydra_storm/plugin/usd/hdStorm/resources/plugInfo.json delete mode 100644 hydra_storm/plugin/usd/plugInfo.json diff --git a/hydra_storm/__init__.py b/hydra_storm/__init__.py index f75a59b2c..41fcbee99 100644 --- a/hydra_storm/__init__.py +++ b/hydra_storm/__init__.py @@ -5,18 +5,17 @@ bl_info = { - "name": "Hydra render engine: Storm", + "name": "Hydra Storm render engine", "author": "AMD", "version": (1, 0, 0), "blender": (3, 5, 0), - "location": "Info header > Render engine menu", - "description": "Storm GL delegate for Hydra render engine", + "description": "USD's high performance rasterizing renderer", "tracker_url": "", "doc_url": "", "community": "", "downloads": "", "main_web": "", - "support": 'TESTING', + "support": 'OFFICIAL', "category": "Render" } diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 222ce87cc..99dd764ec 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -11,22 +11,17 @@ import bpy_hydra class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): bl_idname = 'StormHydraRenderEngine' - bl_label = "Hydra: Storm" - bl_info = "Hydra Storm (OpenGL) render delegate" + bl_label = "Hydra Storm" + bl_info = "USD's high performance rasterizing renderer" bl_use_preview = False bl_use_gpu_context = True delegate_id = 'HdStormRendererPlugin' - @classmethod - def register(cls): - super().register() - - bpy_hydra.register_plugins([str(Path(__file__).parent / "plugin")]) - def get_render_settings(self, engine_type): - settings = bpy.context.scene.hydra_storm + settings = bpy.context.scene.hydra_storm.viewport if engine_type == 'VIEWPORT' else \ + bpy.context.scene.hydra_storm.final return { 'enableTinyPrimCulling': settings.enable_tiny_prim_culling, 'volumeRaymarchingStepSize': settings.volume_raymarching_step_size, diff --git a/hydra_storm/plugin/plugInfo.json b/hydra_storm/plugin/plugInfo.json deleted file mode 100644 index 45968d6c1..000000000 --- a/hydra_storm/plugin/plugInfo.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Includes": [ "usd/*/resources/" ] -} \ No newline at end of file diff --git a/hydra_storm/plugin/usd/hdStorm/resources/plugInfo.json b/hydra_storm/plugin/usd/hdStorm/resources/plugInfo.json deleted file mode 100644 index cd4ab743d..000000000 --- a/hydra_storm/plugin/usd/hdStorm/resources/plugInfo.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "Plugins": [ - { - "Info": { - "Types": { - "HdStormRendererPlugin": { - "bases": [ - "HdRendererPlugin" - ], - "displayName": "GL", - "priority": 0 - } - } - }, - "LibraryPath": "", - "Name": "hdStorm", - "ResourcePath": "resources", - "Root": "..", - "Type": "library" - } - ] -} diff --git a/hydra_storm/plugin/usd/plugInfo.json b/hydra_storm/plugin/usd/plugInfo.json deleted file mode 100644 index 2e20f3d66..000000000 --- a/hydra_storm/plugin/usd/plugInfo.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Includes": [ "*/resources/" ] -} diff --git a/hydra_storm/properties.py b/hydra_storm/properties.py index 1200a5ec1..ad29a5c40 100644 --- a/hydra_storm/properties.py +++ b/hydra_storm/properties.py @@ -7,11 +7,11 @@ import bpy class Properties(bpy.types.PropertyGroup): - bl_type = None + type = None @classmethod def register(cls): - cls.bl_type.hydra_storm = bpy.props.PointerProperty( + cls.type.hydra_storm = bpy.props.PointerProperty( name="Hydra Storm", description="Hydra Storm properties", type=cls, @@ -19,12 +19,10 @@ class Properties(bpy.types.PropertyGroup): @classmethod def unregister(cls): - del cls.bl_type.hydra_storm + del cls.type.hydra_storm -class SceneProperties(Properties): - bl_type = bpy.types.Scene - +class RenderProperties(bpy.types.PropertyGroup): enable_tiny_prim_culling: bpy.props.BoolProperty( name="Tiny Prim Culling", description="Enable Tiny Prim Culling", @@ -36,22 +34,30 @@ class SceneProperties(Properties): default=1.0, ) volume_raymarching_step_size_lighting: bpy.props.FloatProperty( - name="Volume Raymarching Step Size", + name="Volume Raymarching Step Size Lighting", description="Step size when raymarching volume for lighting computation", default=10.0, ) volume_max_texture_memory_per_field: bpy.props.FloatProperty( - name="Volume Max Texture Memory Per Field", + name="Max Texture Memory Per Field", description="Maximum memory for a volume field texture in Mb (unless overridden by field prim)", default=128.0, ) max_lights: bpy.props.IntProperty( name="Max Lights", - description="Maximum number of lights", - default=16, min=0, + description="Limit maximum number of lights", + default=16, min=0, max=16, ) +class SceneProperties(Properties): + type = bpy.types.Scene + + final: bpy.props.PointerProperty(type=RenderProperties) + viewport: bpy.props.PointerProperty(type=RenderProperties) + + register, unregister = bpy.utils.register_classes_factory(( + RenderProperties, SceneProperties, )) diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index 7051079d3..68ce9d1e9 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -19,20 +19,94 @@ class Panel(bpy.types.Panel): return context.engine in cls.COMPAT_ENGINES -class STORM_HYDRA_RENDER_PT_render_settings(Panel): +# +# FINAL RENDER SETTINGS +# +class STORM_HYDRA_RENDER_PT_final(Panel): """Final render delegate and settings""" - bl_label = "Storm Render Settings" + bl_idname = 'STORM_HYDRA_RENDER_PT_final' + bl_label = "Storm Final Settings" def draw(self, context): layout = self.layout layout.use_property_split = True layout.use_property_decorate = False - settings = context.scene.hydra_storm + settings = context.scene.hydra_storm.final layout.prop(settings, 'enable_tiny_prim_culling') layout.prop(settings, 'max_lights') +class FinalPanel(bpy.types.Panel): + bl_parent_id = STORM_HYDRA_RENDER_PT_final.bl_idname + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_options = {'DEFAULT_CLOSED'} + + def settings(self, context): + return context.scene.hydra_storm.final + + +class STORM_HYDRA_RENDER_PT_volume_final(FinalPanel): + bl_label = "Volume Raymarching" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + settings = self.settings(context) + + col = layout.column(align=True) + col.prop(settings, "volume_raymarching_step_size", text="Step Size") + col.prop(settings, "volume_raymarching_step_size_lighting", text="Step Size Lightning") + col.prop(settings, "volume_max_texture_memory_per_field") + + +# +# VIEWPORT RENDER SETTINGS +# +class STORM_HYDRA_RENDER_PT_viewport(Panel): + """Viewport render delegate and settings""" + bl_idname = 'STORM_HYDRA_RENDER_PT_viewport' + bl_label = "Storm Viewport Settings" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + settings = context.scene.hydra_storm.viewport + layout.prop(settings, 'enable_tiny_prim_culling') + layout.prop(settings, 'max_lights') + + +class ViewportPanel(bpy.types.Panel): + bl_parent_id = STORM_HYDRA_RENDER_PT_viewport.bl_idname + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_options = {'DEFAULT_CLOSED'} + + def settings(self, context): + return context.scene.hydra_storm.viewport + + +class STORM_HYDRA_RENDER_PT_volume_viewport(ViewportPanel): + bl_label = "Volume Raymarching" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + settings = self.settings(context) + + col = layout.column(align=True) + col.prop(settings, "volume_raymarching_step_size", text="Step Size") + col.prop(settings, "volume_raymarching_step_size_lighting", text="Step Size Lightning") + col.prop(settings, "volume_max_texture_memory_per_field") + + class STORM_HYDRA_LIGHT_PT_light(Panel): """ Physical light sources @@ -89,7 +163,10 @@ class STORM_HYDRA_LIGHT_PT_light(Panel): register_classes, unregister_classes = bpy.utils.register_classes_factory(( - STORM_HYDRA_RENDER_PT_render_settings, + STORM_HYDRA_RENDER_PT_final, + STORM_HYDRA_RENDER_PT_volume_final, + STORM_HYDRA_RENDER_PT_viewport, + STORM_HYDRA_RENDER_PT_volume_viewport, STORM_HYDRA_LIGHT_PT_light, )) @@ -98,52 +175,15 @@ register_classes, unregister_classes = bpy.utils.register_classes_factory(( def get_panels(): # follow the Cycles model of excluding panels we don't want exclude_panels = { - 'DATA_PT_area', - 'DATA_PT_falloff_curve', - 'DATA_PT_shadow', - 'DATA_PT_spot', - 'DATA_PT_sunsky', - 'DATA_PT_light', - 'MATERIAL_PT_diffuse', - 'MATERIAL_PT_flare', - 'MATERIAL_PT_halo', - 'MATERIAL_PT_mirror', - 'MATERIAL_PT_options', - 'MATERIAL_PT_pipeline', - 'MATERIAL_PT_shading', - 'MATERIAL_PT_shadow', - 'MATERIAL_PT_specular', - 'MATERIAL_PT_sss', - 'MATERIAL_PT_strand', - 'MATERIAL_PT_transp', - 'MATERIAL_PT_volume_density', - 'MATERIAL_PT_volume_integration', - 'MATERIAL_PT_volume_lighting', - 'MATERIAL_PT_volume_options', - 'MATERIAL_PT_volume_shading', - 'MATERIAL_PT_volume_transp', - 'RENDERLAYER_PT_layer_options', - 'RENDERLAYER_PT_layer_passes', - 'RENDERLAYER_PT_views', - 'RENDER_PT_antialiasing', - 'RENDER_PT_bake', - 'RENDER_PT_motion_blur', - 'RENDER_PT_performance', - 'RENDER_PT_freestyle', - 'RENDER_PT_post_processing', - 'RENDER_PT_shading', - 'RENDER_PT_simplify', 'RENDER_PT_stamp', - 'SCENE_PT_simplify', - 'SCENE_PT_audio', - 'WORLD_PT_ambient_occlusion', - 'WORLD_PT_environment_lighting', - 'WORLD_PT_gather', - 'WORLD_PT_indirect_lighting', - 'WORLD_PT_mist', - 'WORLD_PT_preview', - 'WORLD_PT_world', + 'DATA_PT_light', + 'DATA_PT_spot', 'NODE_DATA_PT_light', + 'DATA_PT_falloff_curve', + 'RENDER_PT_post_processing', + 'RENDER_PT_simplify', + 'SCENE_PT_audio', + 'RENDER_PT_freestyle' } include_eevee_panels = { 'MATERIAL_PT_preview', -- 2.30.2 From d06034c8351204e0d7bc31c25dd08f5f9859c73c Mon Sep 17 00:00:00 2001 From: Bogdan Nagirniak Date: Fri, 2 Jun 2023 15:55:43 +0200 Subject: [PATCH 08/21] Add possibility to render USD file for testing purposes ### Purpose For testing purposes it'll be useful to have possibility to render USD stage. ### Technical steps 1. Added `AddonPreferences` class with `dev_tools` setting. 2. Added `DevProperties` with USD render settings and `STORM_HYDRA_PT_dev` UI panel. 3. Added `StormHydraRenderEngine._sync_usd_stage()` to sync USD stage into render engine. ### Notes Works with https://projects.blender.org/BogdanNagirniak/blender/pulls/49 Pull Request https://projects.blender.org/BogdanNagirniak/blender-addons/pulls/14 --- hydra_storm/__init__.py | 4 ++- hydra_storm/engine.py | 26 ++++++++++++++++-- hydra_storm/preferences.py | 27 +++++++++++++++++++ hydra_storm/properties.py | 15 +++++++++++ hydra_storm/ui.py | 55 ++++++++++++++++++++++---------------- 5 files changed, 101 insertions(+), 26 deletions(-) create mode 100644 hydra_storm/preferences.py diff --git a/hydra_storm/__init__.py b/hydra_storm/__init__.py index 41fcbee99..3625b9c40 100644 --- a/hydra_storm/__init__.py +++ b/hydra_storm/__init__.py @@ -20,16 +20,18 @@ bl_info = { } -from . import engine, properties, ui +from . import engine, properties, ui, preferences def register(): engine.register() properties.register() ui.register() + preferences.register() def unregister(): + preferences.unregister() ui.unregister() properties.unregister() engine.unregister() diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 99dd764ec..93e463cd3 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -3,10 +3,13 @@ # -from pathlib import Path - import bpy import bpy_hydra +import _bpy_hydra + +from pxr import Usd + +from .preferences import addon_preferences class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): @@ -19,6 +22,17 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): delegate_id = 'HdStormRendererPlugin' + def __init__(self): + self._usd_stage = None + + def _sync_usd_stage(self): + preferences = addon_preferences() + dev = bpy.context.scene.hydra_storm.dev + if preferences.dev_tools and not self._usd_stage and dev.render_usd and dev.usd_file: + self._usd_stage = Usd.Stage.Open(dev.usd_file) + if self._usd_stage: + _bpy_hydra.engine_sync_usd(self.engine_ptr, self._usd_stage) + def get_render_settings(self, engine_type): settings = bpy.context.scene.hydra_storm.viewport if engine_type == 'VIEWPORT' else \ bpy.context.scene.hydra_storm.final @@ -30,6 +44,14 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): 'maxLights': settings.max_lights, } + def update(self, data, depsgraph): + super().update(data, depsgraph) + self._sync_usd_stage() + + def view_update(self, context, depsgraph): + super().view_update(context, depsgraph) + self._sync_usd_stage() + register, unregister = bpy.utils.register_classes_factory(( StormHydraRenderEngine, diff --git a/hydra_storm/preferences.py b/hydra_storm/preferences.py new file mode 100644 index 000000000..001072a80 --- /dev/null +++ b/hydra_storm/preferences.py @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright 2022, AMD + +import bpy + + +class AddonPreferences(bpy.types.AddonPreferences): + bl_idname = 'hydra_storm' + + dev_tools: bpy.props.BoolProperty( + name="Developer Tools", + description="Enable developer tools", + default=False, + ) + + def draw(self, context): + layout = self.layout + layout.prop(self, "dev_tools") + + +def addon_preferences(): + return bpy.context.preferences.addons['hydra_storm'].preferences + + +register, unregister = bpy.utils.register_classes_factory([ + AddonPreferences, +]) diff --git a/hydra_storm/properties.py b/hydra_storm/properties.py index ad29a5c40..1cbd78663 100644 --- a/hydra_storm/properties.py +++ b/hydra_storm/properties.py @@ -50,14 +50,29 @@ class RenderProperties(bpy.types.PropertyGroup): ) +class DevProperties(bpy.types.PropertyGroup): + render_usd: bpy.props.BoolProperty( + name="Render USD", + description="Render USD file with Blender scene", + default=False, + ) + usd_file: bpy.props.StringProperty( + name="USD File", + description="Select USD file to render", + subtype='FILE_PATH', + ) + + class SceneProperties(Properties): type = bpy.types.Scene final: bpy.props.PointerProperty(type=RenderProperties) viewport: bpy.props.PointerProperty(type=RenderProperties) + dev: bpy.props.PointerProperty(type=DevProperties) register, unregister = bpy.utils.register_classes_factory(( RenderProperties, + DevProperties, SceneProperties, )) diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index 68ce9d1e9..fc9e3ecb2 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -6,6 +6,7 @@ import bpy from .engine import StormHydraRenderEngine +from .preferences import addon_preferences class Panel(bpy.types.Panel): @@ -25,7 +26,7 @@ class Panel(bpy.types.Panel): class STORM_HYDRA_RENDER_PT_final(Panel): """Final render delegate and settings""" bl_idname = 'STORM_HYDRA_RENDER_PT_final' - bl_label = "Storm Final Settings" + bl_label = "Final Render Settings" def draw(self, context): layout = self.layout @@ -37,25 +38,19 @@ class STORM_HYDRA_RENDER_PT_final(Panel): layout.prop(settings, 'max_lights') -class FinalPanel(bpy.types.Panel): +class STORM_HYDRA_RENDER_PT_volume_final(bpy.types.Panel): bl_parent_id = STORM_HYDRA_RENDER_PT_final.bl_idname + bl_label = "Volume Raymarching" bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_options = {'DEFAULT_CLOSED'} - def settings(self, context): - return context.scene.hydra_storm.final - - -class STORM_HYDRA_RENDER_PT_volume_final(FinalPanel): - bl_label = "Volume Raymarching" - def draw(self, context): layout = self.layout layout.use_property_split = True layout.use_property_decorate = False - settings = self.settings(context) + settings = context.scene.hydra_storm.final col = layout.column(align=True) col.prop(settings, "volume_raymarching_step_size", text="Step Size") @@ -69,7 +64,7 @@ class STORM_HYDRA_RENDER_PT_volume_final(FinalPanel): class STORM_HYDRA_RENDER_PT_viewport(Panel): """Viewport render delegate and settings""" bl_idname = 'STORM_HYDRA_RENDER_PT_viewport' - bl_label = "Storm Viewport Settings" + bl_label = "Viewport Render Settings" def draw(self, context): layout = self.layout @@ -81,25 +76,19 @@ class STORM_HYDRA_RENDER_PT_viewport(Panel): layout.prop(settings, 'max_lights') -class ViewportPanel(bpy.types.Panel): +class STORM_HYDRA_RENDER_PT_volume_viewport(bpy.types.Panel): bl_parent_id = STORM_HYDRA_RENDER_PT_viewport.bl_idname + bl_label = "Volume Raymarching" bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_options = {'DEFAULT_CLOSED'} - def settings(self, context): - return context.scene.hydra_storm.viewport - - -class STORM_HYDRA_RENDER_PT_volume_viewport(ViewportPanel): - bl_label = "Volume Raymarching" - def draw(self, context): layout = self.layout layout.use_property_split = True layout.use_property_decorate = False - settings = self.settings(context) + settings = context.scene.hydra_storm.viewport col = layout.column(align=True) col.prop(settings, "volume_raymarching_step_size", text="Step Size") @@ -108,9 +97,7 @@ class STORM_HYDRA_RENDER_PT_volume_viewport(ViewportPanel): class STORM_HYDRA_LIGHT_PT_light(Panel): - """ - Physical light sources - """ + """Physical light sources""" bl_label = "Light" bl_context = 'data' @@ -162,11 +149,33 @@ class STORM_HYDRA_LIGHT_PT_light(Panel): main_col.prop(light, 'size') +class STORM_HYDRA_RENDER_PT_dev(Panel): + """Final render delegate and settings""" + bl_label = "Dev" + + @classmethod + def poll(cls, context): + return super().poll(context) and addon_preferences().dev_tools + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + dev = context.scene.hydra_storm.dev + col = layout.column() + col.prop(dev, 'render_usd') + row = col.row() + row.enabled = dev.render_usd + row.prop(dev, 'usd_file') + + register_classes, unregister_classes = bpy.utils.register_classes_factory(( STORM_HYDRA_RENDER_PT_final, STORM_HYDRA_RENDER_PT_volume_final, STORM_HYDRA_RENDER_PT_viewport, STORM_HYDRA_RENDER_PT_volume_viewport, + STORM_HYDRA_RENDER_PT_dev, STORM_HYDRA_LIGHT_PT_light, )) -- 2.30.2 From d1ed1d2df8e1bea6c9c176c89e317add4425e2d5 Mon Sep 17 00:00:00 2001 From: Bogdan Nagirniak Date: Tue, 4 Jul 2023 11:08:05 +0200 Subject: [PATCH 09/21] Fix crash when hydra render plugin isn't loaded. ### Purpose Need adjustments for https://projects.blender.org/BogdanNagirniak/blender/pulls/60 ### Technical steps Added checks of self.engine_ptr. Pull Request https://projects.blender.org/BogdanNagirniak/blender-addons/pulls/16 --- hydra_storm/engine.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 93e463cd3..da59db07b 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -46,11 +46,13 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): def update(self, data, depsgraph): super().update(data, depsgraph) - self._sync_usd_stage() + if self.engine_ptr: + self._sync_usd_stage() def view_update(self, context, depsgraph): super().view_update(context, depsgraph) - self._sync_usd_stage() + if self.engine_ptr: + self._sync_usd_stage() register, unregister = bpy.utils.register_classes_factory(( -- 2.30.2 From a3a317091fa13755875690fe0fe07a5f5fe9cad6 Mon Sep 17 00:00:00 2001 From: Bogdan Nagirniak Date: Thu, 13 Jul 2023 00:57:36 +0200 Subject: [PATCH 10/21] Fix rendering of Final render for Storm delegate. ### Purpose Engine creation for storm delegate has to be performed in `render()` function. ### Technical steps Moved engine creation and syncing to `render()` function, made `update()` empty. Pull Request https://projects.blender.org/BogdanNagirniak/blender-addons/pulls/17 --- hydra_storm/engine.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index da59db07b..3a7cce9c1 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -26,6 +26,9 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): self._usd_stage = None def _sync_usd_stage(self): + if not self.engine_ptr: + return + preferences = addon_preferences() dev = bpy.context.scene.hydra_storm.dev if preferences.dev_tools and not self._usd_stage and dev.render_usd and dev.usd_file: @@ -44,10 +47,9 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): 'maxLights': settings.max_lights, } - def update(self, data, depsgraph): - super().update(data, depsgraph) - if self.engine_ptr: - self._sync_usd_stage() + def _update(self, depsgraph): + super()._update(depsgraph) + self._sync_usd_stage() def view_update(self, context, depsgraph): super().view_update(context, depsgraph) -- 2.30.2 From 0020a934054ad6e9440e34e9cd210baf8fd65053 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 13 Jul 2023 10:27:53 +0200 Subject: [PATCH 11/21] Rename Hydra Storm idname for consistency Other render engines in Blender also uses caps and underscores. Pull Request #19 --- hydra_storm/engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 3a7cce9c1..c7e143a29 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -13,7 +13,7 @@ from .preferences import addon_preferences class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): - bl_idname = 'StormHydraRenderEngine' + bl_idname = 'HYDRA_STORM' bl_label = "Hydra Storm" bl_info = "USD's high performance rasterizing renderer" -- 2.30.2 From 3269f6b0e619001df61f4ff642b56b1f2dd79290 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 13 Jul 2023 16:47:31 +0200 Subject: [PATCH 12/21] Remove USD file development options, will be handled in Blender instead See BogdanNagirniak/blender#65 Pull Request #18 --- hydra_storm/engine.py | 24 ------------------------ hydra_storm/properties.py | 15 --------------- hydra_storm/ui.py | 22 ---------------------- 3 files changed, 61 deletions(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index c7e143a29..7b3fd02f1 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -22,20 +22,6 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): delegate_id = 'HdStormRendererPlugin' - def __init__(self): - self._usd_stage = None - - def _sync_usd_stage(self): - if not self.engine_ptr: - return - - preferences = addon_preferences() - dev = bpy.context.scene.hydra_storm.dev - if preferences.dev_tools and not self._usd_stage and dev.render_usd and dev.usd_file: - self._usd_stage = Usd.Stage.Open(dev.usd_file) - if self._usd_stage: - _bpy_hydra.engine_sync_usd(self.engine_ptr, self._usd_stage) - def get_render_settings(self, engine_type): settings = bpy.context.scene.hydra_storm.viewport if engine_type == 'VIEWPORT' else \ bpy.context.scene.hydra_storm.final @@ -47,16 +33,6 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): 'maxLights': settings.max_lights, } - def _update(self, depsgraph): - super()._update(depsgraph) - self._sync_usd_stage() - - def view_update(self, context, depsgraph): - super().view_update(context, depsgraph) - if self.engine_ptr: - self._sync_usd_stage() - - register, unregister = bpy.utils.register_classes_factory(( StormHydraRenderEngine, )) diff --git a/hydra_storm/properties.py b/hydra_storm/properties.py index 1cbd78663..ad29a5c40 100644 --- a/hydra_storm/properties.py +++ b/hydra_storm/properties.py @@ -50,29 +50,14 @@ class RenderProperties(bpy.types.PropertyGroup): ) -class DevProperties(bpy.types.PropertyGroup): - render_usd: bpy.props.BoolProperty( - name="Render USD", - description="Render USD file with Blender scene", - default=False, - ) - usd_file: bpy.props.StringProperty( - name="USD File", - description="Select USD file to render", - subtype='FILE_PATH', - ) - - class SceneProperties(Properties): type = bpy.types.Scene final: bpy.props.PointerProperty(type=RenderProperties) viewport: bpy.props.PointerProperty(type=RenderProperties) - dev: bpy.props.PointerProperty(type=DevProperties) register, unregister = bpy.utils.register_classes_factory(( RenderProperties, - DevProperties, SceneProperties, )) diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index fc9e3ecb2..649e777a7 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -149,33 +149,11 @@ class STORM_HYDRA_LIGHT_PT_light(Panel): main_col.prop(light, 'size') -class STORM_HYDRA_RENDER_PT_dev(Panel): - """Final render delegate and settings""" - bl_label = "Dev" - - @classmethod - def poll(cls, context): - return super().poll(context) and addon_preferences().dev_tools - - def draw(self, context): - layout = self.layout - layout.use_property_split = True - layout.use_property_decorate = False - - dev = context.scene.hydra_storm.dev - col = layout.column() - col.prop(dev, 'render_usd') - row = col.row() - row.enabled = dev.render_usd - row.prop(dev, 'usd_file') - - register_classes, unregister_classes = bpy.utils.register_classes_factory(( STORM_HYDRA_RENDER_PT_final, STORM_HYDRA_RENDER_PT_volume_final, STORM_HYDRA_RENDER_PT_viewport, STORM_HYDRA_RENDER_PT_volume_viewport, - STORM_HYDRA_RENDER_PT_dev, STORM_HYDRA_LIGHT_PT_light, )) -- 2.30.2 From e8ebd262de5674859474a81eb28aa89f9c239054 Mon Sep 17 00:00:00 2001 From: Vasyl-Pidhirskyi Date: Fri, 21 Jul 2023 11:28:51 +0200 Subject: [PATCH 13/21] PreviewEngine for Storm delegate ### Purpose Make available Strom delegate to utilize for material preview. ### Technical steps - Set attribute bl_use_preview to True. Pull Request https://projects.blender.org/BogdanNagirniak/blender-addons/pulls/20 --- hydra_storm/engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 7b3fd02f1..33db2b2bb 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -17,7 +17,7 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): bl_label = "Hydra Storm" bl_info = "USD's high performance rasterizing renderer" - bl_use_preview = False + bl_use_preview = True bl_use_gpu_context = True delegate_id = 'HdStormRendererPlugin' -- 2.30.2 From aa996bb9a5606f3cfd23c37c368e15f1469eb81e Mon Sep 17 00:00:00 2001 From: Vasyl-Pidhirskyi Date: Sun, 23 Jul 2023 21:01:36 +0200 Subject: [PATCH 14/21] Implement transparent background for Storm delegate ### Purpose Implement transparent background for Storm delegate ![image](/attachments/2e748faf-678a-4c91-b997-f3d8d416142b) ### Technical steps Implemented STORM_HYDRA_RENDER_PT_film. ### Notes for reviewers Should be reviewed with the pull request https://projects.blender.org/BogdanNagirniak/blender/pulls/71 Pull Request https://projects.blender.org/BogdanNagirniak/blender-addons/pulls/21 --- hydra_storm/engine.py | 6 +----- hydra_storm/ui.py | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 33db2b2bb..503042a03 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -5,11 +5,6 @@ import bpy import bpy_hydra -import _bpy_hydra - -from pxr import Usd - -from .preferences import addon_preferences class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): @@ -33,6 +28,7 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): 'maxLights': settings.max_lights, } + register, unregister = bpy.utils.register_classes_factory(( StormHydraRenderEngine, )) diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index 649e777a7..379f2cf2a 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -149,12 +149,26 @@ class STORM_HYDRA_LIGHT_PT_light(Panel): main_col.prop(light, 'size') +class STORM_HYDRA_RENDER_PT_film(bpy.types.Panel): + bl_label = "Film" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_options = {'DEFAULT_CLOSED'} + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + layout.prop(context.scene.render, "film_transparent", text="Transparent Background") + + register_classes, unregister_classes = bpy.utils.register_classes_factory(( STORM_HYDRA_RENDER_PT_final, STORM_HYDRA_RENDER_PT_volume_final, STORM_HYDRA_RENDER_PT_viewport, STORM_HYDRA_RENDER_PT_volume_viewport, - + STORM_HYDRA_RENDER_PT_film, STORM_HYDRA_LIGHT_PT_light, )) -- 2.30.2 From 3d328312edc9d9b428fbd024104ad3a1fd166d78 Mon Sep 17 00:00:00 2001 From: Vasyl-Pidhirskyi Date: Thu, 27 Jul 2023 13:36:56 +0200 Subject: [PATCH 15/21] Fixed wrong panel visibility. Fixed wrong panel visibility. Pull Request https://projects.blender.org/BogdanNagirniak/blender-addons/pulls/22 --- hydra_storm/ui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index 379f2cf2a..fb5c42bf9 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -149,7 +149,7 @@ class STORM_HYDRA_LIGHT_PT_light(Panel): main_col.prop(light, 'size') -class STORM_HYDRA_RENDER_PT_film(bpy.types.Panel): +class STORM_HYDRA_RENDER_PT_film(Panel): bl_label = "Film" bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' -- 2.30.2 From 06428dbce7a21710f4428565f454fc241f9b4c9d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 21 Jul 2023 18:39:10 +0200 Subject: [PATCH 16/21] Hydra Strom: update for change to bpy.types.HydraRenderEngine --- hydra_storm/engine.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 503042a03..e3286636e 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -4,10 +4,8 @@ # import bpy -import bpy_hydra - -class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): +class StormHydraRenderEngine(bpy.types.HydraRenderEngine): bl_idname = 'HYDRA_STORM' bl_label = "Hydra Storm" bl_info = "USD's high performance rasterizing renderer" @@ -15,7 +13,7 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): bl_use_preview = True bl_use_gpu_context = True - delegate_id = 'HdStormRendererPlugin' + bl_delegate_id = 'HdStormRendererPlugin' def get_render_settings(self, engine_type): settings = bpy.context.scene.hydra_storm.viewport if engine_type == 'VIEWPORT' else \ -- 2.30.2 From 8825714f0d042ab0326ed725fa7bdac41608816c Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Sat, 29 Jul 2023 14:58:35 +0200 Subject: [PATCH 17/21] Support more AOVs Added panels with AOVs to UI and overrided method `update_render_passes`. Pull Request https://projects.blender.org/BogdanNagirniak/blender-addons/pulls/23 --- hydra_storm/engine.py | 14 +++++++++++++- hydra_storm/ui.py | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index e3286636e..2989d905f 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -18,7 +18,7 @@ class StormHydraRenderEngine(bpy.types.HydraRenderEngine): def get_render_settings(self, engine_type): settings = bpy.context.scene.hydra_storm.viewport if engine_type == 'VIEWPORT' else \ bpy.context.scene.hydra_storm.final - return { + result = { 'enableTinyPrimCulling': settings.enable_tiny_prim_culling, 'volumeRaymarchingStepSize': settings.volume_raymarching_step_size, 'volumeRaymarchingStepSizeLighting': settings.volume_raymarching_step_size_lighting, @@ -26,6 +26,18 @@ class StormHydraRenderEngine(bpy.types.HydraRenderEngine): 'maxLights': settings.max_lights, } + if engine_type == 'FINAL': + result |= { + 'aovToken:Combined': "color", + 'aovToken:Depth': "depth", + } + + return result + + def update_render_passes(self, scene, render_layer): + if render_layer.use_pass_z: + self.register_pass(scene, render_layer, 'Depth', 1, 'Z', 'VALUE') + register, unregister = bpy.utils.register_classes_factory(( StormHydraRenderEngine, diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index fb5c42bf9..0e375a959 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -163,6 +163,30 @@ class STORM_HYDRA_RENDER_PT_film(Panel): layout.prop(context.scene.render, "film_transparent", text="Transparent Background") +class STORM_HYDRA_RENDER_PT_passes(Panel): + bl_label = "Passes" + bl_context = "view_layer" + + def draw(self, context): + pass + + +class STORM_HYDRA_RENDER_PT_passes_data(Panel): + bl_label = "Data" + bl_context = "view_layer" + bl_parent_id = "STORM_HYDRA_RENDER_PT_passes" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + view_layer = context.view_layer + + col = layout.column(heading="Include", align=True) + col.prop(view_layer, "use_pass_z") + + register_classes, unregister_classes = bpy.utils.register_classes_factory(( STORM_HYDRA_RENDER_PT_final, STORM_HYDRA_RENDER_PT_volume_final, @@ -170,6 +194,8 @@ register_classes, unregister_classes = bpy.utils.register_classes_factory(( STORM_HYDRA_RENDER_PT_volume_viewport, STORM_HYDRA_RENDER_PT_film, STORM_HYDRA_LIGHT_PT_light, + STORM_HYDRA_RENDER_PT_passes, + STORM_HYDRA_RENDER_PT_passes_data, )) -- 2.30.2 From 826675429ca292cdaeea4daf4fbfe2164b643aff Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 3 Aug 2023 15:37:36 +0200 Subject: [PATCH 18/21] Remove unused preferences --- hydra_storm/__init__.py | 4 +--- hydra_storm/preferences.py | 27 --------------------------- hydra_storm/ui.py | 1 - 3 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 hydra_storm/preferences.py diff --git a/hydra_storm/__init__.py b/hydra_storm/__init__.py index 3625b9c40..41fcbee99 100644 --- a/hydra_storm/__init__.py +++ b/hydra_storm/__init__.py @@ -20,18 +20,16 @@ bl_info = { } -from . import engine, properties, ui, preferences +from . import engine, properties, ui def register(): engine.register() properties.register() ui.register() - preferences.register() def unregister(): - preferences.unregister() ui.unregister() properties.unregister() engine.unregister() diff --git a/hydra_storm/preferences.py b/hydra_storm/preferences.py deleted file mode 100644 index 001072a80..000000000 --- a/hydra_storm/preferences.py +++ /dev/null @@ -1,27 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# Copyright 2022, AMD - -import bpy - - -class AddonPreferences(bpy.types.AddonPreferences): - bl_idname = 'hydra_storm' - - dev_tools: bpy.props.BoolProperty( - name="Developer Tools", - description="Enable developer tools", - default=False, - ) - - def draw(self, context): - layout = self.layout - layout.prop(self, "dev_tools") - - -def addon_preferences(): - return bpy.context.preferences.addons['hydra_storm'].preferences - - -register, unregister = bpy.utils.register_classes_factory([ - AddonPreferences, -]) diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index 0e375a959..e5f2e51f1 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -6,7 +6,6 @@ import bpy from .engine import StormHydraRenderEngine -from .preferences import addon_preferences class Panel(bpy.types.Panel): -- 2.30.2 From 584b8c95b97065569f2ee17e00af991888daeb28 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 3 Aug 2023 15:38:01 +0200 Subject: [PATCH 19/21] Bump Blender version to 4.0.0 --- hydra_storm/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra_storm/__init__.py b/hydra_storm/__init__.py index 41fcbee99..811296f69 100644 --- a/hydra_storm/__init__.py +++ b/hydra_storm/__init__.py @@ -8,7 +8,7 @@ bl_info = { "name": "Hydra Storm render engine", "author": "AMD", "version": (1, 0, 0), - "blender": (3, 5, 0), + "blender": (4, 0, 0), "description": "USD's high performance rasterizing renderer", "tracker_url": "", "doc_url": "", -- 2.30.2 From 193dda0a88e97e74bf55b502ed6572acfa104029 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 3 Aug 2023 15:40:04 +0200 Subject: [PATCH 20/21] Cleanup: comment style --- hydra_storm/ui.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index e5f2e51f1..44d220746 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -20,7 +20,7 @@ class Panel(bpy.types.Panel): # -# FINAL RENDER SETTINGS +# Final render settings # class STORM_HYDRA_RENDER_PT_final(Panel): """Final render delegate and settings""" @@ -58,7 +58,7 @@ class STORM_HYDRA_RENDER_PT_volume_final(bpy.types.Panel): # -# VIEWPORT RENDER SETTINGS +# Viewport render settings # class STORM_HYDRA_RENDER_PT_viewport(Panel): """Viewport render delegate and settings""" @@ -199,7 +199,7 @@ register_classes, unregister_classes = bpy.utils.register_classes_factory(( def get_panels(): - # follow the Cycles model of excluding panels we don't want + # Follow the Cycles model of excluding panels we don't want. exclude_panels = { 'RENDER_PT_stamp', 'DATA_PT_light', -- 2.30.2 From 91100257416f13e13a9c1a583a84595cc4407a05 Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Thu, 3 Aug 2023 19:27:27 +0200 Subject: [PATCH 21/21] Fix warning in console for HdStorm in preview render ### Purpose Fix warning in console for HdStorm in preview render: `WARN (hydra.render): final_engine.cc:58 render: Couldn't find AOV token for render pass: Combined` ### Technical steps Added passing tokens for preview render Pull Request https://projects.blender.org/BogdanNagirniak/blender-addons/pulls/27 --- hydra_storm/engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 2989d905f..8037746ff 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -26,7 +26,7 @@ class StormHydraRenderEngine(bpy.types.HydraRenderEngine): 'maxLights': settings.max_lights, } - if engine_type == 'FINAL': + if engine_type != 'VIEWPORT': result |= { 'aovToken:Combined': "color", 'aovToken:Depth': "depth", -- 2.30.2