Storm Hydra render addon #104597
36
hydra_storm/__init__.py
Normal file
36
hydra_storm/__init__.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# Copyright 2011-2022 Blender Foundation
|
||||||
|
|
||||||
|
# <pep8 compliant>
|
||||||
|
|
||||||
|
|
||||||
|
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",
|
||||||
brecht marked this conversation as resolved
|
|||||||
|
"tracker_url": "",
|
||||||
|
"doc_url": "",
|
||||||
|
"community": "",
|
||||||
|
"downloads": "",
|
||||||
|
"main_web": "",
|
||||||
|
"support": 'TESTING',
|
||||||
brecht marked this conversation as resolved
Brecht Van Lommel
commented
TESTING -> OFFICIAL TESTING -> OFFICIAL
|
|||||||
|
"category": "Render"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
from . import engine, properties, ui
|
||||||
|
|
||||||
|
|
||||||
|
def register():
|
||||||
|
engine.register()
|
||||||
|
properties.register()
|
||||||
|
ui.register()
|
||||||
|
|
||||||
|
|
||||||
|
def unregister():
|
||||||
|
ui.unregister()
|
||||||
|
properties.unregister()
|
||||||
|
engine.unregister()
|
33
hydra_storm/engine.py
Normal file
33
hydra_storm/engine.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# Copyright 2011-2022 Blender Foundation
|
||||||
|
|
||||||
|
# <pep8 compliant>
|
||||||
|
|
||||||
|
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,
|
||||||
|
))
|
57
hydra_storm/properties.py
Normal file
57
hydra_storm/properties.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# Copyright 2011-2022 Blender Foundation
|
||||||
|
|
||||||
|
# <pep8 compliant>
|
||||||
|
|
||||||
|
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",
|
||||||
brecht marked this conversation as resolved
Brecht Van Lommel
commented
This is name should not be identical to the one for volume_raymarching_step_size This is name should not be identical to the one for 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",
|
||||||
brecht marked this conversation as resolved
Brecht Van Lommel
commented
What happens when the maximum is reach? Why is the default only 16? This needs a better explanation in the description. What happens when the maximum is reach? Why is the default only 16? This needs a better explanation in the description.
Georgiy Markelov
commented
It comes from source code https://github.com/PixarAnimationStudios/USD/blob/release/pxr/imaging/hdSt/renderDelegate.cpp#L70 It comes from source code https://github.com/PixarAnimationStudios/USD/blob/release/pxr/imaging/hdSt/renderDelegate.cpp#L70
Brecht Van Lommel
commented
Can you figure out what it does so it can be explained in the description for users? Can you figure out what it does so it can be explained in the description for users?
|
|||||||
|
default=16, min=0,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
register, unregister = bpy.utils.register_classes_factory((
|
||||||
|
SceneProperties,
|
||||||
|
))
|
176
hydra_storm/ui.py
Normal file
176
hydra_storm/ui.py
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# Copyright 2011-2022 Blender Foundation
|
||||||
|
|
||||||
|
# <pep8 compliant>
|
||||||
|
|
||||||
|
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',
|
||||||
brecht marked this conversation as resolved
Brecht Van Lommel
commented
The list in The list in `intern/cycles/blender/addon/ui.py` is much shorter, and many of these panels no longer exist. So this seems outdated?
Georgiy Markelov
commented
We also hide some extra panels. We also hide some extra panels.
|
|||||||
|
}
|
||||||
|
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)
|
Loading…
Reference in New Issue
Block a user
"GL" is not accurate for Metal and Vulkan.
I'm also not sure "Storm GL delegate for Hydra render engine" means.