material emission support
parent
fe11817433
commit
2ecbd580a9
|
@ -37,7 +37,7 @@ from mitsuba.properties.material import mitsuba_material, \
|
|||
mitsuba_mat_microfacet, mitsuba_mat_roughglass, \
|
||||
mitsuba_mat_roughmetal, mitsuba_mat_dielectric, \
|
||||
mitsuba_mat_mirror, mitsuba_mat_difftrans, \
|
||||
mitsuba_mat_composite
|
||||
mitsuba_mat_composite, mitsuba_emission
|
||||
from mitsuba.operators import MITSUBA_OT_preset_engine_add, EXPORT_OT_mitsuba
|
||||
from mitsuba.outputs import MtsLog, MtsFilmDisplay
|
||||
from mitsuba.export.film import resolution
|
||||
|
@ -49,7 +49,7 @@ from mitsuba.ui.textures import main, ldrtexture, checkerboard, \
|
|||
from mitsuba.ui.materials import MATERIAL_PT_context_material_mts
|
||||
from mitsuba.ui.materials import main, lambertian, phong, ward, \
|
||||
microfacet, roughglass, roughmetal, dielectric, \
|
||||
mirror, difftrans, composite
|
||||
mirror, difftrans, composite, emission
|
||||
|
||||
def compatible(mod):
|
||||
mod = __import__(mod)
|
||||
|
@ -86,6 +86,7 @@ class RENDERENGINE_mitsuba(bpy.types.RenderEngine, engine_base):
|
|||
('mitsuba_texture', mitsuba_tex_gridtexture),
|
||||
('mitsuba_texture', mitsuba_tex_mapping),
|
||||
('Material', mitsuba_material),
|
||||
('Material', mitsuba_emission),
|
||||
('mitsuba_material', mitsuba_mat_lambertian),
|
||||
('mitsuba_material', mitsuba_mat_phong),
|
||||
('mitsuba_material', mitsuba_mat_ward),
|
||||
|
|
|
@ -52,7 +52,7 @@ class MtsAdjustments:
|
|||
self.export_worldtrafo(adjfile, lamp.matrix_world)
|
||||
adjfile.write('\t\t<rgb name="intensity" value="%f %f %f"/>\n'
|
||||
% (lamp.data.color.r*mult, lamp.data.color.g*mult, lamp.data.color.b*mult))
|
||||
adjfile.write('\t\t<float name="samplingWeight" value="%f"/>\n' % lamp.data.mitsuba_lamp.sampling_weight)
|
||||
adjfile.write('\t\t<float name="samplingWeight" value="%f"/>\n' % lamp.data.mitsuba_lamp.samplingWeight)
|
||||
adjfile.write('\t</luminaire>\n')
|
||||
elif ltype == 'AREA':
|
||||
adjfile.write('\t<shape type="obj">\n')
|
||||
|
@ -69,7 +69,7 @@ class MtsAdjustments:
|
|||
mult = lamp.data.mitsuba_lamp.intensity / (2 * size_x * size_y)
|
||||
adjfile.write('\t\t\t<rgb name="intensity" value="%f %f %f"/>\n'
|
||||
% (lamp.data.color.r*mult, lamp.data.color.g*mult, lamp.data.color.b*mult))
|
||||
adjfile.write('\t\t\t<float name="samplingWeight" value="%f"/>\n' % lamp.data.mitsuba_lamp.sampling_weight)
|
||||
adjfile.write('\t\t\t<float name="samplingWeight" value="%f"/>\n' % lamp.data.mitsuba_lamp.samplingWeight)
|
||||
adjfile.write('\t\t</luminaire>\n')
|
||||
adjfile.write('\t</shape>\n')
|
||||
objFile = open(path, 'w')
|
||||
|
@ -86,7 +86,7 @@ class MtsAdjustments:
|
|||
self.export_worldtrafo(adjfile, lamp.matrix_world * mathutils.Matrix.Scale(-1, 4, mathutils.Vector([0, 0, 1])))
|
||||
adjfile.write('\t\t<rgb name="intensity" value="%f %f %f"/>\n'
|
||||
% (lamp.data.color.r*mult, lamp.data.color.g*mult, lamp.data.color.b*mult))
|
||||
adjfile.write('\t\t<float name="samplingWeight" value="%f"/>\n' % lamp.data.mitsuba_lamp.sampling_weight)
|
||||
adjfile.write('\t\t<float name="samplingWeight" value="%f"/>\n' % lamp.data.mitsuba_lamp.samplingWeight)
|
||||
adjfile.write('\t</luminaire>\n')
|
||||
elif ltype == 'SPOT':
|
||||
adjfile.write('\t<luminaire id="%s-light" type="spot">\n' % lamp.data.name)
|
||||
|
@ -96,7 +96,7 @@ class MtsAdjustments:
|
|||
% (lamp.data.color.r*mult, lamp.data.color.g*mult, lamp.data.color.b*mult))
|
||||
adjfile.write('\t\t<float name="cutoffAngle" value="%f"/>\n' % (lamp.data.spot_size * 180 / (math.pi * 2)))
|
||||
adjfile.write('\t\t<float name="beamWidth" value="%f"/>\n' % (lamp.data.spot_blend * lamp.data.spot_size * 180 / (math.pi * 2)))
|
||||
adjfile.write('\t\t<float name="samplingWeight" value="%f"/>\n' % lamp.data.mitsuba_lamp.sampling_weight)
|
||||
adjfile.write('\t\t<float name="samplingWeight" value="%f"/>\n' % lamp.data.mitsuba_lamp.samplingWeight)
|
||||
adjfile.write('\t</luminaire>\n')
|
||||
elif ltype == 'ENV':
|
||||
if lamp.data.mitsuba_lamp.envmap_type == 'constant':
|
||||
|
@ -104,7 +104,7 @@ class MtsAdjustments:
|
|||
mult = lamp.data.mitsuba_lamp.intensity
|
||||
adjfile.write('\t\t<rgb name="intensity" value="%f %f %f"/>\n'
|
||||
% (lamp.data.color.r*mult, lamp.data.color.g*mult, lamp.data.color.b*mult))
|
||||
adjfile.write('\t\t<float name="samplingWeight" value="%f"/>\n' % lamp.data.mitsuba_lamp.sampling_weight)
|
||||
adjfile.write('\t\t<float name="samplingWeight" value="%f"/>\n' % lamp.data.mitsuba_lamp.samplingWeight)
|
||||
adjfile.write('\t</luminaire>\n')
|
||||
elif lamp.data.mitsuba_lamp.envmap_type == 'envmap':
|
||||
adjfile.write('\t<luminaire id="%s-light" type="envmap">\n' % lamp.data.name)
|
||||
|
|
|
@ -20,7 +20,7 @@ from extensions_framework import declarative_property_group
|
|||
|
||||
class mitsuba_lamp(declarative_property_group):
|
||||
controls = [
|
||||
'sampling_weight',
|
||||
'samplingWeight',
|
||||
'envmap_type',
|
||||
'envmap_file'
|
||||
]
|
||||
|
@ -48,7 +48,7 @@ class mitsuba_lamp(declarative_property_group):
|
|||
},
|
||||
{
|
||||
'type': 'float',
|
||||
'attr': 'sampling_weight',
|
||||
'attr': 'samplingWeight',
|
||||
'name': 'Sampling weight',
|
||||
'description': 'Relative amount of samples to place on this light source (e.g. the "importance")',
|
||||
'default': 1.0,
|
||||
|
@ -66,8 +66,8 @@ class mitsuba_lamp(declarative_property_group):
|
|||
'default': 10.0,
|
||||
'min': 1e-3,
|
||||
'soft_min': 1e-3,
|
||||
'max': 1e3,
|
||||
'soft_max': 1e3,
|
||||
'max': 1e5,
|
||||
'soft_max': 1e5,
|
||||
'save_in_preset': True
|
||||
},
|
||||
{
|
||||
|
|
|
@ -62,6 +62,81 @@ class mitsuba_material(declarative_property_group):
|
|||
sub_type = getattr(self, 'mitsuba_mat_%s' % self.type)
|
||||
return sub_type.get_params()
|
||||
|
||||
class mitsuba_emission(declarative_property_group):
|
||||
'''
|
||||
Storage class for Mitsuba Material emission settings.
|
||||
This class will be instantiated within a Blender Material
|
||||
object.
|
||||
'''
|
||||
|
||||
controls = [
|
||||
'use_emission',
|
||||
'color',
|
||||
'intensity',
|
||||
'samplingWeight',
|
||||
]
|
||||
|
||||
visibility = {
|
||||
'intensity': { 'use_emission': True },
|
||||
'intensity': { 'use_emission': True },
|
||||
'color': { 'use_emission': True },
|
||||
'samplingWeight': { 'use_emission': True }
|
||||
}
|
||||
|
||||
properties = [
|
||||
{
|
||||
'type': 'bool',
|
||||
'attr': 'use_emission',
|
||||
'name': 'Use Emission',
|
||||
'default': False,
|
||||
'save_in_preset': True
|
||||
},
|
||||
{
|
||||
'type': 'float',
|
||||
'attr': 'intensity',
|
||||
'name': 'Intensity',
|
||||
'description': 'Specifies the intensity of the light source',
|
||||
'default': 10.0,
|
||||
'min': 1e-3,
|
||||
'soft_min': 1e-3,
|
||||
'max': 1e5,
|
||||
'soft_max': 1e5,
|
||||
'save_in_preset': True
|
||||
},
|
||||
{
|
||||
'type': 'float',
|
||||
'attr': 'samplingWeight',
|
||||
'name': 'Sampling weight',
|
||||
'description': 'Relative amount of samples to place on this light source (e.g. the "importance")',
|
||||
'default': 1.0,
|
||||
'min': 1e-3,
|
||||
'soft_min': 1e-3,
|
||||
'max': 1e3,
|
||||
'soft_max': 1e3,
|
||||
'save_in_preset': True
|
||||
},
|
||||
{
|
||||
'attr': 'color',
|
||||
'type': 'float_vector',
|
||||
'subtype': 'COLOR',
|
||||
'description' : 'Color of the emitted light',
|
||||
'name' : 'Color',
|
||||
'default' : (1.0, 1.0, 1.0),
|
||||
'min': 0.0,
|
||||
'max': 1.0,
|
||||
'save_in_preset': True
|
||||
},
|
||||
]
|
||||
|
||||
def get_params(self):
|
||||
params = ParamSet()
|
||||
params.update(param_diffuseReflectance.get_params(self))
|
||||
params.update(param_specularReflectance.get_params(self))
|
||||
params.add_color('intensity',
|
||||
[self.color[0] * self.intensity, self.color[1] * self.intensity, self.color[2] * self.intensity])
|
||||
params.add_float('samplingWeight', self.samplingWeight)
|
||||
return params
|
||||
|
||||
class mitsuba_mat_lambertian(declarative_property_group):
|
||||
controls = param_reflectance.controls
|
||||
|
||||
|
|
Loading…
Reference in New Issue