Add possibility to render USD file for testing purposes #14

Merged
Bogdan Nagirniak merged 6 commits from BLEN-428 into storm-hydra-addon 2023-06-02 15:55:44 +02:00
7 changed files with 133 additions and 124 deletions
Showing only changes of commit 89ed9e2c4f - Show all commits

View File

@ -5,18 +5,17 @@
bl_info = { bl_info = {
"name": "Hydra render engine: Storm", "name": "Hydra Storm render engine",
"author": "AMD", "author": "AMD",
"version": (1, 0, 0), "version": (1, 0, 0),
"blender": (3, 5, 0), "blender": (3, 5, 0),
"location": "Info header > Render engine menu", "description": "USD's high performance rasterizing renderer",
"description": "Storm GL delegate for Hydra render engine",
"tracker_url": "", "tracker_url": "",
"doc_url": "", "doc_url": "",
"community": "", "community": "",
"downloads": "", "downloads": "",
"main_web": "", "main_web": "",
"support": 'TESTING', "support": 'OFFICIAL',
"category": "Render" "category": "Render"
} }

View File

@ -3,8 +3,6 @@
# <pep8 compliant> # <pep8 compliant>
from pathlib import Path
import bpy import bpy
import bpy_hydra import bpy_hydra
import _bpy_hydra import _bpy_hydra
@ -16,8 +14,8 @@ from .preferences import addon_preferences
class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine):
bl_idname = 'StormHydraRenderEngine' bl_idname = 'StormHydraRenderEngine'
bl_label = "Hydra: Storm" bl_label = "Hydra Storm"
bl_info = "Hydra Storm (OpenGL) render delegate" bl_info = "USD's high performance rasterizing renderer"
bl_use_preview = False bl_use_preview = False
bl_use_gpu_context = True bl_use_gpu_context = True
@ -37,13 +35,9 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine):
if self._usd_stage: if self._usd_stage:
_bpy_hydra.engine_sync_usd(self.engine_ptr, self._usd_stage) _bpy_hydra.engine_sync_usd(self.engine_ptr, self._usd_stage)
@classmethod
def register(cls):
super().register()
bpy_hydra.register_plugins([str(Path(__file__).parent / "plugin")])
def get_render_settings(self, engine_type): 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 { return {
'enableTinyPrimCulling': settings.enable_tiny_prim_culling, 'enableTinyPrimCulling': settings.enable_tiny_prim_culling,
'volumeRaymarchingStepSize': settings.volume_raymarching_step_size, 'volumeRaymarchingStepSize': settings.volume_raymarching_step_size,
@ -61,8 +55,6 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine):
self._sync_usd_stage() self._sync_usd_stage()
register, unregister = bpy.utils.register_classes_factory(( register, unregister = bpy.utils.register_classes_factory((
StormHydraRenderEngine, StormHydraRenderEngine,
)) ))

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): class Properties(bpy.types.PropertyGroup):
bl_type = None type = None
@classmethod @classmethod
def register(cls): def register(cls):
cls.bl_type.hydra_storm = bpy.props.PointerProperty( cls.type.hydra_storm = bpy.props.PointerProperty(
name="Hydra Storm", name="Hydra Storm",
description="Hydra Storm properties", description="Hydra Storm properties",
type=cls, type=cls,
@ -19,7 +19,35 @@ class Properties(bpy.types.PropertyGroup):
@classmethod @classmethod
def unregister(cls): def unregister(cls):
del cls.bl_type.hydra_storm del cls.type.hydra_storm
class RenderProperties(bpy.types.PropertyGroup):
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 Lighting",
description="Step size when raymarching volume for lighting computation",
default=10.0,
)
volume_max_texture_memory_per_field: bpy.props.FloatProperty(
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="Limit maximum number of lights",
default=16, min=0, max=16,
)
class DevProperties(bpy.types.PropertyGroup): class DevProperties(bpy.types.PropertyGroup):
@ -36,38 +64,15 @@ class DevProperties(bpy.types.PropertyGroup):
class SceneProperties(Properties): class SceneProperties(Properties):
bl_type = bpy.types.Scene 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,
)
final: bpy.props.PointerProperty(type=RenderProperties)
viewport: bpy.props.PointerProperty(type=RenderProperties)
dev: bpy.props.PointerProperty(type=DevProperties) dev: bpy.props.PointerProperty(type=DevProperties)
register, unregister = bpy.utils.register_classes_factory(( register, unregister = bpy.utils.register_classes_factory((
RenderProperties,
DevProperties, DevProperties,
SceneProperties, SceneProperties,
)) ))

View File

@ -20,20 +20,94 @@ class Panel(bpy.types.Panel):
return context.engine in cls.COMPAT_ENGINES 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""" """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): def draw(self, context):
layout = self.layout layout = self.layout
layout.use_property_split = True layout.use_property_split = True
layout.use_property_decorate = False 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, 'enable_tiny_prim_culling')
layout.prop(settings, 'max_lights') 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): class STORM_HYDRA_LIGHT_PT_light(Panel):
""" """
Physical light sources Physical light sources
@ -89,7 +163,7 @@ class STORM_HYDRA_LIGHT_PT_light(Panel):
main_col.prop(light, 'size') main_col.prop(light, 'size')
class STORM_HYDRA_PT_dev(Panel): class STORM_HYDRA_RENDER_PT_dev(Panel):
"""Final render delegate and settings""" """Final render delegate and settings"""
bl_label = "Dev" bl_label = "Dev"
@ -112,61 +186,28 @@ class STORM_HYDRA_PT_dev(Panel):
register_classes, unregister_classes = bpy.utils.register_classes_factory(( 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_RENDER_PT_dev,
STORM_HYDRA_LIGHT_PT_light, STORM_HYDRA_LIGHT_PT_light,
STORM_HYDRA_PT_dev,
)) ))
def get_panels(): 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 = { 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', 'RENDER_PT_stamp',
'SCENE_PT_simplify', 'DATA_PT_light',
'SCENE_PT_audio', 'DATA_PT_spot',
'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', 'NODE_DATA_PT_light',
'DATA_PT_falloff_curve',
'RENDER_PT_post_processing',
'RENDER_PT_simplify',
'SCENE_PT_audio',
'RENDER_PT_freestyle'
} }
include_eevee_panels = { include_eevee_panels = {
'MATERIAL_PT_preview', 'MATERIAL_PT_preview',