Refactoring of Storm Hydra render addon #13

Merged
Bogdan Nagirniak merged 8 commits from BLEN-413 into storm-hydra-addon 2023-06-01 02:36:50 +02:00
7 changed files with 111 additions and 99 deletions

View File

@ -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"
}

View File

@ -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,

View File

@ -1,3 +0,0 @@
{
"Includes": [ "usd/*/resources/" ]
}

View File

@ -1,22 +0,0 @@
{
"Plugins": [
{
"Info": {
"Types": {
"HdStormRendererPlugin": {
"bases": [
"HdRendererPlugin"
],
"displayName": "GL",
"priority": 0
}
}
},
"LibraryPath": "",
"Name": "hdStorm",
"ResourcePath": "resources",
"Root": "..",
"Type": "library"
}
]
}

View File

@ -1,3 +0,0 @@
{
"Includes": [ "*/resources/" ]
}

View File

@ -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):
BogdanNagirniak marked this conversation as resolved Outdated

Rename to RenderProperties as more related

Rename to `RenderProperties` as more related
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",
DagerD marked this conversation as resolved Outdated

Same as above.

Same as above.
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,
))

View File

@ -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',