diff options
author | Matt Ebb <matt@mke3.net> | 2009-08-25 10:30:09 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2009-08-25 10:30:09 +0400 |
commit | a81b458dbde1b688170271b0e3978bb86c03f061 (patch) | |
tree | 35e6323331ea72eecb914f41ad3025a60d46c184 /release | |
parent | 33343fced5d7be2585228300392bfb3adde7ff2e (diff) | |
parent | ea97a373834ea956ad0778b2c535452a6ecb1752 (diff) |
* Volume Rendering
Finally in 2.5 branch :)
Still things to do, but will continue working in here. I won't bother
repeating the commit messages from the last year or so, however I've
written up some technical docs to help Ton/Brecht/etc review and find
their way around the code:
http://wiki.blender.org/index.php/User:Broken/VolumeRenderingDev
That above page has some known issues and todos listed, but I'm still
interested in bug reports.
Credits for this code:
* Matt Ebb
(with thanks to Red Cartel/ProMotion Studios)
* Raul Fernandez Hernandez (Farsthary) for patches:
o Light cache based multiple scattering approximation
o Initial voxeldata texture code
o Depth Cutoff threshold
* Andre Susano Pinto for BVH range lookup addition
* Trilinear interpolation adapted from pbrt
* Tricubic interpolation from libtricubic
Diffstat (limited to 'release')
-rw-r--r-- | release/ui/buttons_material.py | 141 | ||||
-rw-r--r-- | release/ui/buttons_texture.py | 130 |
2 files changed, 240 insertions, 31 deletions
diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py index eaba26c7e51..21201166eda 100644 --- a/release/ui/buttons_material.py +++ b/release/ui/buttons_material.py @@ -73,6 +73,9 @@ class MATERIAL_PT_shading(MaterialButtonsPanel): __label__ = "Shading" COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) + def poll(self, context): + return (context.material.type in ('SURFACE', 'WIRE', 'HALO')) + def draw(self, context): layout = self.layout @@ -83,7 +86,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel): if mat: - if mat.type in ('SURFACE', 'WIRE', 'VOLUME'): + if mat.type in ('SURFACE', 'WIRE'): split = layout.split() col = split.column() @@ -113,6 +116,9 @@ class MATERIAL_PT_strand(MaterialButtonsPanel): mat = context.material return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES) + def poll(self, context): + return context.material.type in ('SURFACE', 'WIRE', 'HALO') + def draw(self, context): layout = self.layout @@ -170,6 +176,9 @@ class MATERIAL_PT_options(MaterialButtonsPanel): __label__ = "Options" COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) + def poll(self, context): + return (context.material.type in ('SURFACE', 'WIRE', 'HALO')) + def draw(self, context): layout = self.layout @@ -204,6 +213,9 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel): __label__ = "Shadow" __default_closed__ = True COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) + + def poll(self, context): + return context.material.type in ('SURFACE', 'WIRE') def draw(self, context): layout = self.layout @@ -236,7 +248,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel): def poll(self, context): mat = context.material - return mat and (mat.type != 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES) + return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES) def draw(self, context): layout = self.layout @@ -290,7 +302,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel): def poll(self, context): mat = context.material - return mat and (mat.type != 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES) + return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES) def draw(self, context): layout = self.layout @@ -499,6 +511,125 @@ class MATERIAL_PT_transp(MaterialButtonsPanel): sub.active = rayt.gloss < 1 sub.itemR(rayt, "gloss_threshold", text="Threshold") sub.itemR(rayt, "gloss_samples", text="Samples") + +class MATERIAL_PT_volume_shading(MaterialButtonsPanel): + __label__ = "Shading" + __default_closed__ = False + COMPAT_ENGINES = set(['BLENDER_RENDER']) + + def poll(self, context): + return (context.material.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + mat = context.material + vol = context.material.volume + + split = layout.split() + + row = split.row() + row.itemR(vol, "density") + row.itemR(vol, "scattering") + + split = layout.split() + col = split.column() + col.itemR(vol, "absorption") + col.itemR(vol, "absorption_color", text="") + + + col = split.column() + col.itemR(vol, "emission") + col.itemR(vol, "emission_color", text="") + + + +class MATERIAL_PT_volume_scattering(MaterialButtonsPanel): + __label__ = "Scattering" + __default_closed__ = False + COMPAT_ENGINES = set(['BLENDER_RENDER']) + + def poll(self, context): + return (context.material.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + mat = context.material + vol = context.material.volume + + split = layout.split() + + col = split.column() + col.itemR(vol, "scattering_mode", text="") + if vol.scattering_mode == 'SINGLE_SCATTERING': + col.itemR(vol, "light_cache") + sub = col.column() + sub.active = vol.light_cache + sub.itemR(vol, "cache_resolution") + elif vol.scattering_mode in ('MULTIPLE_SCATTERING', 'SINGLE_PLUS_MULTIPLE_SCATTERING'): + col.itemR(vol, "cache_resolution") + + col = col.column(align=True) + col.itemR(vol, "ms_diffusion") + col.itemR(vol, "ms_spread") + col.itemR(vol, "ms_intensity") + + col = split.column() + # col.itemL(text="Anisotropic Scattering:") + col.itemR(vol, "phase_function", text="") + if vol.phase_function in ('SCHLICK', 'HENYEY-GREENSTEIN'): + col.itemR(vol, "asymmetry") + +class MATERIAL_PT_volume_transp(MaterialButtonsPanel): + __label__= "Transparency" + COMPAT_ENGINES = set(['BLENDER_RENDER']) + + def poll(self, context): + mat = context.material + return mat and (mat.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES) + + def draw_header(self, context): + layout = self.layout + + def draw(self, context): + layout = self.layout + + mat = context.material + rayt = context.material.raytrace_transparency + + row= layout.row() + row.itemR(mat, "transparency_method", expand=True) + row.active = mat.transparency and (not mat.shadeless) + +class MATERIAL_PT_volume_integration(MaterialButtonsPanel): + __label__ = "Integration" + __default_closed__ = False + COMPAT_ENGINES = set(['BLENDER_RENDER']) + + def poll(self, context): + return (context.material.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + mat = context.material + vol = context.material.volume + + split = layout.split() + + col = split.column() + col.itemL(text="Step Calculation:") + col.itemR(vol, "step_calculation", text="") + col = col.column(align=True) + col.itemR(vol, "step_size") + col.itemR(vol, "shading_step_size") + + col = split.column() + col.itemL() + col.itemR(vol, "depth_cutoff") + col.itemR(vol, "density_scale") + class MATERIAL_PT_halo(MaterialButtonsPanel): __label__= "Halo" @@ -587,6 +718,10 @@ bpy.types.register(MATERIAL_PT_shading) bpy.types.register(MATERIAL_PT_transp) bpy.types.register(MATERIAL_PT_mirror) bpy.types.register(MATERIAL_PT_sss) +bpy.types.register(MATERIAL_PT_volume_shading) +bpy.types.register(MATERIAL_PT_volume_scattering) +bpy.types.register(MATERIAL_PT_volume_transp) +bpy.types.register(MATERIAL_PT_volume_integration) bpy.types.register(MATERIAL_PT_halo) bpy.types.register(MATERIAL_PT_flare) bpy.types.register(MATERIAL_PT_physics) diff --git a/release/ui/buttons_texture.py b/release/ui/buttons_texture.py index 20b3c7bca3e..4827f677336 100644 --- a/release/ui/buttons_texture.py +++ b/release/ui/buttons_texture.py @@ -210,35 +210,51 @@ class TEXTURE_PT_influence(TextureSlotPanel): sub.itemR(tex, factor, text=name, slider=True) if ma: - split = layout.split() - - col = split.column() - col.itemL(text="Diffuse:") - factor_but(col, tex.map_diffuse, "map_diffuse", "diffuse_factor", "Intensity") - factor_but(col, tex.map_colordiff, "map_colordiff", "colordiff_factor", "Color") - factor_but(col, tex.map_alpha, "map_alpha", "alpha_factor", "Alpha") - factor_but(col, tex.map_translucency, "map_translucency", "translucency_factor", "Translucency") - - col.itemL(text="Specular:") - factor_but(col, tex.map_specular, "map_specular", "specular_factor", "Intensity") - factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color") - factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness") + if ma.type in ['SURFACE', 'HALO', 'WIRE']: + split = layout.split() + + col = split.column() + col.itemL(text="Diffuse:") + factor_but(col, tex.map_diffuse, "map_diffuse", "diffuse_factor", "Intensity") + factor_but(col, tex.map_colordiff, "map_colordiff", "colordiff_factor", "Color") + factor_but(col, tex.map_alpha, "map_alpha", "alpha_factor", "Alpha") + factor_but(col, tex.map_translucency, "map_translucency", "translucency_factor", "Translucency") + + col.itemL(text="Specular:") + factor_but(col, tex.map_specular, "map_specular", "specular_factor", "Intensity") + factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color") + factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness") + + col = split.column() + col.itemL(text="Shading:") + factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient") + factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit") + factor_but(col, tex.map_mirror, "map_mirror", "mirror_factor", "Mirror") + factor_but(col, tex.map_raymir, "map_raymir", "raymir_factor", "Ray Mirror") + + col.itemL(text="Geometry:") + factor_but(col, tex.map_normal, "map_normal", "normal_factor", "Normal") + factor_but(col, tex.map_warp, "map_warp", "warp_factor", "Warp") + factor_but(col, tex.map_displacement, "map_displacement", "displacement_factor", "Displace") + + #sub = col.column() + #sub.active = tex.map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror + #sub.itemR(tex, "default_value", text="Amount", slider=True) + elif ma.type == 'VOLUME': + split = layout.split() + + col = split.column() + factor_but(col, tex.map_density, "map_density", "density_factor", "Density") + factor_but(col, tex.map_emission, "map_emission", "emission_factor", "Emission") + factor_but(col, tex.map_absorption, "map_absorption", "absorption_factor", "Absorption") + factor_but(col, tex.map_scattering, "map_scattering", "scattering_factor", "Scattering") + + col = split.column() + col.itemL(text=" ") + factor_but(col, tex.map_alpha, "map_coloremission", "coloremission_factor", "Emission Color") + factor_but(col, tex.map_colorabsorption, "map_colorabsorption", "colorabsorption_factor", "Absorption Color") + - col = split.column() - col.itemL(text="Shading:") - factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient") - factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit") - factor_but(col, tex.map_mirror, "map_mirror", "mirror_factor", "Mirror") - factor_but(col, tex.map_raymir, "map_raymir", "raymir_factor", "Ray Mirror") - - col.itemL(text="Geometry:") - factor_but(col, tex.map_normal, "map_normal", "normal_factor", "Normal") - factor_but(col, tex.map_warp, "map_warp", "warp_factor", "Warp") - factor_but(col, tex.map_displacement, "map_displacement", "displacement_factor", "Displace") - - #sub = col.column() - #sub.active = tex.map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror - #sub.itemR(tex, "default_value", text="Amount", slider=True) elif la: row = layout.row() factor_but(row, tex.map_color, "map_color", "color_factor", "Color") @@ -596,6 +612,62 @@ class TEXTURE_PT_distortednoise(TextureTypePanel): flow.itemR(tex, "distortion_amount", text="Distortion") flow.itemR(tex, "noise_size", text="Size") flow.itemR(tex, "nabla") + +class TEXTURE_PT_voxeldata(TextureButtonsPanel): + __idname__= "TEXTURE_PT_voxeldata" + __label__ = "Voxel Data" + + def poll(self, context): + tex = context.texture + return (tex and tex.type == 'VOXEL_DATA') + + def draw(self, context): + layout = self.layout + tex = context.texture + vd = tex.voxeldata + + layout.itemR(vd, "file_format") + if vd.file_format in ['BLENDER_VOXEL', 'RAW_8BIT']: + layout.itemR(vd, "source_path") + if vd.file_format == 'RAW_8BIT': + layout.itemR(vd, "resolution") + if vd.file_format == 'SMOKE': + layout.itemR(vd, "domain_object") + + layout.itemR(vd, "still") + if vd.still: + layout.itemR(vd, "still_frame_number") + + layout.itemR(vd, "interpolation") + layout.itemR(vd, "intensity") + +class TEXTURE_PT_pointdensity(TextureButtonsPanel): + __idname__= "TEXTURE_PT_pointdensity" + __label__ = "Point Density" + + def poll(self, context): + tex = context.texture + return (tex and tex.type == 'POINT_DENSITY') + + def draw(self, context): + layout = self.layout + tex = context.texture + pd = tex.pointdensity + + layout.itemR(pd, "point_source") + layout.itemR(pd, "object") + if pd.point_source == 'PARTICLE_SYSTEM': + layout.item_pointerR(pd, "particle_system", pd.object, "particle_systems", text="") + layout.itemR(pd, "radius") + layout.itemR(pd, "falloff") + if pd.falloff == 'SOFT': + layout.itemR(pd, "falloff_softness") + layout.itemR(pd, "color_source") + layout.itemR(pd, "turbulence") + layout.itemR(pd, "turbulence_size") + layout.itemR(pd, "turbulence_depth") + layout.itemR(pd, "turbulence_influence") + bpy.types.register(TEXTURE_PT_context_texture) bpy.types.register(TEXTURE_PT_preview) @@ -613,6 +685,8 @@ bpy.types.register(TEXTURE_PT_envmap) bpy.types.register(TEXTURE_PT_musgrave) bpy.types.register(TEXTURE_PT_voronoi) bpy.types.register(TEXTURE_PT_distortednoise) +bpy.types.register(TEXTURE_PT_voxeldata) +bpy.types.register(TEXTURE_PT_pointdensity) bpy.types.register(TEXTURE_PT_colors) bpy.types.register(TEXTURE_PT_mapping) bpy.types.register(TEXTURE_PT_influence) |