homogeneous medium configuration in the plugin
parent
be4cba85bb
commit
b110f8c374
|
@ -458,7 +458,7 @@ class MtsExporter:
|
||||||
self.closeElement()
|
self.closeElement()
|
||||||
|
|
||||||
def exportMediumReference(self, scene, obj, role, mediumName):
|
def exportMediumReference(self, scene, obj, role, mediumName):
|
||||||
if medium == "":
|
if mediumName == "":
|
||||||
return
|
return
|
||||||
if obj.data.users > 1:
|
if obj.data.users > 1:
|
||||||
MtsLog("Error: medium transitions cannot be instantiated (at least for now)!")
|
MtsLog("Error: medium transitions cannot be instantiated (at least for now)!")
|
||||||
|
@ -473,10 +473,11 @@ class MtsExporter:
|
||||||
mmat = material.mitsuba_material
|
mmat = material.mitsuba_material
|
||||||
lamp = material.mitsuba_emission
|
lamp = material.mitsuba_emission
|
||||||
if mmat.is_medium_transition:
|
if mmat.is_medium_transition:
|
||||||
|
mainScene = bpy.data.scenes[0]
|
||||||
if mmat.interior_medium != '':
|
if mmat.interior_medium != '':
|
||||||
self.exportMedium(scene.mitsuba_media.media[mmat.interior_medium])
|
self.exportMedium(mainScene.mitsuba_media.media[mmat.interior_medium])
|
||||||
if mmat.exterior_medium != '':
|
if mmat.exterior_medium != '':
|
||||||
self.exportMedium(scene.mitsuba_media.media[mmat.exterior_medium])
|
self.exportMedium(mainScene.mitsuba_media.media[mmat.exterior_medium])
|
||||||
self.openElement('shape', {'id' : 'Exterior-mesh_0', 'type' : 'serialized'})
|
self.openElement('shape', {'id' : 'Exterior-mesh_0', 'type' : 'serialized'})
|
||||||
self.parameter('string', 'filename', {'value' : 'matpreview.serialized'})
|
self.parameter('string', 'filename', {'value' : 'matpreview.serialized'})
|
||||||
self.parameter('integer', 'shapeIndex', {'value' : '1'})
|
self.parameter('integer', 'shapeIndex', {'value' : '1'})
|
||||||
|
@ -512,7 +513,7 @@ class MtsExporter:
|
||||||
def exportMedium(self, medium):
|
def exportMedium(self, medium):
|
||||||
if medium.name in self.exported_media:
|
if medium.name in self.exported_media:
|
||||||
return
|
return
|
||||||
self.exported_media += [mat.name]
|
self.exported_media += [medium.name]
|
||||||
self.openElement('medium', {'id' : medium.name, 'type' : medium.type})
|
self.openElement('medium', {'id' : medium.name, 'type' : medium.type})
|
||||||
if medium.g == 0:
|
if medium.g == 0:
|
||||||
self.element('phase', {'type' : 'isotropic'})
|
self.element('phase', {'type' : 'isotropic'})
|
||||||
|
@ -520,6 +521,18 @@ class MtsExporter:
|
||||||
self.openElement('phase', {'type' : 'hg'})
|
self.openElement('phase', {'type' : 'hg'})
|
||||||
self.parameter('float', 'g', {'value' : str(medium.g)})
|
self.parameter('float', 'g', {'value' : str(medium.g)})
|
||||||
self.closeElement()
|
self.closeElement()
|
||||||
|
if medium.type == 'homogeneous':
|
||||||
|
self.parameter('float', 'densityMultiplier', {'value' :
|
||||||
|
str(medium.densityMultiplier)})
|
||||||
|
self.parameter('rgb', 'sigmaA', {'value' : '%f %f %f' % (
|
||||||
|
(1-medium.albedo.r) * medium.sigmaT[0],
|
||||||
|
(1-medium.albedo.g) * medium.sigmaT[1],
|
||||||
|
(1-medium.albedo.b) * medium.sigmaT[2])})
|
||||||
|
self.parameter('rgb', 'sigmaS', {'value' : '%f %f %f' % (
|
||||||
|
medium.albedo.r * medium.sigmaT[0],
|
||||||
|
medium.albedo.g * medium.sigmaT[1],
|
||||||
|
medium.albedo.b * medium.sigmaT[2])})
|
||||||
|
|
||||||
self.closeElement()
|
self.closeElement()
|
||||||
|
|
||||||
def export(self, scene):
|
def export(self, scene):
|
||||||
|
|
|
@ -48,9 +48,9 @@ class mitsuba_integrator(declarative_property_group):
|
||||||
'description': 'Specifies the type of integrator to use',
|
'description': 'Specifies the type of integrator to use',
|
||||||
'default': 'direct',
|
'default': 'direct',
|
||||||
'items': [
|
'items': [
|
||||||
('direct', 'Direct Illumination', 'direct'),
|
('volpath', 'Volumetric path tracer', 'volpath'),
|
||||||
('path', 'Path tracer', 'path'),
|
('path', 'Path tracer', 'path'),
|
||||||
('volpath', 'Volumetric path tracer', 'volpath')
|
('direct', 'Direct Illumination', 'direct')
|
||||||
],
|
],
|
||||||
'save_in_preset': True
|
'save_in_preset': True
|
||||||
},
|
},
|
||||||
|
|
|
@ -93,7 +93,7 @@ class mitsuba_material(declarative_property_group):
|
||||||
{
|
{
|
||||||
'type': 'bool',
|
'type': 'bool',
|
||||||
'attr': 'twosided',
|
'attr': 'twosided',
|
||||||
'name': 'Use two-sided shading?',
|
'name': 'Use two-sided shading',
|
||||||
'description': 'Use two-sided shading for this material? This only makes sense for non-transparent/translucent materials.',
|
'description': 'Use two-sided shading for this material? This only makes sense for non-transparent/translucent materials.',
|
||||||
'default': False,
|
'default': False,
|
||||||
'save_in_preset': True
|
'save_in_preset': True
|
||||||
|
@ -101,7 +101,7 @@ class mitsuba_material(declarative_property_group):
|
||||||
{
|
{
|
||||||
'type': 'bool',
|
'type': 'bool',
|
||||||
'attr': 'is_medium_transition',
|
'attr': 'is_medium_transition',
|
||||||
'name': 'Mark as medium transition?',
|
'name': 'Mark as medium transition',
|
||||||
'description': 'Activate this property if the material specifies a transition from one participating medium to another.',
|
'description': 'Activate this property if the material specifies a transition from one participating medium to another.',
|
||||||
'default': False,
|
'default': False,
|
||||||
'save_in_preset': True
|
'save_in_preset': True
|
||||||
|
@ -513,7 +513,7 @@ class mitsuba_mat_roughmetal(declarative_property_group):
|
||||||
'name' : 'IOR',
|
'name' : 'IOR',
|
||||||
'description' : 'Per-channel index of refraction of the conductor',
|
'description' : 'Per-channel index of refraction of the conductor',
|
||||||
'default' : (0.370, 0.370, 0.370),
|
'default' : (0.370, 0.370, 0.370),
|
||||||
'min': 1.0,
|
'min': 0.1,
|
||||||
'max': 10.0,
|
'max': 10.0,
|
||||||
'expand' : False,
|
'expand' : False,
|
||||||
'save_in_preset': True
|
'save_in_preset': True
|
||||||
|
|
|
@ -52,9 +52,9 @@ class mitsuba_medium_data(declarative_property_group):
|
||||||
ef_attach_to = [] # not attached
|
ef_attach_to = [] # not attached
|
||||||
|
|
||||||
controls = [
|
controls = [
|
||||||
'type', 'g'
|
'type', 'g', 'densityMultiplier', 'sigmaT', 'albedo'
|
||||||
]
|
]
|
||||||
|
|
||||||
properties = [
|
properties = [
|
||||||
{
|
{
|
||||||
'type': 'enum',
|
'type': 'enum',
|
||||||
|
@ -78,6 +78,41 @@ class mitsuba_medium_data(declarative_property_group):
|
||||||
'soft_max': 1.0,
|
'soft_max': 1.0,
|
||||||
'precision': 4,
|
'precision': 4,
|
||||||
'save_in_preset': True
|
'save_in_preset': True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'type': 'float',
|
||||||
|
'attr': 'densityMultiplier',
|
||||||
|
'name': 'Density',
|
||||||
|
'description': 'In conjunction with the scattering and absorption coefficients, this number determines the optical density of the medium',
|
||||||
|
'default': 1.0,
|
||||||
|
'min': 0,
|
||||||
|
'max': 10000,
|
||||||
|
'precision': 4,
|
||||||
|
'save_in_preset': True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'type': 'float_vector',
|
||||||
|
'attr': 'sigmaT',
|
||||||
|
'name' : 'Extinction',
|
||||||
|
'description' : 'Extinction due to scattering and absorption. Please ' +
|
||||||
|
'keep these value roughly equal across color channels (or expect noise).',
|
||||||
|
'default' : (1.0, 1.0, 1.0),
|
||||||
|
'min': 0.0,
|
||||||
|
'max': 1.0,
|
||||||
|
'expand' : False,
|
||||||
|
'save_in_preset': True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'type': 'float_vector',
|
||||||
|
'attr': 'albedo',
|
||||||
|
'subtype': 'COLOR',
|
||||||
|
'name' : 'Single-scattering albedo',
|
||||||
|
'description' : 'Specifies the albedo of a single scattering interaction',
|
||||||
|
'default' : (0.8, 0.8, 0.8),
|
||||||
|
'min': 0.0,
|
||||||
|
'max': 1.0,
|
||||||
|
'expand' : False,
|
||||||
|
'save_in_preset': True
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue