From 0036a00fea868d01d30636d028c5080a9c945977 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 9 Apr 2015 06:11:34 +0100 Subject: [PATCH 01/81] New Clay Render system Major changes to the Clay Render system to make it more flexible and powerful, as requested in several feature requests in the bug tracker: * Clay pass but keeping transparency/translucency http://www.yafaray.org/node/541 * clay render with original relief maps http://www.yafaray.org/node/600 * Clay render with Oren Nayar shading http://www.yafaray.org/node/602 * Material off clay render http://www.yafaray.org/node/599 * Clay render default color http://www.yafaray.org/node/618 The old system of a "temporary" ClayMat material has been overriden and no longer works. The new system consists in altering the properties of the materials in the export process, so we can keep some of their properties and do a more fine grained control. * Default Clay color is now 0.5,0.5,0.5 (Midle-Grey), it can be changed (as before) * Default Clay shader is diffuse shader Oren-Nayar sigma=0.5. The Oren Nayar shader can be disabled to use the standard diffuse shader. * Option to keep transpareny in glass/transparent objects during Clay Render (also keeps transparent textures). It does not work yet in Blend materials. * Option to keep bump/normal maps during Clay Render. * Per-material option to exclude a certain material from the Clay Render. If a material is excluded, it shows normally during the Clay Render. For now this works only partially in Blend materials: if you want to exclude a Blend material you can, but you also need to exclude all the individual materials that make the blended material. I hope you find this useful. Changes to be committed: modified: io/yaf_export.py modified: io/yaf_material.py modified: io/yaf_object.py modified: prop/yaf_material.py modified: prop/yaf_scene.py modified: ui/properties_yaf_general_settings.py modified: ui/properties_yaf_material.py --- io/yaf_export.py | 30 ++++--- io/yaf_material.py | 122 ++++++++++++++++---------- io/yaf_object.py | 6 +- prop/yaf_material.py | 6 ++ prop/yaf_scene.py | 30 ++++++- ui/properties_yaf_general_settings.py | 5 ++ ui/properties_yaf_material.py | 1 + 7 files changed, 136 insertions(+), 64 deletions(-) diff --git a/io/yaf_export.py b/io/yaf_export.py index 498bc2fb..8168dcea 100644 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -194,17 +194,17 @@ def handleBlendMat(self, mat): self.handleBlendMat(mat1) elif mat1 not in self.materials: self.materials.add(mat1) - self.yaf_material.writeMaterial(mat1) + self.yaf_material.writeMaterial(mat1, self.scene) if mat2.mat_type == 'blend': self.handleBlendMat(mat2) elif mat2 not in self.materials: self.materials.add(mat2) - self.yaf_material.writeMaterial(mat2) + self.yaf_material.writeMaterial(mat2, self.scene) if mat not in self.materials: self.materials.add(mat) - self.yaf_material.writeMaterial(mat) + self.yaf_material.writeMaterial(mat, self.scene) def exportMaterials(self): self.yi.printInfo("Exporter: Processing Materials...") @@ -213,19 +213,23 @@ def exportMaterials(self): # create a default shiny diffuse material -> it will be assigned, if object has no material(s) self.yi.paramsClearAll() self.yi.paramsSetString("type", "shinydiffusemat") - self.yi.paramsSetColor("color", 0.8, 0.8, 0.8) + if self.scene.gs_clay_render: + cCol = self.scene.gs_clay_col + else: + cCol = (0.8, 0.8, 0.8) + self.yi.paramsSetColor("color", cCol[0], cCol[1], cCol[2]) self.yi.printInfo("Exporter: Creating Material \"defaultMat\"") ymat = self.yi.createMaterial("defaultMat") self.materialMap["default"] = ymat - # create a shiny diffuse material for "Clay Render" option in general settings - self.yi.paramsClearAll() - self.yi.paramsSetString("type", "shinydiffusemat") - cCol = self.scene.gs_clay_col - self.yi.paramsSetColor("color", cCol[0], cCol[1], cCol[2]) - self.yi.printInfo("Exporter: Creating Material \"clayMat\"") - cmat = self.yi.createMaterial("clayMat") - self.materialMap["clay"] = cmat + # Obsolete: create a shiny diffuse material for "Clay Render" option in general settings + #self.yi.paramsClearAll() + #self.yi.paramsSetString("type", "shinydiffusemat") + #cCol = self.scene.gs_clay_col + #self.yi.paramsSetColor("color", cCol[0], cCol[1], cCol[2]) + #self.yi.printInfo("Exporter: Creating Material \"clayMat\"") + #cmat = self.yi.createMaterial("clayMat") + #self.materialMap["clay"] = cmat for obj in self.scene.objects: for mat_slot in obj.material_slots: @@ -240,7 +244,7 @@ def exportMaterial(self, material): self.handleBlendMat(material) else: self.materials.add(material) - self.yaf_material.writeMaterial(material, self.is_preview) + self.yaf_material.writeMaterial(material, self.scene, self.is_preview) def decideOutputFileName(self, output_path, filetype): diff --git a/io/yaf_material.py b/io/yaf_material.py index 1fcdfc1d..df6882ba 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -205,7 +205,7 @@ def writeMappingNode(self, name, texname, mtex): nf = mtex.normal_factor * 2 yi.paramsSetFloat("bump_strength", nf) - def writeGlassShader(self, mat, rough): + def writeGlassShader(self, mat, scene, rough): # mat : is an instance of material yi = self.yi @@ -218,10 +218,15 @@ def writeGlassShader(self, mat, rough): yi.paramsSetString("type", "glass") yi.paramsSetFloat("IOR", mat.IOR_refraction) # added IOR for refraction - filt_col = mat.filter_color + if scene.gs_clay_render and not mat.clay_exclude: + filt_col = (1.0, 1.0, 1.0) + abs_col = (1.0, 1.0, 1.0) + else: + filt_col = mat.filter_color + abs_col = mat.absorption mir_col = mat.glass_mir_col tfilt = mat.glass_transmit - abs_col = mat.absorption + yi.paramsSetColor("filter_color", filt_col[0], filt_col[1], filt_col[2]) yi.paramsSetColor("mirror_color", mir_col[0], mir_col[1], mir_col[2]) @@ -263,7 +268,7 @@ def writeGlassShader(self, mat, rough): return yi.createMaterial(self.namehash(mat)) - def writeGlossyShader(self, mat, coated): # mat : instance of material class + def writeGlossyShader(self, mat, scene, coated): # mat : instance of material class yi = self.yi yi.paramsClearAll() @@ -337,7 +342,8 @@ def writeGlossyShader(self, mat, coated): # mat : instance of material class return yi.createMaterial(self.namehash(mat)) - def writeShinyDiffuseShader(self, mat): + + def writeShinyDiffuseShader(self, mat, scene): yi = self.yi yi.paramsClearAll() @@ -351,6 +357,14 @@ def writeShinyDiffuseShader(self, mat): bTransmit = mat.transmit_filter bEmit = mat.emit + if scene.gs_clay_render and not mat.clay_exclude: + bCol = scene.gs_clay_col + bSpecr = 0.0 + bEmit = 0.0 + if not scene.gs_clay_render_keep_transparency: + bTransp = 0.0 + bTransl = 0.0 + if self.preview: if mat.name.startswith("checker"): bEmit = 2.50 @@ -371,35 +385,41 @@ def writeShinyDiffuseShader(self, mat): used = False mappername = "map%x" % i - lname = "diff_layer%x" % i - if self.writeTexLayer(lname, mappername, diffRoot, mtex, mtex.use_map_color_diffuse, bCol, mtex.diffuse_color_factor): - used = True - diffRoot = lname - - lname = "mircol_layer%x" % i - if self.writeTexLayer(lname, mappername, mcolRoot, mtex, mtex.use_map_mirror, mirCol, mtex.mirror_factor): - used = True - mcolRoot = lname - - lname = "transp_layer%x" % i - if self.writeTexLayer(lname, mappername, transpRoot, mtex, mtex.use_map_alpha, [bTransp], mtex.alpha_factor): - used = True - transpRoot = lname - - lname = "translu_layer%x" % i - if self.writeTexLayer(lname, mappername, translRoot, mtex, mtex.use_map_translucency, [bTransl], mtex.translucency_factor): - used = True - translRoot = lname - - lname = "mirr_layer%x" % i - if self.writeTexLayer(lname, mappername, mirrorRoot, mtex, mtex.use_map_raymir, [bSpecr], mtex.raymir_factor): - used = True - mirrorRoot = lname - - lname = "bump_layer%x" % i - if self.writeTexLayer(lname, mappername, bumpRoot, mtex, mtex.use_map_normal, [0], mtex.normal_factor): - used = True - bumpRoot = lname + if mat.clay_exclude or not scene.gs_clay_render: + lname = "diff_layer%x" % i + if self.writeTexLayer(lname, mappername, diffRoot, mtex, mtex.use_map_color_diffuse, bCol, mtex.diffuse_color_factor): + used = True + diffRoot = lname + + if mat.clay_exclude or not scene.gs_clay_render: + lname = "mircol_layer%x" % i + if self.writeTexLayer(lname, mappername, mcolRoot, mtex, mtex.use_map_mirror, mirCol, mtex.mirror_factor): + used = True + mcolRoot = lname + + if mat.clay_exclude or scene.gs_clay_render_keep_transparency or not scene.gs_clay_render: + lname = "transp_layer%x" % i + if self.writeTexLayer(lname, mappername, transpRoot, mtex, mtex.use_map_alpha, [bTransp], mtex.alpha_factor): + used = True + transpRoot = lname + + if mat.clay_exclude or scene.gs_clay_render_keep_transparency or not scene.gs_clay_render: + lname = "translu_layer%x" % i + if self.writeTexLayer(lname, mappername, translRoot, mtex, mtex.use_map_translucency, [bTransl], mtex.translucency_factor): + used = True + translRoot = lname + + if mat.clay_exclude or not scene.gs_clay_render: + lname = "mirr_layer%x" % i + if self.writeTexLayer(lname, mappername, mirrorRoot, mtex, mtex.use_map_raymir, [bSpecr], mtex.raymir_factor): + used = True + mirrorRoot = lname + + if mat.clay_exclude or scene.gs_clay_render_keep_normals or not scene.gs_clay_render: + lname = "bump_layer%x" % i + if self.writeTexLayer(lname, mappername, bumpRoot, mtex, mtex.use_map_normal, [0], mtex.normal_factor): + used = True + bumpRoot = lname if used: self.writeMappingNode(mappername, mtex.texture.name, mtex) @@ -431,13 +451,17 @@ def writeShinyDiffuseShader(self, mat): yi.paramsSetBool("fresnel_effect", mat.fresnel_effect) yi.paramsSetFloat("IOR", mat.IOR_reflection) # added IOR for reflection - if mat.brdf_type == "oren-nayar": # oren-nayar fix for shinydiffuse + if scene.gs_clay_render and not mat.clay_exclude: + if scene.gs_clay_oren_nayar: + yi.paramsSetString("diffuse_brdf", "oren_nayar") + yi.paramsSetFloat("sigma", scene.gs_clay_sigma) + elif mat.brdf_type == "oren-nayar": # oren-nayar fix for shinydiffuse yi.paramsSetString("diffuse_brdf", "oren_nayar") yi.paramsSetFloat("sigma", mat.sigma) return yi.createMaterial(self.namehash(mat)) - def writeBlendShader(self, mat): + def writeBlendShader(self, mat, scene): yi = self.yi yi.paramsClearAll() @@ -477,37 +501,41 @@ def writeBlendShader(self, mat): return yi.createMaterial(self.namehash(mat)) - def writeMatteShader(self, mat): + def writeMatteShader(self, mat, scene): yi = self.yi yi.paramsClearAll() yi.paramsSetString("type", "shadow_mat") return yi.createMaterial(self.namehash(mat)) - def writeNullMat(self, mat): + def writeNullMat(self, mat, scene): yi = self.yi yi.paramsClearAll() yi.paramsSetString("type", "null") return yi.createMaterial(self.namehash(mat)) - def writeMaterial(self, mat, preview=False): + def writeMaterial(self, mat, scene, preview=False): self.preview = preview self.yi.printInfo("Exporter: Creating Material: \"" + self.namehash(mat) + "\"") ymat = None if mat.name == "y_null": - ymat = self.writeNullMat(mat) + ymat = self.writeNullMat(mat, scene) + elif scene.gs_clay_render and not mat.clay_exclude and not (scene.gs_clay_render_keep_transparency and mat.mat_type == "glass"): + ymat = self.writeShinyDiffuseShader(mat, scene) elif mat.mat_type == "glass": - ymat = self.writeGlassShader(mat, False) + ymat = self.writeGlassShader(mat, scene, False) elif mat.mat_type == "rough_glass": - ymat = self.writeGlassShader(mat, True) + ymat = self.writeGlassShader(mat, scene, True) elif mat.mat_type == "glossy": - ymat = self.writeGlossyShader(mat, False) + ymat = self.writeGlossyShader(mat, scene, False) elif mat.mat_type == "coated_glossy": - ymat = self.writeGlossyShader(mat, True) + ymat = self.writeGlossyShader(mat, scene, True) elif mat.mat_type == "shinydiffusemat": - ymat = self.writeShinyDiffuseShader(mat) + ymat = self.writeShinyDiffuseShader(mat, scene) elif mat.mat_type == "blend": - ymat = self.writeBlendShader(mat) + ymat = self.writeBlendShader(mat, scene) #FIXME: in the new Clay render two limitations: + #We cannot yet keep transparency in Blend objects. If that's needed to test a scene, better to exclude that particular material from the Clay + #We cannot exclude just the blended material from the Clay render, the individual materials that are used to make the blend also have to be excluded else: - ymat = self.writeNullMat(mat) + ymat = self.writeNullMat(mat, scene) self.materialMap[mat] = ymat diff --git a/io/yaf_object.py b/io/yaf_object.py index b7fda920..c1183827 100644 --- a/io/yaf_object.py +++ b/io/yaf_object.py @@ -467,9 +467,9 @@ def getFaceMaterial(self, meshMats, matIndex, matSlots): ymaterial = self.materialMap["default"] - if self.scene.gs_clay_render: - ymaterial = self.materialMap["clay"] - elif len(meshMats) and meshMats[matIndex]: + #if self.scene.gs_clay_render: + # ymaterial = self.materialMap["clay"] + if len(meshMats) and meshMats[matIndex]: mat = meshMats[matIndex] if mat in self.materialMap: ymaterial = self.materialMap[mat] diff --git a/prop/yaf_material.py b/prop/yaf_material.py index 3e34c6d7..9d3ae6a7 100644 --- a/prop/yaf_material.py +++ b/prop/yaf_material.py @@ -236,6 +236,11 @@ def register(): description="Let light straight through for shadow calculation. Not to be used with dispersion", default=False) + Material.clay_exclude = BoolProperty( + name="Exclude from Clay render", + description="Exclude from Clay render mode: this material will be rendered normally even in Clay render mode", + default=False) + Material.blend_value = FloatProperty( name="Blend value", description="The mixing balance: 0 -> only material 1, 1.0 -> only material 2", @@ -299,6 +304,7 @@ def unregister(): del Material.dispersion_power del Material.refr_roughness del Material.fake_shadows + del Material.clay_exclude del Material.blend_value del Material.sigma del Material.rough diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 032932bf..3614ad3e 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -98,13 +98,37 @@ def register(): description="Override all materials with a white diffuse material", default=False) + Scene.gs_clay_render_keep_transparency = BoolProperty( + name="Clay: keep transparency", + description="Keep transparency during clay render", + default=False) + + Scene.gs_clay_render_keep_normals = BoolProperty( + name="Clay: keep normal/bump maps", + description="Keep normal and bump maps during clay render", + default=False) + + Scene.gs_clay_oren_nayar = BoolProperty( + name="Clay: use Oren-Nayar shader", + description="Use Oren-Nayar shader for a more realistic diffuse clay render", + default=True) + + Scene.gs_clay_sigma = FloatProperty( + name="Sigma for Clay Oren Nayar", + description="Roughness of the clay surfaces when rendering with Clay-Oren Nayar", + min=0.0, max=1.0, + step=1, precision=5, + soft_min=0.0, soft_max=1.0, + default=0.10000) + + # added clay color property Scene.gs_clay_col = FloatVectorProperty( name="Clay color", description="Color of clay render material", subtype='COLOR', min=0.0, max=1.0, - default=(0.8, 0.8, 0.8)) + default=(0.5, 0.5, 0.5)) Scene.gs_mask_render = BoolProperty( name="Render mask", @@ -408,6 +432,10 @@ def unregister(): Scene.gs_tile_order Scene.gs_auto_threads Scene.gs_clay_render + Scene.gs_clay_render_keep_transparency + Scene.gs_clay_render_keep_normals + Scene.gs_clay_oren_nayar + Scene.gs_clay_sigma Scene.gs_clay_col Scene.gs_mask_render Scene.gs_draw_params diff --git a/ui/properties_yaf_general_settings.py b/ui/properties_yaf_general_settings.py index b043d672..72e84a61 100644 --- a/ui/properties_yaf_general_settings.py +++ b/ui/properties_yaf_general_settings.py @@ -82,6 +82,11 @@ def draw(self, context): col = split.column() if scene.gs_clay_render: col.prop(scene, "gs_clay_col", text="") + col.prop(scene, "gs_clay_oren_nayar") + if scene.gs_clay_oren_nayar: + col.prop(scene, "gs_clay_sigma") + col.prop(scene, "gs_clay_render_keep_transparency") + col.prop(scene, "gs_clay_render_keep_normals") col.prop(scene, "gs_auto_threads", toggle=True) col.prop(scene, "gs_show_sam_pix", toggle=True) col.prop(render, "use_instances", text="Use instances", toggle=True) diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index 48a11586..caf20238 100644 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -95,6 +95,7 @@ def draw(self, context): if yaf_mat: layout.separator() layout.prop(yaf_mat, "mat_type") + layout.row().prop(yaf_mat, "clay_exclude") class YAF_MATERIAL_PT_preview(MaterialButtonsPanel, Panel): From 51d5088293f6d92f42d6be532d8d418beaaa61c1 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 9 Apr 2015 19:10:10 +0100 Subject: [PATCH 02/81] Grouping all Clay Render settings together Changes to be committed: modified: prop/yaf_scene.py modified: ui/properties_yaf_general_settings.py --- prop/yaf_scene.py | 10 +++---- ui/properties_yaf_general_settings.py | 39 ++++++++++++++++++++------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 3614ad3e..cd94ff45 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -99,27 +99,27 @@ def register(): default=False) Scene.gs_clay_render_keep_transparency = BoolProperty( - name="Clay: keep transparency", + name="Keep transparency", description="Keep transparency during clay render", default=False) Scene.gs_clay_render_keep_normals = BoolProperty( - name="Clay: keep normal/bump maps", + name="Keep normal/bump maps", description="Keep normal and bump maps during clay render", default=False) Scene.gs_clay_oren_nayar = BoolProperty( - name="Clay: use Oren-Nayar shader", + name="Oren-Nayar", description="Use Oren-Nayar shader for a more realistic diffuse clay render", default=True) Scene.gs_clay_sigma = FloatProperty( - name="Sigma for Clay Oren Nayar", + name="Sigma", description="Roughness of the clay surfaces when rendering with Clay-Oren Nayar", min=0.0, max=1.0, step=1, precision=5, soft_min=0.0, soft_max=1.0, - default=0.10000) + default=0.30000) # added clay color property diff --git a/ui/properties_yaf_general_settings.py b/ui/properties_yaf_general_settings.py index 72e84a61..83acba25 100644 --- a/ui/properties_yaf_general_settings.py +++ b/ui/properties_yaf_general_settings.py @@ -31,7 +31,7 @@ class YAFARAY_MT_presets_render(Menu): preset_subdir = "render" preset_operator = "script.execute_preset" draw = yafaray_presets.Yafaray_Menu.draw_preset - + class YAF_PT_general_settings(RenderButtonsPanel, Panel): bl_label = "General Settings" @@ -73,20 +73,12 @@ def draw(self, context): split = layout.split() col = split.column() - col.prop(scene, "gs_clay_render", toggle=True) col.prop(scene, "gs_z_channel", toggle=True) col.prop(scene, "gs_transp_shad", toggle=True) col.prop(scene, "gs_draw_params", toggle=True) col.prop(scene, "gs_clamp_rgb", toggle=True) col = split.column() - if scene.gs_clay_render: - col.prop(scene, "gs_clay_col", text="") - col.prop(scene, "gs_clay_oren_nayar") - if scene.gs_clay_oren_nayar: - col.prop(scene, "gs_clay_sigma") - col.prop(scene, "gs_clay_render_keep_transparency") - col.prop(scene, "gs_clay_render_keep_normals") col.prop(scene, "gs_auto_threads", toggle=True) col.prop(scene, "gs_show_sam_pix", toggle=True) col.prop(render, "use_instances", text="Use instances", toggle=True) @@ -105,6 +97,35 @@ def draw(self, context): col.prop(scene, "gs_custom_string") +class YAFARAY_MT_clay_render(RenderButtonsPanel, Panel): + bl_label = "Clay Render Settings" + + def draw(self, context): + layout = self.layout + scene = context.scene + render = scene.render + + row = layout.row(align=True) + split = layout.split(percentage=0.5) + col = split.column() + col.prop(scene, "gs_clay_render", toggle=True) + if scene.gs_clay_render: + col = split.column() + col.prop(scene, "gs_clay_col", text="") + layout.separator() + split = layout.split() + col = split.column() + col.prop(scene, "gs_clay_oren_nayar") + if scene.gs_clay_oren_nayar: + col = split.column() + col.prop(scene, "gs_clay_sigma") + col = layout.column() + col.prop(scene, "gs_clay_render_keep_transparency") + #col = split.column() + col.prop(scene, "gs_clay_render_keep_normals") + + + if __name__ == "__main__": # only for live edit. import bpy bpy.utils.register_module(__name__) From 16c409282d8237ef6a61f308bb35b07360aecfa0 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 11 Apr 2015 06:08:34 +0100 Subject: [PATCH 03/81] Sigma texture mapping for Shiny Diffuse material Changes to add texture mapping to the Sigma parameter of the Shiny Diffuse - Oren Nayar material, to create more realistic diffuse materials. Changes are needed both in Core and the Blender-Exporter. Changes to be committed: modified: io/yaf_material.py modified: ui/properties_yaf_texture.py --- io/yaf_material.py | 8 ++++++++ ui/properties_yaf_texture.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/io/yaf_material.py b/io/yaf_material.py index 1fcdfc1d..c259d7e7 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -364,6 +364,7 @@ def writeShinyDiffuseShader(self, mat): translRoot = '' mirrorRoot = '' bumpRoot = '' + sigmaOrenRoot = '' for mtex in used_textures: if not mtex.texture: @@ -401,6 +402,11 @@ def writeShinyDiffuseShader(self, mat): used = True bumpRoot = lname + lname = "sigma_oren_layer%x" % i + if self.writeTexLayer(lname, mappername, sigmaOrenRoot, mtex, mtex.use_map_hardness, [0], mtex.hardness_factor): + used = True + sigmaOrenRoot = lname + if used: self.writeMappingNode(mappername, mtex.texture.name, mtex) i += 1 @@ -418,6 +424,8 @@ def writeShinyDiffuseShader(self, mat): yi.paramsSetString("mirror_shader", mirrorRoot) if len(bumpRoot) > 0: yi.paramsSetString("bump_shader", bumpRoot) + if len(sigmaOrenRoot) > 0: + yi.paramsSetString("sigma_oren_shader", sigmaOrenRoot) yi.paramsSetColor("color", bCol[0], bCol[1], bCol[2]) yi.paramsSetFloat("transparency", bTransp) diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index e5e234a9..0f358e0c 100644 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -569,6 +569,7 @@ def factor_but(layout, toggle, factor, name): shaderNodes = dict() shaderNodes["Bump"] = ["use_map_normal", "normal_factor", "Bump"] shaderNodes["MirrorAmount"] = ["use_map_raymir", "raymir_factor", "Mirror Amount"] + shaderNodes["SigmaOren"] = ["use_map_hardness", "hardness_factor", "Sigma Amount for Oren Nayar"] shaderNodes["MirrorColor"] = ["use_map_mirror", "mirror_factor", "Mirror Color"] shaderNodes["DiffuseColor"] = ["use_map_color_diffuse", "diffuse_color_factor", "Diffuse Color"] shaderNodes["GlossyColor"] = ["use_map_color_spec", "specular_color_factor", "Glossy Color"] @@ -582,7 +583,7 @@ def factor_but(layout, toggle, factor, name): materialShaderNodes["rough_glass"] = ["Bump", "MirrorColor"] materialShaderNodes["glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump"] materialShaderNodes["coated_glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump"] - materialShaderNodes["shinydiffusemat"] = ["DiffuseColor", "MirrorAmount", "MirrorColor", "Transparency", "Translucency", "Bump"] + materialShaderNodes["shinydiffusemat"] = ["DiffuseColor", "MirrorAmount", "MirrorColor", "Transparency", "Translucency", "Bump", "SigmaOren"] materialShaderNodes["blend"] = ["BlendAmount"] if isinstance(idblock, Material): From a2ca03416931921301865318a0a2f8ce138e0767 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 11 Apr 2015 08:39:47 +0100 Subject: [PATCH 04/81] Version, DLL and Readme changes. Integration of new Clay Render and Oren Nayar Shading Changes to be committed: modified: README modified: __init__.py modified: io/yaf_material.py --- README | 26 ++++++++++++++++++++++---- __init__.py | 8 ++++---- io/yaf_material.py | 9 +++++---- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/README b/README index e1673287..cdb7bda6 100644 --- a/README +++ b/README @@ -1,6 +1,26 @@ -Yafaray 0.1.5 exporter for Blender 2.7: +Yafaray 0.1.99-beta1 (2015-04-11) David Bluecame experimental exporter for Blender 2.74: +** THIS BUILD CONTAINS EXPERIMENTAL CHANGES AND FEATURES - DO NOT USE FOR PRODUCTION SCENES ** -For the latest exporter updates check: +Unofficial build for Windows 7 and 8.1 (64 bits) by David Bluecame +Based on YafaRay git version + pull requests from David Bluecame not yet in master for +- New Clay Material +- Texture mapping of Sigma factor in Shiny Diffuse/Oren Nayar +- Fix for Negated colors in Musgrave/Voronoi textures mapped to diffuse color. + +To install YafaRay to blender, copy this entire folder "yafaray" to the "C:\Program Files\Blender Foundation\Blender\2.74\scripts\addons" folder. + +After it, start Blender, go to User Preferences, AddOns and try to enable Render:YafaRay. Once (hopefully) enabled you should see it in the list of renderers. + +This application is provided as is, and no guarantee is given that this code will preform in the desired way. + +I hope this helps and you can start or continue to use this very nice and fast renderer! + +Best regards. David. + +**** + + +For the official YafaRay latest exporter updates check: https://github.com/YafaRay/Blender-Exporter @@ -15,8 +35,6 @@ http://www.yafaray.org/community/forum/viewtopic.php?f=16&t=3520 http://www.yafaray.org/community/forum/viewforum.php?f=12 -Download and extract the exporter files and folders to the 'Blender/2.7/scripts/addons/yafaray' directory. - Please post bugreports and feature requests here: http://www.yafaray.org/development/bugtracker/yafaray diff --git a/__init__.py b/__init__.py index 0d27b5a3..fd8e31e2 100644 --- a/__init__.py +++ b/__init__.py @@ -34,9 +34,9 @@ "author": "Shuvro Sarker, Kim Skoglund (Kerbox), Pedro Alcaide (povmaniaco)," "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," - "Alexander Smirnov (Exvion), Olaf Arnold (olaf)", - "version": (0, 1, 5, 'Stable'), - "blender": (2, 6, 3), + "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", + "version": (0, 1, 99, 'Experimental'), + "blender": (2, 7, 4), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", "tracker_url": "http://www.yafaray.org/development/bugtracker/yafaray", @@ -53,7 +53,7 @@ break # load dll's from a MinGW installation else: - dllArray = ['zlib1', 'libxml2-2', 'libgcc_s_sjlj-1', 'Half', 'Iex', 'IlmThread', 'IlmImf', 'libjpeg-8', \ + dllArray = ['libwinpthread-1', 'libgcc_s_sjlj-1', 'libstdc++-6', 'zlib1', 'libxml2-2', 'Half', 'Iex', 'IlmThread', 'IlmImf', 'libjpeg-8', \ 'libpng14', 'libtiff-3', 'libfreetype-6', 'libyafaraycore', 'libyafarayplugin'] elif sys.platform == 'darwin': diff --git a/io/yaf_material.py b/io/yaf_material.py index 5e527e8b..335ce464 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -422,10 +422,11 @@ def writeShinyDiffuseShader(self, mat, scene): used = True bumpRoot = lname - lname = "sigma_oren_layer%x" % i - if self.writeTexLayer(lname, mappername, sigmaOrenRoot, mtex, mtex.use_map_hardness, [0], mtex.hardness_factor): - used = True - sigmaOrenRoot = lname + if mat.clay_exclude or scene.gs_clay_render_keep_normals or not scene.gs_clay_render: + lname = "sigma_oren_layer%x" % i + if self.writeTexLayer(lname, mappername, sigmaOrenRoot, mtex, mtex.use_map_hardness, [0], mtex.hardness_factor): + used = True + sigmaOrenRoot = lname if used: self.writeMappingNode(mappername, mtex.texture.name, mtex) From 26d60af5a347ac9007717bb924d14eb34d5323cc Mon Sep 17 00:00:00 2001 From: david Date: Thu, 16 Apr 2015 04:57:37 +0100 Subject: [PATCH 05/81] Force diffuse reflection to 1 in Clay Render In my previous new Clay Material the original diffuse reflection parameter was used during the Clay Render. Now, I'm forcing it to 1.0 so all diffuse materials in render have the same reflectivity Changes to be committed: modified: io/yaf_material.py --- io/yaf_material.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/io/yaf_material.py b/io/yaf_material.py index df6882ba..f1556068 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -352,6 +352,7 @@ def writeShinyDiffuseShader(self, mat, scene): bCol = mat.diffuse_color mirCol = mat.mirror_color bSpecr = mat.specular_reflect + bDiffRefl = mat.diffuse_reflect bTransp = mat.transparency bTransl = mat.translucency bTransmit = mat.transmit_filter @@ -361,6 +362,7 @@ def writeShinyDiffuseShader(self, mat, scene): bCol = scene.gs_clay_col bSpecr = 0.0 bEmit = 0.0 + bDiffRefl = 1.0 if not scene.gs_clay_render_keep_transparency: bTransp = 0.0 bTransl = 0.0 @@ -442,7 +444,7 @@ def writeShinyDiffuseShader(self, mat, scene): yi.paramsSetColor("color", bCol[0], bCol[1], bCol[2]) yi.paramsSetFloat("transparency", bTransp) yi.paramsSetFloat("translucency", bTransl) - yi.paramsSetFloat("diffuse_reflect", mat.diffuse_reflect) + yi.paramsSetFloat("diffuse_reflect", bDiffRefl) yi.paramsSetFloat("emit", bEmit) yi.paramsSetFloat("transmit_filter", bTransmit) From c580ad62c4dae74fe60e3aa256172956fe95a8e8 Mon Sep 17 00:00:00 2001 From: David Bluecame Date: Sat, 18 Apr 2015 07:20:37 +0100 Subject: [PATCH 06/81] Update README --- README | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README b/README index cdb7bda6..0f9b1c3a 100644 --- a/README +++ b/README @@ -1,11 +1,13 @@ -Yafaray 0.1.99-beta1 (2015-04-11) David Bluecame experimental exporter for Blender 2.74: +Yafaray 0.1.99-beta2 (2015-04-18) David Bluecame experimental exporter for Blender 2.74: ** THIS BUILD CONTAINS EXPERIMENTAL CHANGES AND FEATURES - DO NOT USE FOR PRODUCTION SCENES ** -Unofficial build for Windows 7 and 8.1 (64 bits) by David Bluecame +Unofficial build for XXXX (XX bits) by David Bluecame Based on YafaRay git version + pull requests from David Bluecame not yet in master for -- New Clay Material +- New Clay Material, with a small correction since the previous beta1 - Texture mapping of Sigma factor in Shiny Diffuse/Oren Nayar -- Fix for Negated colors in Musgrave/Voronoi textures mapped to diffuse color. + +*WARNING* This beta2 includes an EXPERIMENTAL change to calculate automatically Shadow Bias and Minimum Ray Dist depending on the scene size. This is to avoid black artifacts when resizing the objects. However as it's a fundamental change that affects everything, perhaps some new artifacts could appear in the images now and further fine tuning needed in this new formula. Please give us feedback about it in the forum: +http://www.yafaray.org/community/forum/viewtopic.php?f=23&t=5084 To install YafaRay to blender, copy this entire folder "yafaray" to the "C:\Program Files\Blender Foundation\Blender\2.74\scripts\addons" folder. From e21880705b6cd4861e232f290431c0068ce29dd5 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 28 Apr 2015 20:11:13 +0100 Subject: [PATCH 07/81] Updates for Builds and Texture mapping for Diffuse Reflection in Shiny Diffuse material Changes to be committed: modified: README modified: __init__.py modified: io/yaf_material.py modified: ui/properties_yaf_texture.py --- README | 12 +++++++++--- __init__.py | 7 +++---- io/yaf_material.py | 9 +++++++++ ui/properties_yaf_texture.py | 3 ++- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/README b/README index 0f9b1c3a..85b653b6 100644 --- a/README +++ b/README @@ -1,15 +1,21 @@ -Yafaray 0.1.99-beta2 (2015-04-18) David Bluecame experimental exporter for Blender 2.74: +Yafaray 0.1.99-beta3 (2015-04-xx) David Bluecame experimental exporter for Blender 2.74: ** THIS BUILD CONTAINS EXPERIMENTAL CHANGES AND FEATURES - DO NOT USE FOR PRODUCTION SCENES ** Unofficial build for XXXX (XX bits) by David Bluecame +* Important: the Linux 32bit build requires a processor with SSE/SSE2 instructions. Any non-ancient processor should have them * + Based on YafaRay git version + pull requests from David Bluecame not yet in master for - New Clay Material, with a small correction since the previous beta1 - Texture mapping of Sigma factor in Shiny Diffuse/Oren Nayar -*WARNING* This beta2 includes an EXPERIMENTAL change to calculate automatically Shadow Bias and Minimum Ray Dist depending on the scene size. This is to avoid black artifacts when resizing the objects. However as it's a fundamental change that affects everything, perhaps some new artifacts could appear in the images now and further fine tuning needed in this new formula. Please give us feedback about it in the forum: +*WARNING* This build includes an EXPERIMENTAL change to calculate automatically Shadow Bias and Minimum Ray Dist depending on the scene size. This is to avoid black artifacts when resizing the objects. However as it's a fundamental change that affects everything, perhaps some new artifacts could appear in the images now and further fine tuning needed in this new formula. Please give us feedback about it in the forum: http://www.yafaray.org/community/forum/viewtopic.php?f=23&t=5084 -To install YafaRay to blender, copy this entire folder "yafaray" to the "C:\Program Files\Blender Foundation\Blender\2.74\scripts\addons" folder. +To install YafaRay to blender: +* Don't use the Blender from the distro repositories. Download the Blender official Linux 64bit build from: http://ftp.halifax.rwth-aachen.de/blender/release/Blender2.74/blender-2.74-linux-glibc211-x86_64.tar.bz2 and uncompress it in a folder, for example in $HOME/ +* Copy this entire folder "yafaray" to: + - in Linux 64bit, for example: "$HOME/blender-2.74-linux-glibc211-x86_64/2.74/scripts/addons" folder. + - in Windows 64bit, for example: "C:\Program Files\Blender Foundation\Blender\2.74\scripts\addons" folder. After it, start Blender, go to User Preferences, AddOns and try to enable Render:YafaRay. Once (hopefully) enabled you should see it in the list of renderers. diff --git a/__init__.py b/__init__.py index fd8e31e2..de26693a 100644 --- a/__init__.py +++ b/__init__.py @@ -35,7 +35,7 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": (0, 1, 99, 'Experimental'), + "version": (0, 1, 99, 'Experimental beta3'), "blender": (2, 7, 4), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", @@ -53,13 +53,12 @@ break # load dll's from a MinGW installation else: - dllArray = ['libwinpthread-1', 'libgcc_s_sjlj-1', 'libstdc++-6', 'zlib1', 'libxml2-2', 'Half', 'Iex', 'IlmThread', 'IlmImf', 'libjpeg-8', \ - 'libpng14', 'libtiff-3', 'libfreetype-6', 'libyafaraycore', 'libyafarayplugin'] + dllArray = ['libwinpthread-1', 'libgcc_s_sjlj-1', 'libstdc++-6', 'iconv', 'zlib1', 'libxml2-2', 'libHalf-11', 'libIex-2_1-11', 'libIlmThread-2_1-11', 'libIlmImf-Imf_2_1-21', 'libjpeg-62', 'libpng16-16', 'libtiff-5', 'libbz2-1', 'libfreetype-6', 'libyafaraycore', 'libyafarayplugin'] elif sys.platform == 'darwin': dllArray = ['libyafaraycore.dylib', 'libyafarayplugin.dylib'] else: - dllArray = ['libyafaraycore.so', 'libyafarayplugin.so'] + dllArray = ['libHalf.so.6.0.0', 'libIex.so.6.0.0', 'libImath.so.6.0.0', 'libIlmThread.so.6.0.0', 'libIlmImf.so.6.0.0', 'libpython3.4m.so.1.0', 'libjpeg.so.62.0.0', 'libz.so.1.2.3.4', 'libpng12.so.0.44.0', 'libtiff.so.4.3.3', 'libfreetype.so.6.6.0', 'libyafaraycore.so', 'libyafarayplugin.so'] for dll in dllArray: try: diff --git a/io/yaf_material.py b/io/yaf_material.py index b72c417b..6bd81c8f 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -381,6 +381,7 @@ def writeShinyDiffuseShader(self, mat, scene): mirrorRoot = '' bumpRoot = '' sigmaOrenRoot = '' + diffReflectRoot = '' for mtex in used_textures: if not mtex.texture: @@ -430,6 +431,12 @@ def writeShinyDiffuseShader(self, mat, scene): used = True sigmaOrenRoot = lname + if mat.clay_exclude or not scene.gs_clay_render: + lname = "diff_refl_layer%x" % i + if self.writeTexLayer(lname, mappername, diffReflectRoot, mtex, mtex.use_map_diffuse, [0], mtex.diffuse_factor): + used = True + diffReflectRoot = lname + if used: self.writeMappingNode(mappername, mtex.texture.name, mtex) i += 1 @@ -449,6 +456,8 @@ def writeShinyDiffuseShader(self, mat, scene): yi.paramsSetString("bump_shader", bumpRoot) if len(sigmaOrenRoot) > 0: yi.paramsSetString("sigma_oren_shader", sigmaOrenRoot) + if len(diffReflectRoot) > 0: + yi.paramsSetString("diffuse_refl_shader", diffReflectRoot) yi.paramsSetColor("color", bCol[0], bCol[1], bCol[2]) yi.paramsSetFloat("transparency", bTransp) diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index 0f358e0c..6f41423e 100644 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -577,13 +577,14 @@ def factor_but(layout, toggle, factor, name): shaderNodes["Transparency"] = ["use_map_alpha", "alpha_factor", "Transparency"] shaderNodes["Translucency"] = ["use_map_translucency", "translucency_factor", "Translucency"] shaderNodes["BlendAmount"] = ["use_map_diffuse", "diffuse_factor", "Blending Amount"] + shaderNodes["DiffuseReflection"] = ["use_map_diffuse", "diffuse_factor", "Diffuse reflection Amount"] materialShaderNodes = dict() materialShaderNodes["glass"] = ["Bump", "MirrorColor"] materialShaderNodes["rough_glass"] = ["Bump", "MirrorColor"] materialShaderNodes["glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump"] materialShaderNodes["coated_glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump"] - materialShaderNodes["shinydiffusemat"] = ["DiffuseColor", "MirrorAmount", "MirrorColor", "Transparency", "Translucency", "Bump", "SigmaOren"] + materialShaderNodes["shinydiffusemat"] = ["DiffuseColor", "MirrorAmount", "MirrorColor", "Transparency", "Translucency", "Bump", "SigmaOren", "DiffuseReflection"] materialShaderNodes["blend"] = ["BlendAmount"] if isinstance(idblock, Material): From ca128d75b80fb67a1cd5df4f723e4f5f02f48e80 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 29 Apr 2015 04:42:32 +0100 Subject: [PATCH 08/81] New Glass texture mapping for IOR and Filter Color Changes to be committed: modified: io/yaf_material.py modified: ui/properties_yaf_texture.py --- io/yaf_material.py | 16 ++++++++++++++-- ui/properties_yaf_texture.py | 4 +++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/io/yaf_material.py b/io/yaf_material.py index 6bd81c8f..93cba5d0 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -226,7 +226,6 @@ def writeGlassShader(self, mat, scene, rough): abs_col = mat.absorption mir_col = mat.glass_mir_col tfilt = mat.glass_transmit - yi.paramsSetColor("filter_color", filt_col[0], filt_col[1], filt_col[2]) yi.paramsSetColor("mirror_color", mir_col[0], mir_col[1], mir_col[2]) @@ -240,6 +239,8 @@ def writeGlassShader(self, mat, scene, rough): mcolRoot = '' # fcolRoot = '' /* UNUSED */ bumpRoot = '' + filterColorRoot = '' + IORRoot = '' i = 0 used_textures = self.getUsedTextures(mat) @@ -256,6 +257,14 @@ def writeGlassShader(self, mat, scene, rough): if self.writeTexLayer(lname, mappername, bumpRoot, mtex, mtex.use_map_normal, [0], mtex.normal_factor): used = True bumpRoot = lname + lname = "filter_color_layer%x" % i + if self.writeTexLayer(lname, mappername, filterColorRoot, mtex, mtex.use_map_color_reflection, filt_col, mtex.reflection_color_factor): + used = True + filterColorRoot = lname + lname = "IOR_layer%x" % i + if self.writeTexLayer(lname, mappername, IORRoot, mtex, mtex.use_map_density, [0], mtex.density_factor): + used = True + IORRoot = lname if used: self.writeMappingNode(mappername, mtex.texture.name, mtex) i += 1 @@ -265,7 +274,10 @@ def writeGlassShader(self, mat, scene, rough): yi.paramsSetString("mirror_color_shader", mcolRoot) if len(bumpRoot) > 0: yi.paramsSetString("bump_shader", bumpRoot) - + if len(filterColorRoot) > 0: + yi.paramsSetString("filter_color_shader", filterColorRoot) + if len(IORRoot) > 0: + yi.paramsSetString("IOR_shader", IORRoot) return yi.createMaterial(self.namehash(mat)) def writeGlossyShader(self, mat, scene, coated): # mat : instance of material class diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index 6f41423e..0d561178 100644 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -578,9 +578,11 @@ def factor_but(layout, toggle, factor, name): shaderNodes["Translucency"] = ["use_map_translucency", "translucency_factor", "Translucency"] shaderNodes["BlendAmount"] = ["use_map_diffuse", "diffuse_factor", "Blending Amount"] shaderNodes["DiffuseReflection"] = ["use_map_diffuse", "diffuse_factor", "Diffuse reflection Amount"] + shaderNodes["FilterColor"] = ["use_map_color_reflection", "reflection_color_factor", "Filter Color Amount"] + shaderNodes["IORAmount"] = ["use_map_density", "density_factor", "IOR Amount (added to material IOR)"] materialShaderNodes = dict() - materialShaderNodes["glass"] = ["Bump", "MirrorColor"] + materialShaderNodes["glass"] = ["Bump", "MirrorColor", "FilterColor", "IORAmount"] materialShaderNodes["rough_glass"] = ["Bump", "MirrorColor"] materialShaderNodes["glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump"] materialShaderNodes["coated_glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump"] From d5e2a42455577fb4fb28d4e12387726d49471810 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 29 Apr 2015 05:30:52 +0100 Subject: [PATCH 09/81] Added Oren-Nayar Sigma factor texture map to Glossy material Changes to be committed: modified: io/yaf_material.py modified: ui/properties_yaf_texture.py --- io/yaf_material.py | 9 ++++++++- ui/properties_yaf_texture.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/io/yaf_material.py b/io/yaf_material.py index 93cba5d0..11977863 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -310,6 +310,7 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c glossRoot = '' glRefRoot = '' bumpRoot = '' + sigmaOrenRoot = '' i = 0 used_textures = self.getUsedTextures(mat) @@ -334,6 +335,10 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c if self.writeTexLayer(lname, mappername, bumpRoot, mtex, mtex.use_map_normal, [0], mtex.normal_factor): used = True bumpRoot = lname + lname = "sigma_oren_layer%x" % i + if self.writeTexLayer(lname, mappername, sigmaOrenRoot, mtex, mtex.use_map_hardness, [0], mtex.hardness_factor): + used = True + sigmaOrenRoot = lname if used: self.writeMappingNode(mappername, mtex.texture.name, mtex) i += 1 @@ -347,7 +352,9 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c yi.paramsSetString("glossy_reflect_shader", glRefRoot) if len(bumpRoot) > 0: yi.paramsSetString("bump_shader", bumpRoot) - + if len(sigmaOrenRoot) > 0: + yi.paramsSetString("sigma_oren_shader", sigmaOrenRoot) + if mat.brdf_type == "oren-nayar": # oren-nayar fix for glossy yi.paramsSetString("diffuse_brdf", "Oren-Nayar") yi.paramsSetFloat("sigma", mat.sigma) diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index 0d561178..732b6724 100644 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -584,7 +584,7 @@ def factor_but(layout, toggle, factor, name): materialShaderNodes = dict() materialShaderNodes["glass"] = ["Bump", "MirrorColor", "FilterColor", "IORAmount"] materialShaderNodes["rough_glass"] = ["Bump", "MirrorColor"] - materialShaderNodes["glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump"] + materialShaderNodes["glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump", "SigmaOren"] materialShaderNodes["coated_glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump"] materialShaderNodes["shinydiffusemat"] = ["DiffuseColor", "MirrorAmount", "MirrorColor", "Transparency", "Translucency", "Bump", "SigmaOren", "DiffuseReflection"] materialShaderNodes["blend"] = ["BlendAmount"] From e08dc2a1ad795f12ab0fd796061d6322360bbc2f Mon Sep 17 00:00:00 2001 From: david Date: Wed, 29 Apr 2015 06:11:45 +0100 Subject: [PATCH 10/81] New Rough Glass texture mappings - filter color, roughness, IOR Changes to be committed: modified: io/yaf_material.py modified: ui/properties_yaf_texture.py --- io/yaf_material.py | 9 ++++++++- ui/properties_yaf_texture.py | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/io/yaf_material.py b/io/yaf_material.py index 11977863..8c0aedcf 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -241,6 +241,7 @@ def writeGlassShader(self, mat, scene, rough): bumpRoot = '' filterColorRoot = '' IORRoot = '' + roughnessRoot = '' i = 0 used_textures = self.getUsedTextures(mat) @@ -265,6 +266,10 @@ def writeGlassShader(self, mat, scene, rough): if self.writeTexLayer(lname, mappername, IORRoot, mtex, mtex.use_map_density, [0], mtex.density_factor): used = True IORRoot = lname + lname = "roughness_layer%x" % i + if self.writeTexLayer(lname, mappername, roughnessRoot, mtex, mtex.use_map_hardness, [0], mtex.hardness_factor): + used = True + roughnessRoot = lname if used: self.writeMappingNode(mappername, mtex.texture.name, mtex) i += 1 @@ -277,7 +282,9 @@ def writeGlassShader(self, mat, scene, rough): if len(filterColorRoot) > 0: yi.paramsSetString("filter_color_shader", filterColorRoot) if len(IORRoot) > 0: - yi.paramsSetString("IOR_shader", IORRoot) + yi.paramsSetString("IOR_shader", IORRoot) + if len(roughnessRoot) > 0: + yi.paramsSetString("roughness_shader", roughnessRoot) return yi.createMaterial(self.namehash(mat)) def writeGlossyShader(self, mat, scene, coated): # mat : instance of material class diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index 732b6724..f8562ab4 100644 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -580,10 +580,11 @@ def factor_but(layout, toggle, factor, name): shaderNodes["DiffuseReflection"] = ["use_map_diffuse", "diffuse_factor", "Diffuse reflection Amount"] shaderNodes["FilterColor"] = ["use_map_color_reflection", "reflection_color_factor", "Filter Color Amount"] shaderNodes["IORAmount"] = ["use_map_density", "density_factor", "IOR Amount (added to material IOR)"] - + shaderNodes["RoughnessAmount"] = ["use_map_hardness", "hardness_factor", "Roughness amount"] + materialShaderNodes = dict() materialShaderNodes["glass"] = ["Bump", "MirrorColor", "FilterColor", "IORAmount"] - materialShaderNodes["rough_glass"] = ["Bump", "MirrorColor"] + materialShaderNodes["rough_glass"] = ["Bump", "MirrorColor", "FilterColor", "IORAmount", "RoughnessAmount"] materialShaderNodes["glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump", "SigmaOren"] materialShaderNodes["coated_glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump"] materialShaderNodes["shinydiffusemat"] = ["DiffuseColor", "MirrorAmount", "MirrorColor", "Transparency", "Translucency", "Bump", "SigmaOren", "DiffuseReflection"] From d0aae1db2687831b4817ad8876c95ee6ba5ba9ef Mon Sep 17 00:00:00 2001 From: david Date: Thu, 30 Apr 2015 21:22:00 +0100 Subject: [PATCH 11/81] New Extended Texture Mapping System Added many new texture mapping options for all materials, including filter color and IOR for glass and rough glass, sigma oren nayar for glossy and coated glossy, mirror amount and mirror color for coated glossy, etc. This is very experimental, but I hope it helps the users to create new exotic materials and to reduce the usage of the blend material in some cases. Changes to be committed: modified: io/yaf_material.py modified: ui/properties_yaf_material.py modified: ui/properties_yaf_texture.py --- io/yaf_material.py | 53 +++++++++++++++++++++++++++++++++-- ui/properties_yaf_material.py | 1 + ui/properties_yaf_texture.py | 15 +++++----- 3 files changed, 60 insertions(+), 9 deletions(-) diff --git a/io/yaf_material.py b/io/yaf_material.py index 8c0aedcf..c7c3a852 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -263,7 +263,7 @@ def writeGlassShader(self, mat, scene, rough): used = True filterColorRoot = lname lname = "IOR_layer%x" % i - if self.writeTexLayer(lname, mappername, IORRoot, mtex, mtex.use_map_density, [0], mtex.density_factor): + if self.writeTexLayer(lname, mappername, IORRoot, mtex, mtex.use_map_warp, [0], mtex.warp_factor): used = True IORRoot = lname lname = "roughness_layer%x" % i @@ -298,8 +298,10 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c yi.paramsSetColor("mirror_color", mir_col[0], mir_col[1], mir_col[2]) else: yi.paramsSetString("type", "glossy") + mir_col = mat.diffuse_color diffuse_color = mat.diffuse_color + bSpecr = mat.specular_reflect color = mat.glossy_color yi.paramsSetColor("diffuse_color", diffuse_color[0], diffuse_color[1], diffuse_color[2]) @@ -311,6 +313,7 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c yi.paramsSetBool("anisotropic", mat.anisotropic) yi.paramsSetFloat("exp_u", mat.exp_u) yi.paramsSetFloat("exp_v", mat.exp_v) + yi.paramsSetFloat("specular_reflect", bSpecr) diffRoot = '' # mcolRoot = '' /* UNUSED */ @@ -318,6 +321,11 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c glRefRoot = '' bumpRoot = '' sigmaOrenRoot = '' + exponentRoot = '' + IORRoot = '' + diffReflectRoot = '' + mirrorRoot = '' + mcolRoot = '' i = 0 used_textures = self.getUsedTextures(mat) @@ -346,6 +354,28 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c if self.writeTexLayer(lname, mappername, sigmaOrenRoot, mtex, mtex.use_map_hardness, [0], mtex.hardness_factor): used = True sigmaOrenRoot = lname + lname = "exponent_layer%x" % i + if self.writeTexLayer(lname, mappername, exponentRoot, mtex, mtex.use_map_ambient, [0], mtex.ambient_factor): + used = True + exponentRoot = lname + lname = "IOR_layer%x" % i + if self.writeTexLayer(lname, mappername, IORRoot, mtex, mtex.use_map_warp, [0], mtex.warp_factor): + used = True + IORRoot = lname + lname = "diff_refl_layer%x" % i + if self.writeTexLayer(lname, mappername, diffReflectRoot, mtex, mtex.use_map_diffuse, [0], mtex.diffuse_factor): + used = True + diffReflectRoot = lname + lname = "mircol_layer%x" % i + if self.writeTexLayer(lname, mappername, mcolRoot, mtex, mtex.use_map_mirror, mir_col, mtex.mirror_factor): + used = True + mcolRoot = lname + lname = "mirr_layer%x" % i + if self.writeTexLayer(lname, mappername, mirrorRoot, mtex, mtex.use_map_raymir, [bSpecr], mtex.raymir_factor): + used = True + mirrorRoot = lname + + if used: self.writeMappingNode(mappername, mtex.texture.name, mtex) i += 1 @@ -361,7 +391,17 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c yi.paramsSetString("bump_shader", bumpRoot) if len(sigmaOrenRoot) > 0: yi.paramsSetString("sigma_oren_shader", sigmaOrenRoot) - + if len(exponentRoot) > 0: + yi.paramsSetString("exponent_shader", exponentRoot) + if len(IORRoot) > 0: + yi.paramsSetString("IOR_shader", IORRoot) + if len(diffReflectRoot) > 0: + yi.paramsSetString("diffuse_refl_shader", diffReflectRoot) + if len(mcolRoot) > 0: + yi.paramsSetString("mirror_color_shader", mcolRoot) + if len(mirrorRoot) > 0: + yi.paramsSetString("mirror_shader", mirrorRoot) + if mat.brdf_type == "oren-nayar": # oren-nayar fix for glossy yi.paramsSetString("diffuse_brdf", "Oren-Nayar") yi.paramsSetFloat("sigma", mat.sigma) @@ -408,6 +448,7 @@ def writeShinyDiffuseShader(self, mat, scene): bumpRoot = '' sigmaOrenRoot = '' diffReflectRoot = '' + IORRoot = '' for mtex in used_textures: if not mtex.texture: @@ -463,6 +504,12 @@ def writeShinyDiffuseShader(self, mat, scene): used = True diffReflectRoot = lname + if mat.clay_exclude or not scene.gs_clay_render: + lname = "IOR_layer%x" % i + if self.writeTexLayer(lname, mappername, IORRoot, mtex, mtex.use_map_warp, [0], mtex.warp_factor): + used = True + IORRoot = lname + if used: self.writeMappingNode(mappername, mtex.texture.name, mtex) i += 1 @@ -484,6 +531,8 @@ def writeShinyDiffuseShader(self, mat, scene): yi.paramsSetString("sigma_oren_shader", sigmaOrenRoot) if len(diffReflectRoot) > 0: yi.paramsSetString("diffuse_refl_shader", diffReflectRoot) + if len(IORRoot) > 0: + yi.paramsSetString("IOR_shader", IORRoot) yi.paramsSetColor("color", bCol[0], bCol[1], bCol[2]) yi.paramsSetFloat("transparency", bTransp) diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index caf20238..9c37f071 100644 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -256,6 +256,7 @@ def draw(self, context): col.label(text="Fresnel reflection:") col.prop(yaf_mat, "IOR_reflection") col.label() + layout.row().prop(yaf_mat, "specular_reflect", slider=True) class YAF_PT_glass_real(MaterialTypePanel, Panel): diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index f8562ab4..76c6948c 100644 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -579,15 +579,16 @@ def factor_but(layout, toggle, factor, name): shaderNodes["BlendAmount"] = ["use_map_diffuse", "diffuse_factor", "Blending Amount"] shaderNodes["DiffuseReflection"] = ["use_map_diffuse", "diffuse_factor", "Diffuse reflection Amount"] shaderNodes["FilterColor"] = ["use_map_color_reflection", "reflection_color_factor", "Filter Color Amount"] - shaderNodes["IORAmount"] = ["use_map_density", "density_factor", "IOR Amount (added to material IOR)"] + shaderNodes["IORAmount"] = ["use_map_warp", "warp_factor", "IOR Amount (added to material IOR)"] shaderNodes["RoughnessAmount"] = ["use_map_hardness", "hardness_factor", "Roughness amount"] - + shaderNodes["ExponentAmount"] = ["use_map_ambient", "ambient_factor", "Glossy Exponent amount"] + materialShaderNodes = dict() - materialShaderNodes["glass"] = ["Bump", "MirrorColor", "FilterColor", "IORAmount"] - materialShaderNodes["rough_glass"] = ["Bump", "MirrorColor", "FilterColor", "IORAmount", "RoughnessAmount"] - materialShaderNodes["glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump", "SigmaOren"] - materialShaderNodes["coated_glossy"] = ["DiffuseColor", "GlossyColor", "GlossyAmount", "Bump"] - materialShaderNodes["shinydiffusemat"] = ["DiffuseColor", "MirrorAmount", "MirrorColor", "Transparency", "Translucency", "Bump", "SigmaOren", "DiffuseReflection"] + materialShaderNodes["glass"] = ["FilterColor", "MirrorColor", "IORAmount", "Bump"] + materialShaderNodes["rough_glass"] = ["RoughnessAmount", "FilterColor", "MirrorColor", "IORAmount", "Bump"] + materialShaderNodes["glossy"] = ["DiffuseColor", "DiffuseReflection", "SigmaOren", "GlossyColor", "GlossyAmount", "ExponentAmount", "Bump"] + materialShaderNodes["coated_glossy"] = ["DiffuseColor", "DiffuseReflection", "SigmaOren", "GlossyColor", "GlossyAmount", "ExponentAmount", "MirrorAmount", "MirrorColor", "IORAmount", "Bump"] + materialShaderNodes["shinydiffusemat"] = ["DiffuseColor", "DiffuseReflection", "SigmaOren", "MirrorAmount", "MirrorColor", "IORAmount", "Transparency", "Translucency", "Bump"] materialShaderNodes["blend"] = ["BlendAmount"] if isinstance(idblock, Material): From 2c98efe2def274ce15f908d4e8befce734a9ab23 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 2 May 2015 05:39:14 +0100 Subject: [PATCH 12/81] README changes for new beta release --- README | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README b/README index 85b653b6..70939277 100644 --- a/README +++ b/README @@ -1,12 +1,24 @@ -Yafaray 0.1.99-beta3 (2015-04-xx) David Bluecame experimental exporter for Blender 2.74: +Yafaray 0.1.99-beta3 (2015-05-02) David Bluecame experimental exporter for Blender 2.74.5: ** THIS BUILD CONTAINS EXPERIMENTAL CHANGES AND FEATURES - DO NOT USE FOR PRODUCTION SCENES ** Unofficial build for XXXX (XX bits) by David Bluecame * Important: the Linux 32bit build requires a processor with SSE/SSE2 instructions. Any non-ancient processor should have them * Based on YafaRay git version + pull requests from David Bluecame not yet in master for -- New Clay Material, with a small correction since the previous beta1 -- Texture mapping of Sigma factor in Shiny Diffuse/Oren Nayar + +- New Clay Material system, more flexible and powerful. More information in: http://www.yafaray.org/community/forum/viewtopic.php?f=16&t=5079 + +- Extended Texture Mapping system (very experimental!!), allowing using textures to map additional properties in materials, to be able to create either more realistic or more exotic materials and reduce the dependency on the "blend" material. More information in: http://www.yafaray.org/community/forum/viewtopic.php?f=22&t=5091 The new texture mappings in addition to the existing ones are: + - Diffuse Reflection Amount in Shiny Diffuse, Glossy and Coated Glossy materials + - Sigma factor for Oren Nayar in Shiny Diffuse, Glossy and Coated Glossy materials + - Filter color in Glass and Rough Glass. + - IOR refractive factor in Glass and Rough Glass. The texture amounts are added to the IOR of the material. + - IOR refractive factor for the Fresnel in Shiny Diffuse, Glossy and Coated Glossy materials. + - Roughness factor in Rough Glass material. + - Exponent factor in Glossy and Coated Glossy materials + - Mirror amount in Coated Glossy materials. + - Mirror Color in Glass, Rough Glass and Coated Glossy Materials + *WARNING* This build includes an EXPERIMENTAL change to calculate automatically Shadow Bias and Minimum Ray Dist depending on the scene size. This is to avoid black artifacts when resizing the objects. However as it's a fundamental change that affects everything, perhaps some new artifacts could appear in the images now and further fine tuning needed in this new formula. Please give us feedback about it in the forum: http://www.yafaray.org/community/forum/viewtopic.php?f=23&t=5084 From e374c62a9129268da04ec365ca4907fd5fb275bd Mon Sep 17 00:00:00 2001 From: david Date: Sat, 2 May 2015 10:52:51 +0100 Subject: [PATCH 13/81] Changes in README file --- README | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README b/README index 70939277..98b7a10d 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Yafaray 0.1.99-beta3 (2015-05-02) David Bluecame experimental exporter for Blender 2.74.5: +Yafaray 0.1.99-beta3 (2015-05-02) David Bluecame experimental exporter for Blender 2.74.5 (up to Blender builbots for 2015-05-02): ** THIS BUILD CONTAINS EXPERIMENTAL CHANGES AND FEATURES - DO NOT USE FOR PRODUCTION SCENES ** Unofficial build for XXXX (XX bits) by David Bluecame @@ -8,7 +8,11 @@ Based on YafaRay git version + pull requests from David Bluecame not yet in mast - New Clay Material system, more flexible and powerful. More information in: http://www.yafaray.org/community/forum/viewtopic.php?f=16&t=5079 -- Extended Texture Mapping system (very experimental!!), allowing using textures to map additional properties in materials, to be able to create either more realistic or more exotic materials and reduce the dependency on the "blend" material. More information in: http://www.yafaray.org/community/forum/viewtopic.php?f=22&t=5091 The new texture mappings in addition to the existing ones are: +- Fix for problem with Rough Glass too bright when dispersion is enabled. See: http://www.yafaray.org/node/642 + +- Extended Texture Mapping system (very experimental!!), allowing using textures to map additional properties in materials, to be able to create either more realistic or more exotic materials and reduce the dependency on the "blend" material. More information in: http://www.yafaray.org/community/forum/viewtopic.php?f=22&t=5091 + +The new texture mappings in addition to the existing ones are: - Diffuse Reflection Amount in Shiny Diffuse, Glossy and Coated Glossy materials - Sigma factor for Oren Nayar in Shiny Diffuse, Glossy and Coated Glossy materials - Filter color in Glass and Rough Glass. From c0f249ccc3041eb05b98cd72840389cd5e4a99bb Mon Sep 17 00:00:00 2001 From: david Date: Sat, 2 May 2015 12:44:17 +0100 Subject: [PATCH 14/81] Changes to the README file --- README | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README b/README index 98b7a10d..0131f0af 100644 --- a/README +++ b/README @@ -12,16 +12,23 @@ Based on YafaRay git version + pull requests from David Bluecame not yet in mast - Extended Texture Mapping system (very experimental!!), allowing using textures to map additional properties in materials, to be able to create either more realistic or more exotic materials and reduce the dependency on the "blend" material. More information in: http://www.yafaray.org/community/forum/viewtopic.php?f=22&t=5091 +Important note: when using some of the new mappings, the renders may slow down. I'm not sure whether it's because of the additional calculations (very likely) or if it's something we can optimize further in the future. In any case, it should only be noticeable when using the new mappings, and I think it's worth the ability to create new materials now. + The new texture mappings in addition to the existing ones are: - Diffuse Reflection Amount in Shiny Diffuse, Glossy and Coated Glossy materials - Sigma factor for Oren Nayar in Shiny Diffuse, Glossy and Coated Glossy materials - Filter color in Glass and Rough Glass. - IOR refractive factor in Glass and Rough Glass. The texture amounts are added to the IOR of the material. - - IOR refractive factor for the Fresnel in Shiny Diffuse, Glossy and Coated Glossy materials. + - IOR refractive factor for the Fresnel in Shiny Diffuse and Coated Glossy materials. - Roughness factor in Rough Glass material. - Exponent factor in Glossy and Coated Glossy materials - Mirror amount in Coated Glossy materials. - - Mirror Color in Glass, Rough Glass and Coated Glossy Materials + - Mirror Color in Coated Glossy Materials + + +I also added a (non-texture) mirror amount slider in the Coated Glossy material + +Unfortunately due to Blender API limitations, in some of the new texture sliders, the "tooltip" information that appears when hovering the mouse over the slider, can be misleading and not represent the actual function of that slider. However, I took care in setting the description correctly so just by looking at the slider itself you can see what does it map. *WARNING* This build includes an EXPERIMENTAL change to calculate automatically Shadow Bias and Minimum Ray Dist depending on the scene size. This is to avoid black artifacts when resizing the objects. However as it's a fundamental change that affects everything, perhaps some new artifacts could appear in the images now and further fine tuning needed in this new formula. Please give us feedback about it in the forum: From 0d0fb0500c41a8f5d8136eaec52fe1afa2e2ab05 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 25 May 2015 20:43:21 +0200 Subject: [PATCH 15/81] Changes in Blend material properties WARNING: This change breaks backwards compatibility In the blend material, the component materials (material1 and material2) are defined as Enum properties. This causes that if somebody removes or adds a new material, the enum property does not point to the same material as before, causing unexpected changes in the Blend material components. Unfortunately due to Blender API limitations, I don't know any way to set a consistent link between a material to another, so I've replaced the Enum properties by String properties. I've added code to convert old scenes "Enum" properties to the new "String" properties automatically. The advantages of this solution are: * Creating and deleting materials will not affect the existing Blend materials components. However, there are disadvantages too, but due to Blender API limitations I cannot think in a better way (for now): * No more dropdown menus for selecting the blend material components. You have to write down the material names. * If you rename one of the component materials, the blend material will no longer work. I still believe this is better than the previous blend behavior. Renaming a material that's used for a blend material would be expected to cause problems. To mitigate this, I've made the Logging more explicit. Now, if a blend material component is not found, it will tell you what's the problematic blend material and which component (material1 or material2) cannot be found, and what is the name of the component material that cannot be found. Changes to be committed: modified: __init__.py modified: io/yaf_export.py modified: io/yaf_material.py modified: prop/yaf_material.py modified: ui/properties_yaf_material.py --- __init__.py | 8 ++++++++ io/yaf_export.py | 31 ++++++++++++++++++++++--------- io/yaf_material.py | 6 +++--- prop/yaf_material.py | 18 ++++++++++++++++-- ui/properties_yaf_material.py | 15 +++++++++++++-- 5 files changed, 62 insertions(+), 16 deletions(-) diff --git a/__init__.py b/__init__.py index 0d27b5a3..5ae3f1ae 100644 --- a/__init__.py +++ b/__init__.py @@ -90,6 +90,14 @@ def load_handler(dummy): # converts old files, where propertie yaf_tex_type wasn't defined print("Load Handler: Convert Yafaray texture \"{0}\" with texture type: \"{1}\" to \"{2}\"".format(tex.name, tex.yaf_tex_type, tex.type)) tex.yaf_tex_type = tex.type + for mat in bpy.data.materials: + if mat is not None: + # from old scenes, convert old blend material Enum properties into the new string properties + if mat.mat_type == "blend": + if not mat.is_property_set("material1name") or not mat.material1name: + mat.material1name = mat.material1 + if not mat.is_property_set("material2name") or not mat.material2name: + mat.material2name = mat.material2 # convert image output file type setting from blender to yafaray's file type setting on file load, so that both are the same... if bpy.context.scene.render.image_settings.file_format is not bpy.context.scene.img_output: bpy.context.scene.img_output = bpy.context.scene.render.image_settings.file_format diff --git a/io/yaf_export.py b/io/yaf_export.py index c883391c..5a2cb8b6 100644 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -79,11 +79,18 @@ def exportTexture(self, obj): # First export the textures of the materials type 'blend' for mat_slot in [m for m in obj.material_slots if m.material is not None]: if mat_slot.material.mat_type == 'blend': + blendmat_error = False try: - mat1 = bpy.data.materials[mat_slot.material.material1] - mat2 = bpy.data.materials[mat_slot.material.material2] + mat1 = bpy.data.materials[mat_slot.material.material1name] except: - self.yi.printWarning("Exporter: Problem with blend material {0}. Could not find one of the two blended materials".format(mat_slot.material.name)) + self.yi.printWarning("Exporter: Problem with blend material:\"{0}\". Could not find the first material:\"{1}\"".format(mat_slot.material.name,mat_slot.material.material1name)) + blendmat_error = True + try: + mat2 = bpy.data.materials[mat_slot.material.material2name] + except: + self.yi.printWarning("Exporter: Problem with blend material:\"{0}\". Could not find the second material:\"{1}\"".format(mat_slot.material.name,mat_slot.material.material2name)) + blendmat_error = True + if blendmat_error: continue for bm in [mat1, mat2]: for blendtex in [bt for bt in bm.texture_slots if (bt and bt.texture and bt.use)]: @@ -180,15 +187,21 @@ def exportObjects(self): self.yaf_object.writeObject(obj) def handleBlendMat(self, mat): + blendmat_error = False + try: + mat1 = bpy.data.materials[mat.material1name] + except: + self.yi.printWarning("Exporter: Problem with blend material:\"{0}\". Could not find the first material:\"{1}\"".format(mat.name,mat.material1name)) + blendmat_error = True try: - mat1 = bpy.data.materials[mat.material1] - mat2 = bpy.data.materials[mat.material2] + mat2 = bpy.data.materials[mat.material2name] except: - self.yi.printWarning("Exporter: Problem with blend material {0}. Could not find one of the two blended materials".format(mat.name)) - return + self.yi.printWarning("Exporter: Problem with blend material:\"{0}\". Could not find the second material:\"{1}\"".format(mat.name,mat.material2name)) + blendmat_error = True + if blendmat_error: + return if mat1.name == mat2.name: - self.yi.printWarning("Exporter: Problem with blend material {0}. {1} and {2} to blend are the same materials".format(mat.name, mat1.name, mat2.name)) - return + self.yi.printWarning("Exporter: Problem with blend material \"{0}\". \"{1}\" and \"{2}\" to blend are the same materials".format(mat.name, mat1.name, mat2.name)) if mat1.mat_type == 'blend': self.handleBlendMat(mat1) diff --git a/io/yaf_material.py b/io/yaf_material.py index 1fcdfc1d..120a0a25 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -441,10 +441,10 @@ def writeBlendShader(self, mat): yi = self.yi yi.paramsClearAll() - yi.printInfo("Exporter: Blend material with: [" + mat.material1 + "] [" + mat.material2 + "]") + yi.printInfo("Exporter: Blend material with: [" + mat.material1name + "] [" + mat.material2name + "]") yi.paramsSetString("type", "blend_mat") - yi.paramsSetString("material1", self.namehash(bpy.data.materials[mat.material1])) - yi.paramsSetString("material2", self.namehash(bpy.data.materials[mat.material2])) + yi.paramsSetString("material1", self.namehash(bpy.data.materials[mat.material1name])) + yi.paramsSetString("material2", self.namehash(bpy.data.materials[mat.material2name])) i = 0 diff --git a/prop/yaf_material.py b/prop/yaf_material.py index 42f66c0e..1038a27b 100644 --- a/prop/yaf_material.py +++ b/prop/yaf_material.py @@ -27,14 +27,14 @@ Material = bpy.types.Material - +# This code is irrelevant after the change in the blend material to convert it from EnumProperty to StringProperty. I'm keeping this as a reference in case a better solution can be found for the blend material component materials references def items_mat1(self, context): a = [] for mat in [m for m in bpy.data.materials if m.name not in self.name]: a.append((mat.name, mat.name, "First blend material")) return(a) - +# This code is irrelevant after the change in the blend material to convert it from EnumProperty to StringProperty. I'm keeping this as a reference in case a better solution can be found for the blend material component materials references def items_mat2(self, context): a = [] for mat in [m for m in bpy.data.materials if m.name not in self.name]: @@ -267,6 +267,7 @@ def register(): description="", default=False) + #Deprecated blend material component Enum references, only to keep compatibility with old scenes Material.material1 = EnumProperty( name="Material one", description="First blend material", @@ -277,6 +278,17 @@ def register(): description="Second blend material", items=items_mat2) + #New blend material component String references, when opening old scenes it should copy the old Enum Property materials to the new String Properties + Material.material1name = StringProperty( + name="Material one", + description="First blend material") + #, get=get_blend_mat1_old_scenes) + + Material.material2name = StringProperty( + name="Material two", + description="Second blend material") + #, get=get_blend_mat2_old_scenes) + def unregister(): del Material.mat_type @@ -311,3 +323,5 @@ def unregister(): del Material.coated del Material.material1 del Material.material2 + del Material.material1name + del Material.material2name diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index f26477c2..27a073f4 100644 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -323,14 +323,25 @@ def draw(self, context): box = layout.box() box.label(text="Choose the two materials you wish to blend.") + + #old blend material Enum properties - deprecated + #split = box.split() + #col = split.column() + #col.label(text="Material one:") + #col.prop(yaf_mat, "material1", text="") + + #col = split.column() + #col.label(text="Material two:") + #col.prop(yaf_mat, "material2", text="") + split = box.split() col = split.column() col.label(text="Material one:") - col.prop(yaf_mat, "material1", text="") + col.prop(yaf_mat, "material1name", text="") col = split.column() col.label(text="Material two:") - col.prop(yaf_mat, "material2", text="") + col.prop(yaf_mat, "material2name", text="") From b62c915162e421ed1460d45f42a976d87881063a Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 20 Jun 2015 09:20:49 +0200 Subject: [PATCH 16/81] Add Shadow Bias and Min Ray Dist advanced parameters Although the new Automatic Shadow Bias and Min Ray Dist factors calculation introduced in the v0.1.99-beta2 improves the self shadowing artifacts in certain scenes, there are still certain scenes that could suffer self shadow problems. Also, the automatic calculation could introduce new artifacts in certain cases and scenes. Creating a better algorithm to avoid self-shadow problems could be very time consuming, introduce new possible issues and artifacts and even increasing the memory usage and/or CPU usage. Therefore, I'll go for a "hybrid" solution. By default, the Shadow Bias and Min Ray Dist factors will be automatically calculated, to keep the YafaRay spirit of "making things easy for the users". However, this modification introduces now new "advanced" parameters, so expert users could disable the automatic calculation and set manual Shadow Bias Factor and/or Min Ray Dist Factor. The advantages of doing this: * Avoiding new calculation algorithms that would affect everything and perhaps introduce new issues and potentially increasing CPU/RAM usage. * For normal users the automatic calculation should be enough in most cases, making YafaRay easy enough to use. * For expert users when encountering issues with self shadow or light leaking, they could fine tune these factors to achieve the desired results, even in scenes with strange meshes or special requirements. * Being able to manually set these factors would also help with: - Terminator problems: "blocky" terminators in low-poly smooth meshes should be solved by subdividing the surfaces more, but if that's not possible, adjusting these factors could help. - Photon leaking: in some cases, photon leaking could happen depending on the scene and the requirements for the rendered result. Adjusting manually the Min Ray Dist could help solving those issues. - Any artifacts that could be caused by the automatic calculation could be solved by disabling it and setting the factor manually. So, I believe this way, we keep YafaRay easy to use and, at the same time, we provide additional control for special fine tuning. We will have a more complete now, as we can do any of the following: * Have both Shadow Bias and Min Ray Dist calculated automatically (new behavior introduced in v0.1.99-beta2) * Disable Shadow Bias Automatic calculation, setting a fixed factor of 0.0005. This would emulate the original YafaRay behavior previous to v0.1.99-beta2, where the Shadow Bias was 0.0005 and the Min Ray Dist was 0.00005. * Disable Shadow Bias Automatic and/or Min Ray Dist Automatic and set different values. This would allow a new functionality that could be used (carefully) to fine tune the render of a specially difficult scene, where light leaks and/or shadow artifacts appear. I also believe this solution is justified, especially when other ray tracers (even VRay) have similar factors available for the users. Changes to be committed: modified: io/yaf_scene.py modified: prop/yaf_scene.py modified: ui/properties_yaf_render.py --- io/yaf_scene.py | 5 +++++ prop/yaf_scene.py | 24 ++++++++++++++++++++++++ ui/properties_yaf_render.py | 24 ++++++++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/io/yaf_scene.py b/io/yaf_scene.py index a502acc2..6635fcdd 100644 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -128,3 +128,8 @@ def exportRenderSettings(yi, scene): yi.paramsSetInt("threads", scene.gs_threads) yi.paramsSetString("background_name", "world_background") + + yi.paramsSetBool("adv_auto_shadow_bias_enabled", scene.adv_auto_shadow_bias_enabled) + yi.paramsSetFloat("adv_shadow_bias_value", scene.adv_shadow_bias_value) + yi.paramsSetBool("adv_auto_min_raydist_enabled", scene.adv_auto_min_raydist_enabled) + yi.paramsSetFloat("adv_min_raydist_value", scene.adv_min_raydist_value) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 032932bf..d5b13ae7 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -126,6 +126,26 @@ def register(): description="Materials refract the background as transparent", default=True) + Scene.adv_auto_shadow_bias_enabled = BoolProperty( + name="Shadow Bias Automatic", + description="Shadow Bias Automatic Calculation (recommended). Disable ONLY if artifacts or black dots due to bad self-shadowing, otherwise LEAVE THIS ENABLED FOR NORMAL SCENES", + default=True) + + Scene.adv_shadow_bias_value = FloatProperty( + name="Shadow Bias Factor", + description="Shadow Bias (default 0.0005). Change ONLY if artifacts or black dots due to bad self-shadowing. Increasing this value can led to artifacts and incorrect renders.", + min=0.00000001, max=10000, default=0.0005) + + Scene.adv_auto_min_raydist_enabled = BoolProperty( + name="Min Ray Dist Automatic", + description="Min Ray Dist Automatic Calculation (recommended), based on the Shadow Bias factor. Disable ONLY if artifacts or light leaks due to bad ray intersections, otherwise LEAVE THIS ENABLED FOR NORMAL SCENES", + default=True) + + Scene.adv_min_raydist_value = FloatProperty( + name="Min Ray Dist Factor", + description="Min Ray Dist (default 0.00005). Change ONLY if artifacts or light leaks due to bad ray intersections. Increasing this value can led to artifacts and incorrect renders.", + min=0.00000001, max=10000, default=0.00005) + Scene.gs_custom_string = StringProperty( name="Custom string", description="Custom string will be added to the info bar, " @@ -413,6 +433,10 @@ def unregister(): Scene.gs_draw_params Scene.bg_transp Scene.bg_transp_refract + Scene.adv_auto_shadow_bias_enabled + Scene.adv_shadow_bias_value + Scene.adv_auto_min_raydist_enabled + Scene.adv_min_raydist_value Scene.gs_custom_string Scene.gs_premult Scene.gs_transp_shad diff --git a/ui/properties_yaf_render.py b/ui/properties_yaf_render.py index 0d6d9a14..4f54a5ac 100644 --- a/ui/properties_yaf_render.py +++ b/ui/properties_yaf_render.py @@ -165,6 +165,30 @@ def draw(self, context): layout.column().operator("data.convert_yafaray_properties", text="Convert data from 2.4x") +class YAF_PT_advanced(RenderButtonsPanel, Panel): + bl_label = "Advanced Settings - only for experts" + bl_options = {'DEFAULT_CLOSED'} + + def draw(self, context): + scene = context.scene + layout = self.layout + split = layout.split() + col = split.column() + col.prop(scene, "adv_auto_shadow_bias_enabled") + if not scene.adv_auto_shadow_bias_enabled: + col = split.column() + sub = col.column() + sub.prop(scene, "adv_shadow_bias_value") + + split = layout.split() + col = split.column() + col.prop(scene, "adv_auto_min_raydist_enabled") + if not scene.adv_auto_min_raydist_enabled: + col = split.column() + sub = col.column() + sub.prop(scene, "adv_min_raydist_value") + + if __name__ == "__main__": # only for live edit. import bpy bpy.utils.register_module(__name__) From d382b1f8168914b1488d740827bc35b8116c6b86 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 20 Jun 2015 14:05:07 +0200 Subject: [PATCH 17/81] Changes to version and README --- README | 17 ++++++++++++++--- __init__.py | 4 ++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/README b/README index 0131f0af..fdb0c02a 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Yafaray 0.1.99-beta3 (2015-05-02) David Bluecame experimental exporter for Blender 2.74.5 (up to Blender builbots for 2015-05-02): +Yafaray 0.1.99-beta4 (2015-06-20) David Bluecame experimental exporter for Blender 2.75 RC: ** THIS BUILD CONTAINS EXPERIMENTAL CHANGES AND FEATURES - DO NOT USE FOR PRODUCTION SCENES ** Unofficial build for XXXX (XX bits) by David Bluecame @@ -31,8 +31,19 @@ I also added a (non-texture) mirror amount slider in the Coated Glossy material Unfortunately due to Blender API limitations, in some of the new texture sliders, the "tooltip" information that appears when hovering the mouse over the slider, can be misleading and not represent the actual function of that slider. However, I took care in setting the description correctly so just by looking at the slider itself you can see what does it map. -*WARNING* This build includes an EXPERIMENTAL change to calculate automatically Shadow Bias and Minimum Ray Dist depending on the scene size. This is to avoid black artifacts when resizing the objects. However as it's a fundamental change that affects everything, perhaps some new artifacts could appear in the images now and further fine tuning needed in this new formula. Please give us feedback about it in the forum: -http://www.yafaray.org/community/forum/viewtopic.php?f=23&t=5084 +* Changes to the blend material "component" material1,material2 handling. In previous versions if you created or deleted materials in the .blend file, sometimes all the material components of the blend materials changed or dissapeared randomly. To avoid it, now the materials are referenced by name using strings. You cannot use dropdown menus anymore to select the blend submaterials, and you have to be careful now not to rename the materials used by "blend" materials. However, with the new system if you create or delete other materials it will not affect the blend material1,material2 assignments. + +Also, I've increased the level of detail in the YafaRay Log, so if there are any problems with missing components in blend materials it should be easy to spot and correct by reading the YafaRay Log. + +WARNING: this change breaks backwards compatibility. When opening a .blend created with an older version of YafaRay the blend material components will be "upgraded" to the new system, but the"blend" materials in a blend made with the new version could behave wrongly if you open it with an older version. + +* New advanced parameters for fine control of Shadow Bias/Min Ray Dist if the automatic calculation is not good enough. Please give us feedback about it in the forum: http://www.yafaray.org/community/forum/viewtopic.php?f=23&t=5084 + +* Fix for caustics noise coming from Non-IBL background in Photon Mapping. Now the background will only be used for Caustics if IBL is enabled and (if there is a caustics parameter available in the background settings) if caustics is enabled in the background. + +* Background "power" parameters relocated to places where they make more sense. They were hidden and only visible when IBL was enabled, but most of the times the power parameter affects the background rendering even if IBL is disabled. + + To install YafaRay to blender: * Don't use the Blender from the distro repositories. Download the Blender official Linux 64bit build from: http://ftp.halifax.rwth-aachen.de/blender/release/Blender2.74/blender-2.74-linux-glibc211-x86_64.tar.bz2 and uncompress it in a folder, for example in $HOME/ diff --git a/__init__.py b/__init__.py index 7d9fc0fc..8d380145 100644 --- a/__init__.py +++ b/__init__.py @@ -35,8 +35,8 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": (0, 1, 99, 'Experimental beta3'), - "blender": (2, 7, 4), + "version": (0, 1, 99, 'Experimental beta4'), + "blender": (2, 7, 5), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", "tracker_url": "http://www.yafaray.org/development/bugtracker/yafaray", From 5a41ee1a669e799bd6f38aac40892df021b15c0e Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 24 Jul 2015 18:13:13 +0200 Subject: [PATCH 18/81] New parameter - cast shadows As requested in http://www.yafaray.org/node/665 a new Material parameter has been added to enable/disable casting shadows. The default value is to be enabled, as that's the expected behavior for all objects in a scene. However, if certain objects need to be created shadowless (like in some architectural images), then shadow casting can be disabled in a per-material basis. Changes to be committed: modified: io/yaf_material.py modified: prop/yaf_material.py modified: ui/properties_yaf_material.py --- io/yaf_material.py | 5 ++++ prop/yaf_material.py | 5 ++++ ui/properties_yaf_material.py | 50 +++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/io/yaf_material.py b/io/yaf_material.py index 1a6ddae7..65063093 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -235,6 +235,7 @@ def writeGlassShader(self, mat, scene, rough): yi.paramsSetFloat("absorption_dist", mat.absorption_dist) yi.paramsSetFloat("dispersion_power", mat.dispersion_power) yi.paramsSetBool("fake_shadows", mat.fake_shadows) + yi.paramsSetBool("cast_shadows", mat.cast_shadows) mcolRoot = '' # fcolRoot = '' /* UNUSED */ @@ -314,6 +315,7 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c yi.paramsSetFloat("exp_u", mat.exp_u) yi.paramsSetFloat("exp_v", mat.exp_v) yi.paramsSetFloat("specular_reflect", bSpecr) + yi.paramsSetBool("cast_shadows", mat.cast_shadows) diffRoot = '' # mcolRoot = '' /* UNUSED */ @@ -545,6 +547,7 @@ def writeShinyDiffuseShader(self, mat, scene): yi.paramsSetColor("mirror_color", mirCol[0], mirCol[1], mirCol[2]) yi.paramsSetBool("fresnel_effect", mat.fresnel_effect) yi.paramsSetFloat("IOR", mat.IOR_reflection) # added IOR for reflection + yi.paramsSetBool("cast_shadows", mat.cast_shadows) if scene.gs_clay_render and not mat.clay_exclude: if scene.gs_clay_oren_nayar: @@ -594,6 +597,8 @@ def writeBlendShader(self, mat, scene): else: yi.paramsSetFloat("blend_value", mat.blend_value) + yi.paramsSetBool("cast_shadows", mat.cast_shadows) + return yi.createMaterial(self.namehash(mat)) def writeMatteShader(self, mat, scene): diff --git a/prop/yaf_material.py b/prop/yaf_material.py index 1b6236c1..94baddac 100644 --- a/prop/yaf_material.py +++ b/prop/yaf_material.py @@ -289,6 +289,10 @@ def register(): description="Second blend material") #, get=get_blend_mat2_old_scenes) + Material.cast_shadows = BoolProperty( + name="Cast shadows", + description="Enable casting shadows. This is the normal and expected behavior. Disable it only for special cases!", + default=True) def unregister(): del Material.mat_type @@ -325,3 +329,4 @@ def unregister(): del Material.material2 del Material.material1name del Material.material2name + del Material.cast_shadows diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index fb85d965..fd82a593 100644 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -195,7 +195,19 @@ def draw(self, context): sub.enabled = yaf_mat.fresnel_effect sub.prop(yaf_mat, "IOR_reflection", slider=True) layout.row().prop(yaf_mat, "specular_reflect", slider=True) + +class YAF_PT_shinydiffuse_advanced(MaterialTypePanel, Panel): + bl_label = "Advanced settings" + bl_options = {'DEFAULT_CLOSED'} + material_type = 'shinydiffusemat' + def draw(self, context): + layout = self.layout + yaf_mat = active_node_mat(context.material) + + split = layout.split() + col = split.column() + layout.row().prop(yaf_mat, "cast_shadows") class YAF_PT_glossy_diffuse(MaterialTypePanel, Panel): bl_label = "Diffuse reflection" @@ -258,6 +270,19 @@ def draw(self, context): col.label() layout.row().prop(yaf_mat, "specular_reflect", slider=True) +class YAF_PT_glossy_advanced(MaterialTypePanel, Panel): + bl_label = "Advanced settings" + bl_options = {'DEFAULT_CLOSED'} + material_type = 'glossy', 'coated_glossy' + + def draw(self, context): + layout = self.layout + yaf_mat = active_node_mat(context.material) + + split = layout.split() + col = split.column() + layout.row().prop(yaf_mat, "cast_shadows") + class YAF_PT_glass_real(MaterialTypePanel, Panel): bl_label = "Real glass settings" @@ -306,6 +331,19 @@ def draw(self, context): layout.row().prop(yaf_mat, "glass_transmit", slider=True) layout.row().prop(yaf_mat, "fake_shadows") +class YAF_PT_glass_advanced(MaterialTypePanel, Panel): + bl_label = "Advanced settings" + bl_options = {'DEFAULT_CLOSED'} + material_type = 'glass', 'rough_glass' + + def draw(self, context): + layout = self.layout + yaf_mat = active_node_mat(context.material) + + split = layout.split() + col = split.column() + layout.row().prop(yaf_mat, "cast_shadows") + class YAF_PT_blend_(MaterialTypePanel, Panel): bl_label = "Blend material settings" @@ -344,6 +382,18 @@ def draw(self, context): col.label(text="Material two:") col.prop(yaf_mat, "material2name", text="") +class YAF_PT_blend_advanced(MaterialTypePanel, Panel): + bl_label = "Advanced settings" + bl_options = {'DEFAULT_CLOSED'} + material_type = 'blend' + + def draw(self, context): + layout = self.layout + yaf_mat = active_node_mat(context.material) + + split = layout.split() + col = split.column() + layout.row().prop(yaf_mat, "cast_shadows") if __name__ == "__main__": # only for live edit. From ff30c6f45ae39a74864507fd7d6277523931f83e Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Wed, 29 Jul 2015 05:46:02 +0200 Subject: [PATCH 19/81] More advanced material visibility and shadow control I've removed the recently added cast_shadow parameter and replaced it by a "visibility" parameter (enum type) so we can control the material visibility and shadow at the same time. The visibility option (in the material advanced settings) will have these possible values (per-material): 'normal' (default): Normal - Normal visibility - visible casting shadows. 'no_shadows': No shadows - visible but not casting shadows. 'shadow_only': Shadows only - invisible but casting shadows. 'invisible': Invisible: totally invisible material. Changes to be committed: modified: README modified: __init__.py modified: io/yaf_light.py modified: io/yaf_material.py modified: prop/yaf_light.py modified: prop/yaf_material.py modified: ui/properties_yaf_light.py modified: ui/properties_yaf_material.py --- README | 2 +- __init__.py | 2 +- io/yaf_light.py | 7 ++++++ io/yaf_material.py | 8 +++--- prop/yaf_light.py | 6 +++++ prop/yaf_material.py | 16 ++++++++---- ui/properties_yaf_light.py | 13 ++++++++++ ui/properties_yaf_material.py | 46 +++-------------------------------- 8 files changed, 47 insertions(+), 53 deletions(-) diff --git a/README b/README index fdb0c02a..59caab4b 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Yafaray 0.1.99-beta4 (2015-06-20) David Bluecame experimental exporter for Blender 2.75 RC: +Yafaray 0.1.99-beta4c (2015-07-29) David Bluecame experimental exporter for Blender 2.75 RC: ** THIS BUILD CONTAINS EXPERIMENTAL CHANGES AND FEATURES - DO NOT USE FOR PRODUCTION SCENES ** Unofficial build for XXXX (XX bits) by David Bluecame diff --git a/__init__.py b/__init__.py index 8d380145..86ec130b 100644 --- a/__init__.py +++ b/__init__.py @@ -35,7 +35,7 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": (0, 1, 99, 'Experimental beta4'), + "version": (0, 1, 99, 'Experimental beta4c'), "blender": (2, 7, 5), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", diff --git a/io/yaf_light.py b/io/yaf_light.py index af1bc351..3fe63d01 100644 --- a/io/yaf_light.py +++ b/io/yaf_light.py @@ -119,6 +119,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetInt("samples", lamp.yaf_samples) yi.paramsSetFloat("radius", lamp.yaf_sphere_radius) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) elif lampType == "spot": if self.preview and name == "Lamp.002": @@ -138,6 +139,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetBool("photon_only", lamp.photon_only) yi.paramsSetInt("samples", lamp.yaf_samples) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) elif lampType == "sun": yi.paramsSetString("type", "sunlight") @@ -145,6 +147,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetFloat("angle", lamp.angle) yi.paramsSetPoint("direction", direct[0], direct[1], direct[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) elif lampType == "directional": yi.paramsSetString("type", "directional") @@ -154,6 +157,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetFloat("radius", lamp.shadow_soft_size) yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) elif lampType == "ies": yi.paramsSetString("type", "ieslight") @@ -166,6 +170,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetInt("samples", lamp.yaf_samples) yi.paramsSetBool("soft_shadows", lamp.ies_soft_shadows) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) elif lampType == "area": sizeX = lamp.size @@ -210,6 +215,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetPoint("point1", corner1[0], corner1[1], corner1[2]) yi.paramsSetPoint("point2", corner3[0], corner3[1], corner3[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) if lampType not in {"sun", "directional"}: # "from" is not used for sunlight and infinite directional light @@ -223,6 +229,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetColor("color", color[0], color[1], color[2]) yi.paramsSetFloat("power", power) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) yi.createLight(name) return True diff --git a/io/yaf_material.py b/io/yaf_material.py index 65063093..a7383a07 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -235,7 +235,7 @@ def writeGlassShader(self, mat, scene, rough): yi.paramsSetFloat("absorption_dist", mat.absorption_dist) yi.paramsSetFloat("dispersion_power", mat.dispersion_power) yi.paramsSetBool("fake_shadows", mat.fake_shadows) - yi.paramsSetBool("cast_shadows", mat.cast_shadows) + yi.paramsSetString("visibility", mat.visibility) mcolRoot = '' # fcolRoot = '' /* UNUSED */ @@ -315,7 +315,7 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c yi.paramsSetFloat("exp_u", mat.exp_u) yi.paramsSetFloat("exp_v", mat.exp_v) yi.paramsSetFloat("specular_reflect", bSpecr) - yi.paramsSetBool("cast_shadows", mat.cast_shadows) + yi.paramsSetString("visibility", mat.visibility) diffRoot = '' # mcolRoot = '' /* UNUSED */ @@ -547,7 +547,7 @@ def writeShinyDiffuseShader(self, mat, scene): yi.paramsSetColor("mirror_color", mirCol[0], mirCol[1], mirCol[2]) yi.paramsSetBool("fresnel_effect", mat.fresnel_effect) yi.paramsSetFloat("IOR", mat.IOR_reflection) # added IOR for reflection - yi.paramsSetBool("cast_shadows", mat.cast_shadows) + yi.paramsSetString("visibility", mat.visibility) if scene.gs_clay_render and not mat.clay_exclude: if scene.gs_clay_oren_nayar: @@ -597,7 +597,7 @@ def writeBlendShader(self, mat, scene): else: yi.paramsSetFloat("blend_value", mat.blend_value) - yi.paramsSetBool("cast_shadows", mat.cast_shadows) + yi.paramsSetString("visibility", mat.visibility) return yi.createMaterial(self.namehash(mat)) diff --git a/prop/yaf_light.py b/prop/yaf_light.py index 03c51fca..de86b878 100644 --- a/prop/yaf_light.py +++ b/prop/yaf_light.py @@ -139,6 +139,11 @@ def register(): name="Light enabled", description="Enable/Disable light", default=True) + + Lamp.cast_shadows = BoolProperty( + name="Cast shadows", + description="Enable casting shadows. This is the normal and expected behavior. Disable it only for special cases!", + default=True) def unregister(): del Lamp.lamp_type @@ -156,3 +161,4 @@ def unregister(): del Lamp.yaf_samples del Lamp.yaf_show_dist_clip del Lamp.light_enabled + del Lamp.cast_shadows diff --git a/prop/yaf_material.py b/prop/yaf_material.py index 94baddac..158482a7 100644 --- a/prop/yaf_material.py +++ b/prop/yaf_material.py @@ -289,10 +289,16 @@ def register(): description="Second blend material") #, get=get_blend_mat2_old_scenes) - Material.cast_shadows = BoolProperty( - name="Cast shadows", - description="Enable casting shadows. This is the normal and expected behavior. Disable it only for special cases!", - default=True) + Material.visibility = EnumProperty( + name="Visibility", + items=( + ('invisible', "Invisible", "Totally invisible"), + ('shadow_only', "Shadows only", "Invisible but casting shadows"), + ('no_shadows', "No shadows", "Visible but not casting shadows"), + ('normal', "Normal", "Normal visibility - visible casting shadows"), + + ), + default='normal') def unregister(): del Material.mat_type @@ -329,4 +335,4 @@ def unregister(): del Material.material2 del Material.material1name del Material.material2name - del Material.cast_shadows + del Material.visibility diff --git a/ui/properties_yaf_light.py b/ui/properties_yaf_light.py index 17e6f91c..2d548bc0 100644 --- a/ui/properties_yaf_light.py +++ b/ui/properties_yaf_light.py @@ -162,6 +162,19 @@ def draw(self, context): col.label(text="") col.prop(lamp, "shadow_buffer_clip_end", text=" Clip End") +class YAF_PT_lamp_advanced(DataButtonsPanel, Panel): + bl_label = "Advanced settings" + bl_options = {'DEFAULT_CLOSED'} + COMPAT_ENGINES = {'YAFA_RENDER'} + + def draw(self, context): + layout = self.layout + lamp = context.lamp + + split = layout.split() + col = split.column() + layout.row().prop(lamp, "cast_shadows") + if __name__ == "__main__": # only for live edit. import bpy diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index fd82a593..81803aff 100644 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -196,18 +196,6 @@ def draw(self, context): sub.prop(yaf_mat, "IOR_reflection", slider=True) layout.row().prop(yaf_mat, "specular_reflect", slider=True) -class YAF_PT_shinydiffuse_advanced(MaterialTypePanel, Panel): - bl_label = "Advanced settings" - bl_options = {'DEFAULT_CLOSED'} - material_type = 'shinydiffusemat' - - def draw(self, context): - layout = self.layout - yaf_mat = active_node_mat(context.material) - - split = layout.split() - col = split.column() - layout.row().prop(yaf_mat, "cast_shadows") class YAF_PT_glossy_diffuse(MaterialTypePanel, Panel): bl_label = "Diffuse reflection" @@ -270,19 +258,6 @@ def draw(self, context): col.label() layout.row().prop(yaf_mat, "specular_reflect", slider=True) -class YAF_PT_glossy_advanced(MaterialTypePanel, Panel): - bl_label = "Advanced settings" - bl_options = {'DEFAULT_CLOSED'} - material_type = 'glossy', 'coated_glossy' - - def draw(self, context): - layout = self.layout - yaf_mat = active_node_mat(context.material) - - split = layout.split() - col = split.column() - layout.row().prop(yaf_mat, "cast_shadows") - class YAF_PT_glass_real(MaterialTypePanel, Panel): bl_label = "Real glass settings" @@ -331,19 +306,6 @@ def draw(self, context): layout.row().prop(yaf_mat, "glass_transmit", slider=True) layout.row().prop(yaf_mat, "fake_shadows") -class YAF_PT_glass_advanced(MaterialTypePanel, Panel): - bl_label = "Advanced settings" - bl_options = {'DEFAULT_CLOSED'} - material_type = 'glass', 'rough_glass' - - def draw(self, context): - layout = self.layout - yaf_mat = active_node_mat(context.material) - - split = layout.split() - col = split.column() - layout.row().prop(yaf_mat, "cast_shadows") - class YAF_PT_blend_(MaterialTypePanel, Panel): bl_label = "Blend material settings" @@ -382,18 +344,18 @@ def draw(self, context): col.label(text="Material two:") col.prop(yaf_mat, "material2name", text="") -class YAF_PT_blend_advanced(MaterialTypePanel, Panel): + +class YAF_PT_advanced(MaterialButtonsPanel, Panel): bl_label = "Advanced settings" bl_options = {'DEFAULT_CLOSED'} - material_type = 'blend' - + def draw(self, context): layout = self.layout yaf_mat = active_node_mat(context.material) split = layout.split() col = split.column() - layout.row().prop(yaf_mat, "cast_shadows") + layout.row().prop(yaf_mat, "visibility") if __name__ == "__main__": # only for live edit. From 4242caba49519487112956b4705e114c01c637d6 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Wed, 29 Jul 2015 05:46:02 +0200 Subject: [PATCH 20/81] More advanced material visibility and shadow control I've added a parameter to control which lights cast shadows and which ones do not. Also, I've removed the recently added cast_shadow parameter and replaced it by a "visibility" parameter (enum type) so we can control the material visibility and shadow at the same time. The visibility option (in the material advanced settings) will have these possible values (per-material): 'normal' (default): Normal - Normal visibility - visible casting shadows. 'no_shadows': No shadows - visible but not casting shadows. 'shadow_only': Shadows only - invisible but casting shadows. 'invisible': Invisible: totally invisible material. Changes to be committed: modified: README modified: __init__.py modified: io/yaf_light.py modified: io/yaf_material.py modified: prop/yaf_light.py modified: prop/yaf_material.py modified: ui/properties_yaf_light.py modified: ui/properties_yaf_material.py --- README | 2 +- __init__.py | 2 +- io/yaf_light.py | 7 ++++++ io/yaf_material.py | 8 +++--- prop/yaf_light.py | 6 +++++ prop/yaf_material.py | 16 ++++++++---- ui/properties_yaf_light.py | 13 ++++++++++ ui/properties_yaf_material.py | 46 +++-------------------------------- 8 files changed, 47 insertions(+), 53 deletions(-) diff --git a/README b/README index fdb0c02a..59caab4b 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Yafaray 0.1.99-beta4 (2015-06-20) David Bluecame experimental exporter for Blender 2.75 RC: +Yafaray 0.1.99-beta4c (2015-07-29) David Bluecame experimental exporter for Blender 2.75 RC: ** THIS BUILD CONTAINS EXPERIMENTAL CHANGES AND FEATURES - DO NOT USE FOR PRODUCTION SCENES ** Unofficial build for XXXX (XX bits) by David Bluecame diff --git a/__init__.py b/__init__.py index 8d380145..86ec130b 100644 --- a/__init__.py +++ b/__init__.py @@ -35,7 +35,7 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": (0, 1, 99, 'Experimental beta4'), + "version": (0, 1, 99, 'Experimental beta4c'), "blender": (2, 7, 5), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", diff --git a/io/yaf_light.py b/io/yaf_light.py index af1bc351..3fe63d01 100644 --- a/io/yaf_light.py +++ b/io/yaf_light.py @@ -119,6 +119,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetInt("samples", lamp.yaf_samples) yi.paramsSetFloat("radius", lamp.yaf_sphere_radius) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) elif lampType == "spot": if self.preview and name == "Lamp.002": @@ -138,6 +139,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetBool("photon_only", lamp.photon_only) yi.paramsSetInt("samples", lamp.yaf_samples) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) elif lampType == "sun": yi.paramsSetString("type", "sunlight") @@ -145,6 +147,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetFloat("angle", lamp.angle) yi.paramsSetPoint("direction", direct[0], direct[1], direct[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) elif lampType == "directional": yi.paramsSetString("type", "directional") @@ -154,6 +157,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetFloat("radius", lamp.shadow_soft_size) yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) elif lampType == "ies": yi.paramsSetString("type", "ieslight") @@ -166,6 +170,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetInt("samples", lamp.yaf_samples) yi.paramsSetBool("soft_shadows", lamp.ies_soft_shadows) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) elif lampType == "area": sizeX = lamp.size @@ -210,6 +215,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetPoint("point1", corner1[0], corner1[1], corner1[2]) yi.paramsSetPoint("point2", corner3[0], corner3[1], corner3[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) if lampType not in {"sun", "directional"}: # "from" is not used for sunlight and infinite directional light @@ -223,6 +229,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetColor("color", color[0], color[1], color[2]) yi.paramsSetFloat("power", power) yi.paramsSetBool("light_enabled", lamp.light_enabled) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) yi.createLight(name) return True diff --git a/io/yaf_material.py b/io/yaf_material.py index 65063093..a7383a07 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -235,7 +235,7 @@ def writeGlassShader(self, mat, scene, rough): yi.paramsSetFloat("absorption_dist", mat.absorption_dist) yi.paramsSetFloat("dispersion_power", mat.dispersion_power) yi.paramsSetBool("fake_shadows", mat.fake_shadows) - yi.paramsSetBool("cast_shadows", mat.cast_shadows) + yi.paramsSetString("visibility", mat.visibility) mcolRoot = '' # fcolRoot = '' /* UNUSED */ @@ -315,7 +315,7 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c yi.paramsSetFloat("exp_u", mat.exp_u) yi.paramsSetFloat("exp_v", mat.exp_v) yi.paramsSetFloat("specular_reflect", bSpecr) - yi.paramsSetBool("cast_shadows", mat.cast_shadows) + yi.paramsSetString("visibility", mat.visibility) diffRoot = '' # mcolRoot = '' /* UNUSED */ @@ -547,7 +547,7 @@ def writeShinyDiffuseShader(self, mat, scene): yi.paramsSetColor("mirror_color", mirCol[0], mirCol[1], mirCol[2]) yi.paramsSetBool("fresnel_effect", mat.fresnel_effect) yi.paramsSetFloat("IOR", mat.IOR_reflection) # added IOR for reflection - yi.paramsSetBool("cast_shadows", mat.cast_shadows) + yi.paramsSetString("visibility", mat.visibility) if scene.gs_clay_render and not mat.clay_exclude: if scene.gs_clay_oren_nayar: @@ -597,7 +597,7 @@ def writeBlendShader(self, mat, scene): else: yi.paramsSetFloat("blend_value", mat.blend_value) - yi.paramsSetBool("cast_shadows", mat.cast_shadows) + yi.paramsSetString("visibility", mat.visibility) return yi.createMaterial(self.namehash(mat)) diff --git a/prop/yaf_light.py b/prop/yaf_light.py index 03c51fca..de86b878 100644 --- a/prop/yaf_light.py +++ b/prop/yaf_light.py @@ -139,6 +139,11 @@ def register(): name="Light enabled", description="Enable/Disable light", default=True) + + Lamp.cast_shadows = BoolProperty( + name="Cast shadows", + description="Enable casting shadows. This is the normal and expected behavior. Disable it only for special cases!", + default=True) def unregister(): del Lamp.lamp_type @@ -156,3 +161,4 @@ def unregister(): del Lamp.yaf_samples del Lamp.yaf_show_dist_clip del Lamp.light_enabled + del Lamp.cast_shadows diff --git a/prop/yaf_material.py b/prop/yaf_material.py index 94baddac..158482a7 100644 --- a/prop/yaf_material.py +++ b/prop/yaf_material.py @@ -289,10 +289,16 @@ def register(): description="Second blend material") #, get=get_blend_mat2_old_scenes) - Material.cast_shadows = BoolProperty( - name="Cast shadows", - description="Enable casting shadows. This is the normal and expected behavior. Disable it only for special cases!", - default=True) + Material.visibility = EnumProperty( + name="Visibility", + items=( + ('invisible', "Invisible", "Totally invisible"), + ('shadow_only', "Shadows only", "Invisible but casting shadows"), + ('no_shadows', "No shadows", "Visible but not casting shadows"), + ('normal', "Normal", "Normal visibility - visible casting shadows"), + + ), + default='normal') def unregister(): del Material.mat_type @@ -329,4 +335,4 @@ def unregister(): del Material.material2 del Material.material1name del Material.material2name - del Material.cast_shadows + del Material.visibility diff --git a/ui/properties_yaf_light.py b/ui/properties_yaf_light.py index 17e6f91c..2d548bc0 100644 --- a/ui/properties_yaf_light.py +++ b/ui/properties_yaf_light.py @@ -162,6 +162,19 @@ def draw(self, context): col.label(text="") col.prop(lamp, "shadow_buffer_clip_end", text=" Clip End") +class YAF_PT_lamp_advanced(DataButtonsPanel, Panel): + bl_label = "Advanced settings" + bl_options = {'DEFAULT_CLOSED'} + COMPAT_ENGINES = {'YAFA_RENDER'} + + def draw(self, context): + layout = self.layout + lamp = context.lamp + + split = layout.split() + col = split.column() + layout.row().prop(lamp, "cast_shadows") + if __name__ == "__main__": # only for live edit. import bpy diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index fd82a593..81803aff 100644 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -196,18 +196,6 @@ def draw(self, context): sub.prop(yaf_mat, "IOR_reflection", slider=True) layout.row().prop(yaf_mat, "specular_reflect", slider=True) -class YAF_PT_shinydiffuse_advanced(MaterialTypePanel, Panel): - bl_label = "Advanced settings" - bl_options = {'DEFAULT_CLOSED'} - material_type = 'shinydiffusemat' - - def draw(self, context): - layout = self.layout - yaf_mat = active_node_mat(context.material) - - split = layout.split() - col = split.column() - layout.row().prop(yaf_mat, "cast_shadows") class YAF_PT_glossy_diffuse(MaterialTypePanel, Panel): bl_label = "Diffuse reflection" @@ -270,19 +258,6 @@ def draw(self, context): col.label() layout.row().prop(yaf_mat, "specular_reflect", slider=True) -class YAF_PT_glossy_advanced(MaterialTypePanel, Panel): - bl_label = "Advanced settings" - bl_options = {'DEFAULT_CLOSED'} - material_type = 'glossy', 'coated_glossy' - - def draw(self, context): - layout = self.layout - yaf_mat = active_node_mat(context.material) - - split = layout.split() - col = split.column() - layout.row().prop(yaf_mat, "cast_shadows") - class YAF_PT_glass_real(MaterialTypePanel, Panel): bl_label = "Real glass settings" @@ -331,19 +306,6 @@ def draw(self, context): layout.row().prop(yaf_mat, "glass_transmit", slider=True) layout.row().prop(yaf_mat, "fake_shadows") -class YAF_PT_glass_advanced(MaterialTypePanel, Panel): - bl_label = "Advanced settings" - bl_options = {'DEFAULT_CLOSED'} - material_type = 'glass', 'rough_glass' - - def draw(self, context): - layout = self.layout - yaf_mat = active_node_mat(context.material) - - split = layout.split() - col = split.column() - layout.row().prop(yaf_mat, "cast_shadows") - class YAF_PT_blend_(MaterialTypePanel, Panel): bl_label = "Blend material settings" @@ -382,18 +344,18 @@ def draw(self, context): col.label(text="Material two:") col.prop(yaf_mat, "material2name", text="") -class YAF_PT_blend_advanced(MaterialTypePanel, Panel): + +class YAF_PT_advanced(MaterialButtonsPanel, Panel): bl_label = "Advanced settings" bl_options = {'DEFAULT_CLOSED'} - material_type = 'blend' - + def draw(self, context): layout = self.layout yaf_mat = active_node_mat(context.material) split = layout.split() col = split.column() - layout.row().prop(yaf_mat, "cast_shadows") + layout.row().prop(yaf_mat, "visibility") if __name__ == "__main__": # only for live edit. From e3cdc46e8f1a2aa7d4b59797a9764da3a1fe621e Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 3 Oct 2015 16:57:47 +0200 Subject: [PATCH 21/81] Prototype for new Color Pipeline workflow Initial prototype to try to fix the (apparently broken) YafaRay color pipeline workflow and to replace the simple gamma input/output correction with a proper sRGB decoding/coding in non-HDR files. More information here: http://www.yafaray.org/node/670 So, I've prepared a YafaRay prototype that fixes the next issues: * Improved Blender Color Space integration. * The "simple" gamma correction has been replaced by Color Spaces: - LinearRGB Linear values, no gamma correction - sRGB sRGB encoding/decoding - XYZ XYZ (very experimental) support - Raw_Manual_Gamma Raw linear values that allow to set a simple gamma output correction manually * Fixed: Double application of input gamma to the Blender Color picker. So now scenes will look brighter in general, but they should also look more realistic with less tweaking. * Gamma input correction no longer used. The color picker floating point color values will be considered already linear and no conversion applied to them. * For textures, added specific per-texture Color Space and gamma parameters. * The color values exported to the XML file will be encoded acording to Blender Output Device Color Space setting. * In yafaray-xml, new commandline option added: "-ics" or "--input-color-space" that allows to select how to interpret the XML color values. By default, for backwards compatibility, color values will be read as "LinearRGB", but using "-ics sRGB", the color values will be interpreted as sRGB. This setting does *not* affect the textures, as they have already per-texture specific color space/gamma parameters. * Fixed: when exporting to file there was an error in Blender while reopening it to be shown in the Blender image view. Pending: * Review by the official YafaRay developers. * Addidional tests. Changes to be committed: modified: io/yaf_export.py modified: io/yaf_scene.py modified: io/yaf_texture.py modified: io/yaf_world.py modified: prop/yaf_texture.py modified: ui/__init__.py modified: ui/properties_yaf_general_settings.py modified: ui/properties_yaf_render.py modified: ui/properties_yaf_texture.py modified: ui/properties_yaf_world.py --- io/yaf_export.py | 24 ++++++++++++++++---- io/yaf_scene.py | 32 ++++++++++++++++++++++++++- io/yaf_texture.py | 25 ++++++++++++++++++--- io/yaf_world.py | 19 ++++++++++++++++ prop/yaf_texture.py | 9 +++++++- ui/__init__.py | 17 +++++++++----- ui/properties_yaf_general_settings.py | 3 +-- ui/properties_yaf_render.py | 22 ++++++++++++++++++ ui/properties_yaf_texture.py | 22 ++++++++++++++++++ ui/properties_yaf_world.py | 20 +++++++++++++++++ 10 files changed, 176 insertions(+), 17 deletions(-) diff --git a/io/yaf_export.py b/io/yaf_export.py index c883391c..5628a06c 100644 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -294,7 +294,7 @@ def update(self, data, scene): if scene.gs_type_render == "file": self.setInterface(yafrayinterface.yafrayInterface_t()) - self.yi.setInputGamma(scene.gs_gamma_input, True) + self.yi.setInputColorSpace("LinearRGB", 1.0) #When rendering into Blender, color picker floating point data is already linear (linearized by Blender) self.outputFile, self.output, self.file_type = self.decideOutputFileName(fp, scene.img_output) self.yi.paramsClearAll() self.yi.paramsSetString("type", self.file_type) @@ -307,7 +307,23 @@ def update(self, data, scene): elif scene.gs_type_render == "xml": self.setInterface(yafrayinterface.xmlInterface_t()) - self.yi.setInputGamma(scene.gs_gamma_input, True) + + input_color_values_color_space = "sRGB" + input_color_values_gamma = 1.0 + + if scene.display_settings.display_device == "sRGB": + input_color_values_color_space = "sRGB" + + elif scene.display_settings.display_device == "XYZ": + input_color_values_color_space = "XYZ" + + elif scene.display_settings.display_device == "None": + input_color_values_color_space = "Raw_manual_Gamma" + input_color_values_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" + + self.yi.setInputColorSpace("LinearRGB", 1.0) #Values from Blender, color picker floating point data are already linear (linearized by Blender) + self.yi.setXMLColorSpace(input_color_values_color_space, input_color_values_gamma) #To set the XML interface to write the XML values with the correction included for the selected color space (and gamma if applicable) + self.outputFile, self.output, self.file_type = self.decideOutputFileName(fp, 'XML') self.yi.paramsClearAll() self.co = yafrayinterface.imageOutput_t() @@ -315,7 +331,7 @@ def update(self, data, scene): else: self.setInterface(yafrayinterface.yafrayInterface_t()) - self.yi.setInputGamma(scene.gs_gamma_input, True) + self.yi.setInputColorSpace("LinearRGB", 1.0) #When rendering into Blender, color picker floating point data is already linear (linearized by Blender) self.yi.startScene() self.exportScene() @@ -334,7 +350,7 @@ def render(self, scene): self.update_stats("YafaRay Rendering:", "Rendering to {0}".format(self.outputFile)) self.yi.render(self.co) result = self.begin_result(0, 0, self.resX, self.resY) - lay = result.layers[0] if bpy.app.version < (2, 74, 4 ) else result.layers[0].passes[0] + lay = result.layers[0] #if bpy.app.version < (2, 74, 4 ) else result.layers[0].passes[0] #FIXME? # exr format has z-buffer included, so no need to load '_zbuffer' - file if scene.gs_z_channel and not scene.img_output == 'OPEN_EXR': diff --git a/io/yaf_scene.py b/io/yaf_scene.py index a502acc2..baa37077 100644 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -92,7 +92,37 @@ def exportRenderSettings(yi, scene): yi.paramsSetString("integrator_name", "default") yi.paramsSetString("volintegrator_name", "volintegr") - yi.paramsSetFloat("gamma", scene.gs_gamma) + output_device_color_space = "LinearRGB" + output_device_gamma = 1.0 + + if scene.gs_type_render == "file" or scene.gs_type_render == "xml": + output_device_color_space = "sRGB" + + if scene.img_output == "OPEN_EXR" or scene.img_output == "HDR": #If the output file is a HDR/EXR file, we force the render output to Linear + output_device_color_space = "LinearRGB" + + elif scene.display_settings.display_device == "sRGB": + output_device_color_space = "sRGB" + + elif scene.display_settings.display_device == "XYZ": + output_device_color_space = "XYZ" + + elif scene.display_settings.display_device == "None": + output_device_color_space = "Raw_manual_Gamma" + output_device_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" + + else: #Render into Blender + output_device_color_space = "LinearRGB" #Blender expects a linear output from YafaRay + + if scene.display_settings.display_device == "sRGB" or scene.display_settings.display_device == "XYZ" or scene.display_settings.display_device == "Rec709": + output_device_color_space = "LinearRGB" #If we render into Blender, YafaRay generates linear output and Blender does the conversion to the color space + + elif scene.display_settings.display_device == "None": + output_device_color_space = "Raw_manual_Gamma" + output_device_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" + + yi.paramsSetString("color_space", output_device_color_space) + yi.paramsSetFloat("gamma", output_device_gamma) exportAA(yi, scene) diff --git a/io/yaf_texture.py b/io/yaf_texture.py index 67d52a81..270e2fe6 100644 --- a/io/yaf_texture.py +++ b/io/yaf_texture.py @@ -306,15 +306,34 @@ def writeTexture(self, scene, tex): image_tex = os.path.realpath(image_tex) image_tex = os.path.normpath(image_tex) - yi.printInfo("Exporter: Creating Texture: '{0}' type {1}: {2}".format(name, tex.yaf_tex_type, image_tex)) - yi.paramsSetString("type", "image") yi.paramsSetString("filename", image_tex) yi.paramsSetBool("use_alpha", tex.yaf_use_alpha) yi.paramsSetBool("calc_alpha", tex.use_calculate_alpha) yi.paramsSetBool("normalmap", tex.yaf_is_normal_map) - yi.paramsSetFloat("gamma", scene.gs_gamma_input) + yi.paramsSetString("fileformat", fileformat.upper()) + + texture_color_space = "sRGB" + texture_gamma = 1.0 + + if tex.image.colorspace_settings.name == "sRGB" or tex.image.colorspace_settings.name == "VD16": + texture_color_space = "sRGB" + + elif tex.image.colorspace_settings.name == "XYZ": + texture_color_space = "XYZ" + + elif tex.image.colorspace_settings.name == "Linear" or tex.image.colorspace_settings.name == "Linear ACES" or tex.image.colorspace_settings.name == "Non-Color": + texture_color_space = "LinearRGB" + + elif tex.image.colorspace_settings.name == "Raw": + texture_color_space = "Raw_manual_Gamma" + texture_gamma = tex.yaf_gamma_input #We only use the selected gamma if the color space is set to "Raw" + + yi.paramsSetString("color_space", texture_color_space) + yi.paramsSetFloat("gamma", texture_gamma) + + yi.printInfo("Exporter: Creating Texture: '{0}' type {1}: {2}. Texture Color Space: '{3}', gamma={4}".format(name, tex.yaf_tex_type, image_tex, texture_color_space, texture_gamma)) # repeat repeat_x = 1 diff --git a/io/yaf_world.py b/io/yaf_world.py index 67c02b36..0dbedbec 100644 --- a/io/yaf_world.py +++ b/io/yaf_world.py @@ -76,6 +76,25 @@ def exportWorld(self, scene): interpolate = 'bilinear' # yi.paramsSetString("interpolate", interpolate) + + texture_color_space = "sRGB" + texture_gamma = 1.0 + + if worldTex.image.colorspace_settings.name == "sRGB" or worldTex.image.colorspace_settings.name == "VD16": + texture_color_space = "sRGB" + + elif worldTex.image.colorspace_settings.name == "XYZ": + texture_color_space = "XYZ" + + elif worldTex.image.colorspace_settings.name == "Linear" or worldTex.image.colorspace_settings.name == "Linear ACES" or worldTex.image.colorspace_settings.name == "Non-Color": + texture_color_space = "LinearRGB" + + elif worldTex.image.colorspace_settings.name == "Raw": + texture_color_space = "Raw_manualGamma" + texture_gamma = worldTex.yaf_gamma_input #We only use the selected gamma if the color space is set to "Raw" + + yi.paramsSetString("color_space", texture_color_space) + yi.paramsSetFloat("gamma", texture_gamma) yi.createTexture("world_texture") diff --git a/prop/yaf_texture.py b/prop/yaf_texture.py index b238c485..2e3b8111 100644 --- a/prop/yaf_texture.py +++ b/prop/yaf_texture.py @@ -20,7 +20,8 @@ import bpy from bpy.props import (EnumProperty, - BoolProperty) + BoolProperty, + FloatProperty) Texture = bpy.types.Texture @@ -61,9 +62,15 @@ def register(): name="Use alpha image info", description="Use alpha values for image mapping", default=False) + + Texture.yaf_gamma_input = FloatProperty( + name="Gamma input", + description="Gamma correction applied to input texture", + min=0, max=5, default=1.0) def unregister(): Texture.yaf_tex_type Texture.yaf_is_normal_map Texture.yaf_use_alpha + Texture.yaf_gamma_input diff --git a/ui/__init__.py b/ui/__init__.py index 8f6e52c0..ea2a5b19 100644 --- a/ui/__init__.py +++ b/ui/__init__.py @@ -26,6 +26,7 @@ from . import properties_yaf_strand from . import properties_yaf_object from . import properties_yaf_light +from . import properties_yaf_scene from bl_ui import properties_object as properties_object for member in dir(properties_object): # add all "object" panels from blender @@ -63,12 +64,16 @@ pass del properties_data_speaker -# YafaRay did not display the Scene panels anymore, due to addition of COMPAT_ENGINES to them from bl_ui import properties_scene as properties_scene for member in dir(properties_scene): - subclass = getattr(properties_scene, member) - try: - subclass.COMPAT_ENGINES.add('YAFA_RENDER') - except: - pass + + if member != "SCENE_PT_color_management": #YafaRay Color management panel is customized in properties_yaf_scene. + #FIXME: The customized YafaRay panel appears at the end of the Blender scene tab panels, I don't know how to rearrange the panels to keep YafaRay color management in the same place as Blender Color Management panel was. + + subclass = getattr(properties_scene, member) + try: + subclass.COMPAT_ENGINES.add('YAFA_RENDER') + except: + pass + del properties_scene diff --git a/ui/properties_yaf_general_settings.py b/ui/properties_yaf_general_settings.py index b043d672..5fb8994e 100644 --- a/ui/properties_yaf_general_settings.py +++ b/ui/properties_yaf_general_settings.py @@ -51,7 +51,6 @@ def draw(self, context): split = layout.split(percentage=0.58) col = split.column() col.prop(scene, "gs_ray_depth") - col.prop(scene, "gs_gamma") col.prop(scene, "gs_type_render") sub = col.column() sub.enabled = scene.gs_type_render == "into_blender" @@ -61,7 +60,7 @@ def draw(self, context): sub = col.column() sub.enabled = scene.gs_transp_shad sub.prop(scene, "gs_shadow_depth") - col.prop(scene, "gs_gamma_input") + #col.prop(scene, "gs_gamma_input") #No longer needed sub = col.column() sub.enabled = scene.gs_auto_threads == False sub.prop(scene, "gs_threads") diff --git a/ui/properties_yaf_render.py b/ui/properties_yaf_render.py index 0d6d9a14..5d6151a3 100644 --- a/ui/properties_yaf_render.py +++ b/ui/properties_yaf_render.py @@ -137,6 +137,28 @@ def draw(self, context): col = split.column() col.row().prop(image_settings, "color_mode", text="Color", expand=True) + if sc.img_output == "OPEN_EXR" or sc.img_output == "HDR": #If the output file is a HDR/EXR file, we force the render output to Linear + pass + elif sc.gs_type_render == "file" or sc.gs_type_render == "xml": + split = layout.split(percentage=0.6) + col = split.column() + col.prop(sc.display_settings, "display_device") + + if sc.display_settings.display_device == "None": + col = split.column() + col.prop(scene, "gs_gamma", text = "Gamma") + + if sc.display_settings.display_device == "sRGB": + pass + elif sc.display_settings.display_device == "None": + pass + elif sc.display_settings.display_device == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + sc.display_settings.display_device + "', assuming sRGB", icon="ERROR") + class YAFRENDER_PT_post_processing(RenderButtonsPanel, Panel): bl_label = "Post Processing" diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index e5e234a9..ffca3ec5 100644 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -259,6 +259,28 @@ def draw(self, context): tex = context.texture layout.template_image(tex, "image", tex.image_user) + if tex.image.colorspace_settings.name == "sRGB" or tex.image.colorspace_settings.name == "Linear" or tex.image.colorspace_settings.name == "Non-Color": + pass + + elif tex.image.colorspace_settings.name == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Linear ACES": + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming linear RGB", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Raw": + row = layout.row(align=True) + row.prop(tex, "yaf_gamma_input", text="Texture gamma input correction") + + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming sRGB", icon="ERROR") + + row = layout.row(align=True) + row.label(text="Note: for bump/normal maps, textures are always considered Linear", icon="INFO") + class YAF_TEXTURE_PT_image_sampling(YAF_TextureTypePanel, Panel): bl_label = "Image Sampling" diff --git a/ui/properties_yaf_world.py b/ui/properties_yaf_world.py index e87dab89..eee7ddd1 100644 --- a/ui/properties_yaf_world.py +++ b/ui/properties_yaf_world.py @@ -78,6 +78,26 @@ def draw(self, context): if tex.yaf_tex_type == "IMAGE": # it allows to change the used image # layout.template_image(tex, "image", tex.image_user, compact=True) + + if tex.image.colorspace_settings.name == "sRGB" or tex.image.colorspace_settings.name == "Linear" or tex.image.colorspace_settings.name == "Non-Color": + pass + + elif tex.image.colorspace_settings.name == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Linear ACES": + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming linear RGB", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Raw": + row = layout.row(align=True) + row.prop(tex, "yaf_gamma_input", text="Texture gamma input correction") + + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming sRGB", icon="ERROR") + # else: # TODO: create message about not allow texture type From 0e95f2f19aa2d92aaf1b9f3e3e91904377678732 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 3 Oct 2015 17:12:59 +0200 Subject: [PATCH 22/81] New ui file that was not added to git in the previous commit Changes to be committed: new file: properties_yaf_scene.py --- ui/properties_yaf_scene.py | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 ui/properties_yaf_scene.py diff --git a/ui/properties_yaf_scene.py b/ui/properties_yaf_scene.py new file mode 100644 index 00000000..71abc501 --- /dev/null +++ b/ui/properties_yaf_scene.py @@ -0,0 +1,59 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# + +import bpy +from yafaray.ot import yafaray_presets +from bl_ui.properties_scene import SceneButtonsPanel +from bpy.types import Panel, Menu + +class YAF_PT_color_management(SceneButtonsPanel, Panel): + bl_label = "Color Management" + COMPAT_ENGINES = {'YAFA_RENDER'} + + def draw(self, context): + layout = self.layout + + scene = context.scene + + col = layout.column() + col.label(text="Display:") + col.prop(scene.display_settings, "display_device") + + if scene.display_settings.display_device == "sRGB": + pass + elif scene.display_settings.display_device == "None": + row = layout.row(align=True) + row.prop(scene, "gs_gamma", text = "Display device output gamma") + elif scene.display_settings.display_device == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + scene.display_settings.display_device + "', assuming sRGB", icon="ERROR") + + col = layout.column() + col.separator() + col.label(text="Render:") + col.template_colormanaged_view_settings(scene, "view_settings") + + +if __name__ == "__main__": # only for live edit. + import bpy + bpy.utils.register_module(__name__) From e635011e72af2144284c016efcfb0d3a1c569269 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 3 Oct 2015 22:51:28 +0200 Subject: [PATCH 23/81] Prototype for new Color Pipeline workflow Initial prototype to try to fix the (apparently broken) YafaRay color pipeline workflow and to replace the simple gamma input/output correction with a proper sRGB decoding/coding in non-HDR files. More information here: http://www.yafaray.org/node/670 So, I've prepared a YafaRay prototype that fixes the next issues: * Improved Blender Color Space integration. * The "simple" gamma correction has been replaced by Color Spaces: - LinearRGB Linear values, no gamma correction - sRGB sRGB encoding/decoding - XYZ XYZ (very experimental) support - Raw_Manual_Gamma Raw linear values that allow to set a simple gamma output correction manually * Fixed: Double application of input gamma to the Blender Color picker. So now scenes will look brighter in general, but they should also look more realistic with less tweaking. * Gamma input correction no longer used. The color picker floating point color values will be considered already linear and no conversion applied to them. * For textures, added specific per-texture Color Space and gamma parameters. * The color values exported to the XML file will be encoded acording to Blender Output Device Color Space setting. * In yafaray-xml, new commandline option added: "-ics" or "--input-color-space" that allows to select how to interpret the XML color values. By default, for backwards compatibility, color values will be read as "LinearRGB", but using "-ics sRGB", the color values will be interpreted as sRGB. This setting does *not* affect the textures, as they have already per-texture specific color space/gamma parameters. * Fixed: when exporting to file there was an error in Blender while reopening it to be shown in the Blender image view. Pending: * Review by the official YafaRay developers. * Addidional tests and fine tuning. Changes to be committed: modified: README modified: __init__.py modified: io/yaf_export.py modified: io/yaf_scene.py modified: io/yaf_texture.py modified: io/yaf_world.py modified: prop/yaf_texture.py modified: ui/__init__.py modified: ui/properties_yaf_general_settings.py modified: ui/properties_yaf_material.py modified: ui/properties_yaf_render.py new file: ui/properties_yaf_scene.py modified: ui/properties_yaf_texture.py modified: ui/properties_yaf_world.py --- README | 4 +- __init__.py | 4 +- io/yaf_export.py | 24 +++++++++-- io/yaf_scene.py | 32 ++++++++++++++- io/yaf_texture.py | 23 ++++++++++- io/yaf_world.py | 19 +++++++++ prop/yaf_texture.py | 9 +++- ui/__init__.py | 17 +++++--- ui/properties_yaf_general_settings.py | 5 +-- ui/properties_yaf_material.py | 2 +- ui/properties_yaf_render.py | 22 ++++++++++ ui/properties_yaf_scene.py | 59 +++++++++++++++++++++++++++ ui/properties_yaf_texture.py | 22 ++++++++++ ui/properties_yaf_world.py | 20 +++++++++ 14 files changed, 242 insertions(+), 20 deletions(-) mode change 100644 => 100755 README mode change 100644 => 100755 __init__.py mode change 100644 => 100755 io/yaf_export.py mode change 100644 => 100755 io/yaf_scene.py mode change 100644 => 100755 io/yaf_texture.py mode change 100644 => 100755 io/yaf_world.py mode change 100644 => 100755 prop/yaf_texture.py mode change 100644 => 100755 ui/__init__.py mode change 100644 => 100755 ui/properties_yaf_general_settings.py mode change 100644 => 100755 ui/properties_yaf_material.py mode change 100644 => 100755 ui/properties_yaf_render.py create mode 100644 ui/properties_yaf_scene.py mode change 100644 => 100755 ui/properties_yaf_texture.py mode change 100644 => 100755 ui/properties_yaf_world.py diff --git a/README b/README old mode 100644 new mode 100755 index 59caab4b..ee4b52fd --- a/README +++ b/README @@ -1,4 +1,4 @@ -Yafaray 0.1.99-beta4c (2015-07-29) David Bluecame experimental exporter for Blender 2.75 RC: +Yafaray 0.2.0-beta1 (2015-10-03) David Bluecame experimental exporter for Blender 2.76: ** THIS BUILD CONTAINS EXPERIMENTAL CHANGES AND FEATURES - DO NOT USE FOR PRODUCTION SCENES ** Unofficial build for XXXX (XX bits) by David Bluecame @@ -6,6 +6,8 @@ Unofficial build for XXXX (XX bits) by David Bluecame Based on YafaRay git version + pull requests from David Bluecame not yet in master for +FIXME: (PENDING TO UPDATE CHANGELOG!!!!!) + - New Clay Material system, more flexible and powerful. More information in: http://www.yafaray.org/community/forum/viewtopic.php?f=16&t=5079 - Fix for problem with Rough Glass too bright when dispersion is enabled. See: http://www.yafaray.org/node/642 diff --git a/__init__.py b/__init__.py old mode 100644 new mode 100755 index 86ec130b..763c9519 --- a/__init__.py +++ b/__init__.py @@ -35,8 +35,8 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": (0, 1, 99, 'Experimental beta4c'), - "blender": (2, 7, 5), + "version": ('experimental', 0, 2, 0, 'beta1'), + "blender": (2, 7, 6), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", "tracker_url": "http://www.yafaray.org/development/bugtracker/yafaray", diff --git a/io/yaf_export.py b/io/yaf_export.py old mode 100644 new mode 100755 index e5707c4a..c5a78e84 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -311,7 +311,7 @@ def update(self, data, scene): if scene.gs_type_render == "file": self.setInterface(yafrayinterface.yafrayInterface_t()) - self.yi.setInputGamma(scene.gs_gamma_input, True) + self.yi.setInputColorSpace("LinearRGB", 1.0) #When rendering into Blender, color picker floating point data is already linear (linearized by Blender) self.outputFile, self.output, self.file_type = self.decideOutputFileName(fp, scene.img_output) self.yi.paramsClearAll() self.yi.paramsSetString("type", self.file_type) @@ -324,7 +324,23 @@ def update(self, data, scene): elif scene.gs_type_render == "xml": self.setInterface(yafrayinterface.xmlInterface_t()) - self.yi.setInputGamma(scene.gs_gamma_input, True) + + input_color_values_color_space = "sRGB" + input_color_values_gamma = 1.0 + + if scene.display_settings.display_device == "sRGB": + input_color_values_color_space = "sRGB" + + elif scene.display_settings.display_device == "XYZ": + input_color_values_color_space = "XYZ" + + elif scene.display_settings.display_device == "None": + input_color_values_color_space = "Raw_manual_Gamma" + input_color_values_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" + + self.yi.setInputColorSpace("LinearRGB", 1.0) #Values from Blender, color picker floating point data are already linear (linearized by Blender) + self.yi.setXMLColorSpace(input_color_values_color_space, input_color_values_gamma) #To set the XML interface to write the XML values with the correction included for the selected color space (and gamma if applicable) + self.outputFile, self.output, self.file_type = self.decideOutputFileName(fp, 'XML') self.yi.paramsClearAll() self.co = yafrayinterface.imageOutput_t() @@ -332,7 +348,7 @@ def update(self, data, scene): else: self.setInterface(yafrayinterface.yafrayInterface_t()) - self.yi.setInputGamma(scene.gs_gamma_input, True) + self.yi.setInputColorSpace("LinearRGB", 1.0) #When rendering into Blender, color picker floating point data is already linear (linearized by Blender) self.yi.startScene() self.exportScene() @@ -351,7 +367,7 @@ def render(self, scene): self.update_stats("YafaRay Rendering:", "Rendering to {0}".format(self.outputFile)) self.yi.render(self.co) result = self.begin_result(0, 0, self.resX, self.resY) - lay = result.layers[0] if bpy.app.version < (2, 74, 4 ) else result.layers[0].passes[0] + lay = result.layers[0] #if bpy.app.version < (2, 74, 4 ) else result.layers[0].passes[0] #FIXME? # exr format has z-buffer included, so no need to load '_zbuffer' - file if scene.gs_z_channel and not scene.img_output == 'OPEN_EXR': diff --git a/io/yaf_scene.py b/io/yaf_scene.py old mode 100644 new mode 100755 index 6635fcdd..69db1b41 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -92,7 +92,37 @@ def exportRenderSettings(yi, scene): yi.paramsSetString("integrator_name", "default") yi.paramsSetString("volintegrator_name", "volintegr") - yi.paramsSetFloat("gamma", scene.gs_gamma) + output_device_color_space = "LinearRGB" + output_device_gamma = 1.0 + + if scene.gs_type_render == "file" or scene.gs_type_render == "xml": + output_device_color_space = "sRGB" + + if scene.img_output == "OPEN_EXR" or scene.img_output == "HDR": #If the output file is a HDR/EXR file, we force the render output to Linear + output_device_color_space = "LinearRGB" + + elif scene.display_settings.display_device == "sRGB": + output_device_color_space = "sRGB" + + elif scene.display_settings.display_device == "XYZ": + output_device_color_space = "XYZ" + + elif scene.display_settings.display_device == "None": + output_device_color_space = "Raw_manual_Gamma" + output_device_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" + + else: #Render into Blender + output_device_color_space = "LinearRGB" #Blender expects a linear output from YafaRay + + if scene.display_settings.display_device == "sRGB" or scene.display_settings.display_device == "XYZ" or scene.display_settings.display_device == "Rec709": + output_device_color_space = "LinearRGB" #If we render into Blender, YafaRay generates linear output and Blender does the conversion to the color space + + elif scene.display_settings.display_device == "None": + output_device_color_space = "Raw_manual_Gamma" + output_device_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" + + yi.paramsSetString("color_space", output_device_color_space) + yi.paramsSetFloat("gamma", output_device_gamma) exportAA(yi, scene) diff --git a/io/yaf_texture.py b/io/yaf_texture.py old mode 100644 new mode 100755 index 67d52a81..206d2709 --- a/io/yaf_texture.py +++ b/io/yaf_texture.py @@ -314,7 +314,28 @@ def writeTexture(self, scene, tex): yi.paramsSetBool("use_alpha", tex.yaf_use_alpha) yi.paramsSetBool("calc_alpha", tex.use_calculate_alpha) yi.paramsSetBool("normalmap", tex.yaf_is_normal_map) - yi.paramsSetFloat("gamma", scene.gs_gamma_input) + yi.paramsSetString("fileformat", fileformat.upper()) + + texture_color_space = "sRGB" + texture_gamma = 1.0 + + if tex.image.colorspace_settings.name == "sRGB" or tex.image.colorspace_settings.name == "VD16": + texture_color_space = "sRGB" + + elif tex.image.colorspace_settings.name == "XYZ": + texture_color_space = "XYZ" + + elif tex.image.colorspace_settings.name == "Linear" or tex.image.colorspace_settings.name == "Linear ACES" or tex.image.colorspace_settings.name == "Non-Color": + texture_color_space = "LinearRGB" + + elif tex.image.colorspace_settings.name == "Raw": + texture_color_space = "Raw_manual_Gamma" + texture_gamma = tex.yaf_gamma_input #We only use the selected gamma if the color space is set to "Raw" + + yi.paramsSetString("color_space", texture_color_space) + yi.paramsSetFloat("gamma", texture_gamma) + + yi.printInfo("Exporter: Creating Texture: '{0}' type {1}: {2}. Texture Color Space: '{3}', gamma={4}".format(name, tex.yaf_tex_type, image_tex, texture_color_space, texture_gamma)) # repeat repeat_x = 1 diff --git a/io/yaf_world.py b/io/yaf_world.py old mode 100644 new mode 100755 index 67c02b36..0dbedbec --- a/io/yaf_world.py +++ b/io/yaf_world.py @@ -76,6 +76,25 @@ def exportWorld(self, scene): interpolate = 'bilinear' # yi.paramsSetString("interpolate", interpolate) + + texture_color_space = "sRGB" + texture_gamma = 1.0 + + if worldTex.image.colorspace_settings.name == "sRGB" or worldTex.image.colorspace_settings.name == "VD16": + texture_color_space = "sRGB" + + elif worldTex.image.colorspace_settings.name == "XYZ": + texture_color_space = "XYZ" + + elif worldTex.image.colorspace_settings.name == "Linear" or worldTex.image.colorspace_settings.name == "Linear ACES" or worldTex.image.colorspace_settings.name == "Non-Color": + texture_color_space = "LinearRGB" + + elif worldTex.image.colorspace_settings.name == "Raw": + texture_color_space = "Raw_manualGamma" + texture_gamma = worldTex.yaf_gamma_input #We only use the selected gamma if the color space is set to "Raw" + + yi.paramsSetString("color_space", texture_color_space) + yi.paramsSetFloat("gamma", texture_gamma) yi.createTexture("world_texture") diff --git a/prop/yaf_texture.py b/prop/yaf_texture.py old mode 100644 new mode 100755 index b238c485..2e3b8111 --- a/prop/yaf_texture.py +++ b/prop/yaf_texture.py @@ -20,7 +20,8 @@ import bpy from bpy.props import (EnumProperty, - BoolProperty) + BoolProperty, + FloatProperty) Texture = bpy.types.Texture @@ -61,9 +62,15 @@ def register(): name="Use alpha image info", description="Use alpha values for image mapping", default=False) + + Texture.yaf_gamma_input = FloatProperty( + name="Gamma input", + description="Gamma correction applied to input texture", + min=0, max=5, default=1.0) def unregister(): Texture.yaf_tex_type Texture.yaf_is_normal_map Texture.yaf_use_alpha + Texture.yaf_gamma_input diff --git a/ui/__init__.py b/ui/__init__.py old mode 100644 new mode 100755 index 8f6e52c0..ea2a5b19 --- a/ui/__init__.py +++ b/ui/__init__.py @@ -26,6 +26,7 @@ from . import properties_yaf_strand from . import properties_yaf_object from . import properties_yaf_light +from . import properties_yaf_scene from bl_ui import properties_object as properties_object for member in dir(properties_object): # add all "object" panels from blender @@ -63,12 +64,16 @@ pass del properties_data_speaker -# YafaRay did not display the Scene panels anymore, due to addition of COMPAT_ENGINES to them from bl_ui import properties_scene as properties_scene for member in dir(properties_scene): - subclass = getattr(properties_scene, member) - try: - subclass.COMPAT_ENGINES.add('YAFA_RENDER') - except: - pass + + if member != "SCENE_PT_color_management": #YafaRay Color management panel is customized in properties_yaf_scene. + #FIXME: The customized YafaRay panel appears at the end of the Blender scene tab panels, I don't know how to rearrange the panels to keep YafaRay color management in the same place as Blender Color Management panel was. + + subclass = getattr(properties_scene, member) + try: + subclass.COMPAT_ENGINES.add('YAFA_RENDER') + except: + pass + del properties_scene diff --git a/ui/properties_yaf_general_settings.py b/ui/properties_yaf_general_settings.py old mode 100644 new mode 100755 index 83acba25..afd48f97 --- a/ui/properties_yaf_general_settings.py +++ b/ui/properties_yaf_general_settings.py @@ -31,7 +31,7 @@ class YAFARAY_MT_presets_render(Menu): preset_subdir = "render" preset_operator = "script.execute_preset" draw = yafaray_presets.Yafaray_Menu.draw_preset - + class YAF_PT_general_settings(RenderButtonsPanel, Panel): bl_label = "General Settings" @@ -51,7 +51,6 @@ def draw(self, context): split = layout.split(percentage=0.58) col = split.column() col.prop(scene, "gs_ray_depth") - col.prop(scene, "gs_gamma") col.prop(scene, "gs_type_render") sub = col.column() sub.enabled = scene.gs_type_render == "into_blender" @@ -61,7 +60,7 @@ def draw(self, context): sub = col.column() sub.enabled = scene.gs_transp_shad sub.prop(scene, "gs_shadow_depth") - col.prop(scene, "gs_gamma_input") + #col.prop(scene, "gs_gamma_input") #No longer needed sub = col.column() sub.enabled = scene.gs_auto_threads == False sub.prop(scene, "gs_threads") diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py old mode 100644 new mode 100755 index 81803aff..f8301ca9 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -195,7 +195,7 @@ def draw(self, context): sub.enabled = yaf_mat.fresnel_effect sub.prop(yaf_mat, "IOR_reflection", slider=True) layout.row().prop(yaf_mat, "specular_reflect", slider=True) - + class YAF_PT_glossy_diffuse(MaterialTypePanel, Panel): bl_label = "Diffuse reflection" diff --git a/ui/properties_yaf_render.py b/ui/properties_yaf_render.py old mode 100644 new mode 100755 index 4f54a5ac..52c01888 --- a/ui/properties_yaf_render.py +++ b/ui/properties_yaf_render.py @@ -137,6 +137,28 @@ def draw(self, context): col = split.column() col.row().prop(image_settings, "color_mode", text="Color", expand=True) + if sc.img_output == "OPEN_EXR" or sc.img_output == "HDR": #If the output file is a HDR/EXR file, we force the render output to Linear + pass + elif sc.gs_type_render == "file" or sc.gs_type_render == "xml": + split = layout.split(percentage=0.6) + col = split.column() + col.prop(sc.display_settings, "display_device") + + if sc.display_settings.display_device == "None": + col = split.column() + col.prop(scene, "gs_gamma", text = "Gamma") + + if sc.display_settings.display_device == "sRGB": + pass + elif sc.display_settings.display_device == "None": + pass + elif sc.display_settings.display_device == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + sc.display_settings.display_device + "', assuming sRGB", icon="ERROR") + class YAFRENDER_PT_post_processing(RenderButtonsPanel, Panel): bl_label = "Post Processing" diff --git a/ui/properties_yaf_scene.py b/ui/properties_yaf_scene.py new file mode 100644 index 00000000..71abc501 --- /dev/null +++ b/ui/properties_yaf_scene.py @@ -0,0 +1,59 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# + +import bpy +from yafaray.ot import yafaray_presets +from bl_ui.properties_scene import SceneButtonsPanel +from bpy.types import Panel, Menu + +class YAF_PT_color_management(SceneButtonsPanel, Panel): + bl_label = "Color Management" + COMPAT_ENGINES = {'YAFA_RENDER'} + + def draw(self, context): + layout = self.layout + + scene = context.scene + + col = layout.column() + col.label(text="Display:") + col.prop(scene.display_settings, "display_device") + + if scene.display_settings.display_device == "sRGB": + pass + elif scene.display_settings.display_device == "None": + row = layout.row(align=True) + row.prop(scene, "gs_gamma", text = "Display device output gamma") + elif scene.display_settings.display_device == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + scene.display_settings.display_device + "', assuming sRGB", icon="ERROR") + + col = layout.column() + col.separator() + col.label(text="Render:") + col.template_colormanaged_view_settings(scene, "view_settings") + + +if __name__ == "__main__": # only for live edit. + import bpy + bpy.utils.register_module(__name__) diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py old mode 100644 new mode 100755 index 76c6948c..f4cd7f53 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -259,6 +259,28 @@ def draw(self, context): tex = context.texture layout.template_image(tex, "image", tex.image_user) + if tex.image.colorspace_settings.name == "sRGB" or tex.image.colorspace_settings.name == "Linear" or tex.image.colorspace_settings.name == "Non-Color": + pass + + elif tex.image.colorspace_settings.name == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Linear ACES": + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming linear RGB", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Raw": + row = layout.row(align=True) + row.prop(tex, "yaf_gamma_input", text="Texture gamma input correction") + + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming sRGB", icon="ERROR") + + row = layout.row(align=True) + row.label(text="Note: for bump/normal maps, textures are always considered Linear", icon="INFO") + class YAF_TEXTURE_PT_image_sampling(YAF_TextureTypePanel, Panel): bl_label = "Image Sampling" diff --git a/ui/properties_yaf_world.py b/ui/properties_yaf_world.py old mode 100644 new mode 100755 index e87dab89..eee7ddd1 --- a/ui/properties_yaf_world.py +++ b/ui/properties_yaf_world.py @@ -78,6 +78,26 @@ def draw(self, context): if tex.yaf_tex_type == "IMAGE": # it allows to change the used image # layout.template_image(tex, "image", tex.image_user, compact=True) + + if tex.image.colorspace_settings.name == "sRGB" or tex.image.colorspace_settings.name == "Linear" or tex.image.colorspace_settings.name == "Non-Color": + pass + + elif tex.image.colorspace_settings.name == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Linear ACES": + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming linear RGB", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Raw": + row = layout.row(align=True) + row.prop(tex, "yaf_gamma_input", text="Texture gamma input correction") + + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming sRGB", icon="ERROR") + # else: # TODO: create message about not allow texture type From 6e792c696721cfc2fa76a6e02baf311d3d5f7115 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 3 Oct 2015 23:04:04 +0200 Subject: [PATCH 24/81] Set Render Advanced Settings panel visible again For some strange reason the Advanced Settings panel was not visible lately. Just renaming the class fixes the problem. Weird (??) --- ui/properties_yaf_render.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/properties_yaf_render.py b/ui/properties_yaf_render.py index 52c01888..f81edeb4 100755 --- a/ui/properties_yaf_render.py +++ b/ui/properties_yaf_render.py @@ -179,7 +179,7 @@ def draw(self, context): col.prop(rd, "dither_intensity", text="Dither", slider=True) -class YAF_PT_convert(RenderButtonsPanel, Panel): +class YAFRENDER_PT_convert(RenderButtonsPanel, Panel): bl_label = "Convert old YafaRay Settings" def draw(self, context): @@ -187,7 +187,7 @@ def draw(self, context): layout.column().operator("data.convert_yafaray_properties", text="Convert data from 2.4x") -class YAF_PT_advanced(RenderButtonsPanel, Panel): +class YAFRENDER_PT_advanced(RenderButtonsPanel, Panel): bl_label = "Advanced Settings - only for experts" bl_options = {'DEFAULT_CLOSED'} From 78c8e99941aca648734b321bc611a3f30d3a46ba Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Mon, 5 Oct 2015 06:36:33 +0100 Subject: [PATCH 25/81] Adjust Raw_Manual_Gamma option capitalization Minor change to ajust the capitalization in the option "Raw_Manual_Gamma" text Changes to be committed: modified: io/yaf_export.py modified: io/yaf_scene.py modified: io/yaf_texture.py --- io/yaf_export.py | 2 +- io/yaf_scene.py | 4 ++-- io/yaf_texture.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/io/yaf_export.py b/io/yaf_export.py index 5628a06c..97bf5434 100644 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -318,7 +318,7 @@ def update(self, data, scene): input_color_values_color_space = "XYZ" elif scene.display_settings.display_device == "None": - input_color_values_color_space = "Raw_manual_Gamma" + input_color_values_color_space = "Raw_Manual_Gamma" input_color_values_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" self.yi.setInputColorSpace("LinearRGB", 1.0) #Values from Blender, color picker floating point data are already linear (linearized by Blender) diff --git a/io/yaf_scene.py b/io/yaf_scene.py index baa37077..b30ad1bb 100644 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -108,7 +108,7 @@ def exportRenderSettings(yi, scene): output_device_color_space = "XYZ" elif scene.display_settings.display_device == "None": - output_device_color_space = "Raw_manual_Gamma" + output_device_color_space = "Raw_Manual_Gamma" output_device_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" else: #Render into Blender @@ -118,7 +118,7 @@ def exportRenderSettings(yi, scene): output_device_color_space = "LinearRGB" #If we render into Blender, YafaRay generates linear output and Blender does the conversion to the color space elif scene.display_settings.display_device == "None": - output_device_color_space = "Raw_manual_Gamma" + output_device_color_space = "Raw_Manual_Gamma" output_device_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" yi.paramsSetString("color_space", output_device_color_space) diff --git a/io/yaf_texture.py b/io/yaf_texture.py index 270e2fe6..8be458cc 100644 --- a/io/yaf_texture.py +++ b/io/yaf_texture.py @@ -327,7 +327,7 @@ def writeTexture(self, scene, tex): texture_color_space = "LinearRGB" elif tex.image.colorspace_settings.name == "Raw": - texture_color_space = "Raw_manual_Gamma" + texture_color_space = "Raw_Manual_Gamma" texture_gamma = tex.yaf_gamma_input #We only use the selected gamma if the color space is set to "Raw" yi.paramsSetString("color_space", texture_color_space) From 3b6ee6af1cdffe20abd62d6c7231508280300946 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Mon, 5 Oct 2015 06:41:19 +0100 Subject: [PATCH 26/81] Adjust Raw_Manual_Gamma option capitalization Minor change to ajust the capitalization in the option "Raw_Manual_Gamma" text Changes to be committed: modified: io/yaf_export.py modified: io/yaf_scene.py modified: io/yaf_texture.py --- io/yaf_export.py | 2 +- io/yaf_scene.py | 4 ++-- io/yaf_texture.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/io/yaf_export.py b/io/yaf_export.py index c5a78e84..95d6e9f3 100755 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -335,7 +335,7 @@ def update(self, data, scene): input_color_values_color_space = "XYZ" elif scene.display_settings.display_device == "None": - input_color_values_color_space = "Raw_manual_Gamma" + input_color_values_color_space = "Raw_Manual_Gamma" input_color_values_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" self.yi.setInputColorSpace("LinearRGB", 1.0) #Values from Blender, color picker floating point data are already linear (linearized by Blender) diff --git a/io/yaf_scene.py b/io/yaf_scene.py index 69db1b41..4b760469 100755 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -108,7 +108,7 @@ def exportRenderSettings(yi, scene): output_device_color_space = "XYZ" elif scene.display_settings.display_device == "None": - output_device_color_space = "Raw_manual_Gamma" + output_device_color_space = "Raw_Manual_Gamma" output_device_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" else: #Render into Blender @@ -118,7 +118,7 @@ def exportRenderSettings(yi, scene): output_device_color_space = "LinearRGB" #If we render into Blender, YafaRay generates linear output and Blender does the conversion to the color space elif scene.display_settings.display_device == "None": - output_device_color_space = "Raw_manual_Gamma" + output_device_color_space = "Raw_Manual_Gamma" output_device_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" yi.paramsSetString("color_space", output_device_color_space) diff --git a/io/yaf_texture.py b/io/yaf_texture.py index 206d2709..30d44de7 100755 --- a/io/yaf_texture.py +++ b/io/yaf_texture.py @@ -329,7 +329,7 @@ def writeTexture(self, scene, tex): texture_color_space = "LinearRGB" elif tex.image.colorspace_settings.name == "Raw": - texture_color_space = "Raw_manual_Gamma" + texture_color_space = "Raw_Manual_Gamma" texture_gamma = tex.yaf_gamma_input #We only use the selected gamma if the color space is set to "Raw" yi.paramsSetString("color_space", texture_color_space) From 38e054b91af3cd3f240fc2630be7d9911a37f188 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 10 Oct 2015 18:03:58 +0100 Subject: [PATCH 27/81] STRUCTURAL CHANGES: Render Passes/Views, light groups, etc - Initial support for Render Passes (partial in sppm, path and almost nothing in bidir) - Initial support for Render Views - Initial support for Light Groups - Removed previous z-depth processing - Fixed some issues with rough glass - Added dispersive caustics to sppm - Sixed save to image not showing in blender afterwards - Added xml processing "partial image save timer" option - Added support for multilayer EXR in Blender-Exporter and XML interface - Fixed YafaRay panels appearing in LuxRender - Fixed sphere light surface didn't change with power value. Changes to be committed: modified: README modified: __init__.py modified: io/yaf_export.py modified: io/yaf_integrator.py modified: io/yaf_light.py modified: io/yaf_material.py modified: io/yaf_object.py modified: io/yaf_scene.py modified: io/yaf_texture.py modified: io/yaf_world.py modified: prop/yaf_light.py modified: prop/yaf_object.py modified: prop/yaf_scene.py modified: prop/yaf_texture.py modified: ui/__init__.py modified: ui/properties_yaf_AA_settings.py modified: ui/properties_yaf_camera.py modified: ui/properties_yaf_general_settings.py modified: ui/properties_yaf_integrator.py new file: ui/properties_yaf_layer_passes.py modified: ui/properties_yaf_light.py modified: ui/properties_yaf_material.py modified: ui/properties_yaf_object.py modified: ui/properties_yaf_render.py new file: ui/properties_yaf_scene.py modified: ui/properties_yaf_texture.py modified: ui/properties_yaf_volume_integrator.py modified: ui/properties_yaf_world.py --- README | 4 +- __init__.py | 4 +- io/yaf_export.py | 94 ++++-- io/yaf_integrator.py | 14 +- io/yaf_light.py | 13 +- io/yaf_material.py | 6 + io/yaf_object.py | 253 +++++++++------ io/yaf_scene.py | 191 +++++++++++- io/yaf_texture.py | 23 +- io/yaf_world.py | 19 ++ prop/yaf_light.py | 7 + prop/yaf_object.py | 7 + prop/yaf_scene.py | 416 +++++++++++++++++++++++-- prop/yaf_texture.py | 9 +- ui/__init__.py | 18 +- ui/properties_yaf_AA_settings.py | 1 + ui/properties_yaf_camera.py | 3 + ui/properties_yaf_general_settings.py | 10 +- ui/properties_yaf_integrator.py | 1 + ui/properties_yaf_layer_passes.py | 404 ++++++++++++++++++++++++ ui/properties_yaf_light.py | 1 + ui/properties_yaf_material.py | 14 +- ui/properties_yaf_object.py | 2 + ui/properties_yaf_render.py | 74 ++--- ui/properties_yaf_scene.py | 59 ++++ ui/properties_yaf_texture.py | 22 ++ ui/properties_yaf_volume_integrator.py | 1 + ui/properties_yaf_world.py | 21 ++ 28 files changed, 1481 insertions(+), 210 deletions(-) create mode 100755 ui/properties_yaf_layer_passes.py create mode 100644 ui/properties_yaf_scene.py diff --git a/README b/README index 59caab4b..b9677522 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Yafaray 0.1.99-beta4c (2015-07-29) David Bluecame experimental exporter for Blender 2.75 RC: +Yafaray-E (Experimental) v1.0.0 (2015-0x-xx) David Bluecame experimental exporter for Blender 2.76: ** THIS BUILD CONTAINS EXPERIMENTAL CHANGES AND FEATURES - DO NOT USE FOR PRODUCTION SCENES ** Unofficial build for XXXX (XX bits) by David Bluecame @@ -6,6 +6,8 @@ Unofficial build for XXXX (XX bits) by David Bluecame Based on YafaRay git version + pull requests from David Bluecame not yet in master for +FIXME: (PENDING TO UPDATE CHANGELOG!!!!!) + - New Clay Material system, more flexible and powerful. More information in: http://www.yafaray.org/community/forum/viewtopic.php?f=16&t=5079 - Fix for problem with Rough Glass too bright when dispersion is enabled. See: http://www.yafaray.org/node/642 diff --git a/__init__.py b/__init__.py index 86ec130b..4fffe78d 100644 --- a/__init__.py +++ b/__init__.py @@ -35,8 +35,8 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": (0, 1, 99, 'Experimental beta4c'), - "blender": (2, 7, 5), + "version": ('experimental', 1, 0, 0), + "blender": (2, 7, 6), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", "tracker_url": "http://www.yafaray.org/development/bugtracker/yafaray", diff --git a/io/yaf_export.py b/io/yaf_export.py index e5707c4a..0b3523db 100644 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -19,6 +19,8 @@ # #TODO: Use Blender enumerators if any +import sys +import copy import bpy import os import threading @@ -72,7 +74,7 @@ def exportScene(self): self.exportMaterials() self.yaf_object.setScene(self.scene) self.exportObjects() - self.yaf_object.createCamera() + self.yaf_object.createCameras() self.yaf_world.exportWorld(self.scene) def exportTexture(self, obj): @@ -311,12 +313,12 @@ def update(self, data, scene): if scene.gs_type_render == "file": self.setInterface(yafrayinterface.yafrayInterface_t()) - self.yi.setInputGamma(scene.gs_gamma_input, True) + self.yi.setInputColorSpace("LinearRGB", 1.0) #When rendering into Blender, color picker floating point data is already linear (linearized by Blender) self.outputFile, self.output, self.file_type = self.decideOutputFileName(fp, scene.img_output) self.yi.paramsClearAll() self.yi.paramsSetString("type", self.file_type) + self.yi.paramsSetBool("img_multilayer", scene.img_multilayer) self.yi.paramsSetBool("alpha_channel", render.image_settings.color_mode == "RGBA") - self.yi.paramsSetBool("z_channel", scene.gs_z_channel) self.yi.paramsSetInt("width", self.resX) self.yi.paramsSetInt("height", self.resY) self.ih = self.yi.createImageHandler("outFile") @@ -324,7 +326,23 @@ def update(self, data, scene): elif scene.gs_type_render == "xml": self.setInterface(yafrayinterface.xmlInterface_t()) - self.yi.setInputGamma(scene.gs_gamma_input, True) + + input_color_values_color_space = "sRGB" + input_color_values_gamma = 1.0 + + if scene.display_settings.display_device == "sRGB": + input_color_values_color_space = "sRGB" + + elif scene.display_settings.display_device == "XYZ": + input_color_values_color_space = "XYZ" + + elif scene.display_settings.display_device == "None": + input_color_values_color_space = "Raw_Manual_Gamma" + input_color_values_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" + + self.yi.setInputColorSpace("LinearRGB", 1.0) #Values from Blender, color picker floating point data are already linear (linearized by Blender) + self.yi.setXMLColorSpace(input_color_values_color_space, input_color_values_gamma) #To set the XML interface to write the XML values with the correction included for the selected color space (and gamma if applicable) + self.outputFile, self.output, self.file_type = self.decideOutputFileName(fp, 'XML') self.yi.paramsClearAll() self.co = yafrayinterface.imageOutput_t() @@ -332,7 +350,7 @@ def update(self, data, scene): else: self.setInterface(yafrayinterface.yafrayInterface_t()) - self.yi.setInputGamma(scene.gs_gamma_input, True) + self.yi.setInputColorSpace("LinearRGB", 1.0) #When rendering into Blender, color picker floating point data is already linear (linearized by Blender) self.yi.startScene() self.exportScene() @@ -345,19 +363,17 @@ def update(self, data, scene): # callback to render scene def render(self, scene): self.bl_use_postprocess = False + self.scene = scene if scene.gs_type_render == "file": self.yi.printInfo("Exporter: Rendering to file {0}".format(self.outputFile)) self.update_stats("YafaRay Rendering:", "Rendering to {0}".format(self.outputFile)) self.yi.render(self.co) result = self.begin_result(0, 0, self.resX, self.resY) - lay = result.layers[0] if bpy.app.version < (2, 74, 4 ) else result.layers[0].passes[0] + lay = result.layers[0] #if bpy.app.version < (2, 74, 4 ) else result.layers[0].passes[0] #FIXME? - # exr format has z-buffer included, so no need to load '_zbuffer' - file - if scene.gs_z_channel and not scene.img_output == 'OPEN_EXR': - lay.load_from_file("{0}_zbuffer.{1}".format(self.output, self.file_type)) - else: - lay.load_from_file(self.outputFile) + lay.load_from_file(self.outputFile) + #lay.passes["Depth"].load_from_file("{0} (Depth).{1}".format(self.output, self.file_type)) #FIXME? Unfortunately I cannot find a way to load the exported images back to the appropiate passes in Blender. Blender probably needs to improve their API to allow per-pass loading of files. Also, Blender does not allow opening multi layer EXR files with this function. self.end_result(result) @@ -378,33 +394,71 @@ def progressCallback(command, *args): self.update_progress(self.prog) def drawAreaCallback(*args): - x, y, w, h, tile = args + x, y, w, h, view_number, tiles = args res = self.begin_result(x, y, w, h) + try: l = res.layers[0] if bpy.app.version < (2, 74, 4 ): - l.rect, l.passes[0].rect = tile + l.rect, l.passes[0].rect = tiles else: - l.passes[0].rect, l.passes[1].rect = tile + if scene.render.use_multiview: + #due to Blender limitations while drawing the tiles, I cannot use the view names properly and I have to repeat the currently drawing tile into all views so it shows correctly. Maybe there is a better way? + for view_number,view in enumerate(scene.render.views): + view_suffix = '.'+scene.render.views[view_number].name + + for tile in tiles: + view_name, tile_name, tile_bitmap = tile + try: + l.passes[tile_name+view_suffix].rect = tile_bitmap + except: print("Unexpected error:", sys.exc_info()) + + else: + for tile in tiles: + view_name, tile_name, tile_bitmap = tile + try: + l.passes[tile_name].rect = tile_bitmap + except: print("Unexpected error:", sys.exc_info()) + except: - pass + print("Unexpected error:", sys.exc_info()) self.end_result(res) def flushCallback(*args): - w, h, tile = args + w, h, view_number, tiles = args res = self.begin_result(0, 0, w, h) + try: l = res.layers[0] if bpy.app.version < (2, 74, 4 ): - l.rect, l.passes[0].rect = tile + l.rect, l.passes[0].rect = tiles else: - l.passes[0].rect, l.passes[1].rect = tile + for tile in tiles: + view_name, tile_name, tile_bitmap = tile + if scene.render.use_multiview: + if view_name == "": #In case we use Render 3D vierpowrt with Views enabled, it will copy the result to all views + for view_number,view in enumerate(scene.render.views): + full_tile_name = tile_name + "." + view.name + try: + l.passes[full_tile_name].rect = tile_bitmap + except: print("Unexpected error:", sys.exc_info()) + else: + full_tile_name = tile_name + "." + view_name + try: + l.passes[full_tile_name].rect = tile_bitmap + except: print("Unexpected error:", sys.exc_info()) + else: + full_tile_name = tile_name + try: + l.passes[full_tile_name].rect = tile_bitmap + except: print("Unexpected error:", sys.exc_info()) + except BaseException as e: - pass + print("Unexpected error:", sys.exc_info()) self.end_result(res) - + t = threading.Thread( target=self.yi.render, args=(self.resX, self.resY, self.bStartX, self.bStartY, diff --git a/io/yaf_integrator.py b/io/yaf_integrator.py index 76ea177a..edf1dbea 100644 --- a/io/yaf_integrator.py +++ b/io/yaf_integrator.py @@ -41,6 +41,12 @@ def exportIntegrator(self, scene): light_type = scene.intg_light_method yi.printInfo("Exporting Integrator: {0}".format(light_type)) + yi.paramsSetBool("do_AO", scene.intg_use_AO) + yi.paramsSetInt("AO_samples", scene.intg_AO_samples) + yi.paramsSetFloat("AO_distance", scene.intg_AO_distance) + c = scene.intg_AO_color + yi.paramsSetColor("AO_color", c[0], c[1], c[2]) + if light_type == "Direct Lighting": yi.paramsSetString("type", "directlighting") @@ -51,14 +57,6 @@ def exportIntegrator(self, scene): yi.paramsSetInt("caustic_mix", scene.intg_caustic_mix) yi.paramsSetInt("caustic_depth", scene.intg_caustic_depth) yi.paramsSetFloat("caustic_radius", scene.intg_caustic_radius) - - yi.paramsSetBool("do_AO", scene.intg_use_AO) - - if scene.intg_use_AO: - yi.paramsSetInt("AO_samples", scene.intg_AO_samples) - yi.paramsSetFloat("AO_distance", scene.intg_AO_distance) - c = scene.intg_AO_color - yi.paramsSetColor("AO_color", c[0], c[1], c[2]) elif light_type == "Photon Mapping": yi.paramsSetString("type", "photonmapping") diff --git a/io/yaf_light.py b/io/yaf_light.py index 3fe63d01..9ff0648e 100644 --- a/io/yaf_light.py +++ b/io/yaf_light.py @@ -105,6 +105,10 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsClearAll() yi.paramsSetColor("color", color[0], color[1], color[2]) # color for spherelight and area light geometry yi.paramsSetString("type", "light_mat") + power_sphere = power / lamp.yaf_sphere_radius + yi.paramsSetFloat("power", power_sphere) + yi.paramsSetInt("light_group", lamp.light_group) + self.lightMat = self.yi.createMaterial(name) self.yi.paramsClearAll() #yi.paramsSetBool("light_enabled", lamp.light_enabled) @@ -120,6 +124,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetFloat("radius", lamp.yaf_sphere_radius) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) + yi.paramsSetInt("light_group", lamp.light_group) elif lampType == "spot": if self.preview and name == "Lamp.002": @@ -139,7 +144,8 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetBool("photon_only", lamp.photon_only) yi.paramsSetInt("samples", lamp.yaf_samples) yi.paramsSetBool("light_enabled", lamp.light_enabled) - yi.paramsSetBool("cast_shadows", lamp.cast_shadows) + yi.paramsSetBool("cast_shadows", lamp.cast_shadows) + yi.paramsSetInt("light_group", lamp.light_group) elif lampType == "sun": yi.paramsSetString("type", "sunlight") @@ -148,6 +154,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetPoint("direction", direct[0], direct[1], direct[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) + yi.paramsSetInt("light_group", lamp.light_group) elif lampType == "directional": yi.paramsSetString("type", "directional") @@ -158,6 +165,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) + yi.paramsSetInt("light_group", lamp.light_group) elif lampType == "ies": yi.paramsSetString("type", "ieslight") @@ -171,6 +179,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetBool("soft_shadows", lamp.ies_soft_shadows) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) + yi.paramsSetInt("light_group", lamp.light_group) elif lampType == "area": sizeX = lamp.size @@ -216,6 +225,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetPoint("point2", corner3[0], corner3[1], corner3[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) + yi.paramsSetInt("light_group", lamp.light_group) if lampType not in {"sun", "directional"}: # "from" is not used for sunlight and infinite directional light @@ -230,6 +240,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetFloat("power", power) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) + yi.paramsSetInt("light_group", lamp.light_group) yi.createLight(name) return True diff --git a/io/yaf_material.py b/io/yaf_material.py index a7383a07..0639186f 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -211,6 +211,8 @@ def writeGlassShader(self, mat, scene, rough): yi = self.yi yi.paramsClearAll() + yi.paramsSetInt("mat_pass_index", mat.pass_index) + if rough: # create bool property "rough" yi.paramsSetString("type", "rough_glass") yi.paramsSetFloat("alpha", mat.refr_roughness) # added refraction roughness for roughglass material @@ -292,6 +294,8 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c yi = self.yi yi.paramsClearAll() + yi.paramsSetInt("mat_pass_index", mat.pass_index) + if coated: # create bool property yi.paramsSetString("type", "coated_glossy") yi.paramsSetFloat("IOR", mat.IOR_reflection) # IOR for reflection @@ -415,6 +419,8 @@ def writeShinyDiffuseShader(self, mat, scene): yi = self.yi yi.paramsClearAll() + yi.paramsSetInt("mat_pass_index", mat.pass_index) + yi.paramsSetString("type", "shinydiffusemat") bCol = mat.diffuse_color diff --git a/io/yaf_object.py b/io/yaf_object.py index c1183827..5c62e9cb 100644 --- a/io/yaf_object.py +++ b/io/yaf_object.py @@ -43,115 +43,156 @@ def setScene(self, scene): self.scene = scene - def createCamera(self): + def createCameras(self): yi = self.yi - yi.printInfo("Exporting Camera") + yi.printInfo("Exporting Cameras") - camera = self.scene.camera + camera_scene = self.scene.camera render = self.scene.render - - if bpy.types.YAFA_RENDER.useViewToRender and bpy.types.YAFA_RENDER.viewMatrix: - # use the view matrix to calculate the inverted transformed - # points cam pos (0,0,0), front (0,0,1) and up (0,1,0) - # view matrix works like the opengl view part of the - # projection matrix, i.e. transforms everything so camera is - # at 0,0,0 looking towards 0,0,1 (y axis being up) - - m = bpy.types.YAFA_RENDER.viewMatrix - # m.transpose() --> not needed anymore: matrix indexing changed with Blender rev.42816 - inv = m.inverted() - - pos = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 0, 0, 1))) - aboveCam = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 1, 0, 1))) - frontCam = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 0, 1, 1))) - - dir = frontCam - pos - up = aboveCam - + + class viewLightGroupCameraData: + def __init__ (self, camera, view, light_group): + self.camera = camera + self.view = view + self.light_group = light_group + + view_lightgroup_camera_data_list = [] + + if bpy.types.YAFA_RENDER.useViewToRender or not render.use_multiview: + view_lightgroup_camera_data_list.append(viewLightGroupCameraData(camera_scene, None, 0)) + else: - # get cam worldspace transformation matrix, e.g. if cam is parented matrix_local does not work - matrix = camera.matrix_world.copy() - # matrix indexing (row, colums) changed in Blender rev.42816, for explanation see also: - # http://wiki.blender.org/index.php/User:TrumanBlending/Matrix_Indexing - pos = matrix.col[3] - dir = matrix.col[2] - up = pos + matrix.col[1] - - to = pos - dir - - x = int(render.resolution_x * render.resolution_percentage * 0.01) - y = int(render.resolution_y * render.resolution_percentage * 0.01) + camera_base_name = camera_scene.name.rsplit('_',1)[0] + + if len(self.scene.views_lightgroup_list) == 0: + for view in render.views: + if view.use: + view_lightgroup_camera_data_list.append(viewLightGroupCameraData(self.scene.objects[camera_base_name+view.camera_suffix], view, 0)) + + else: + for view_lightgroup in self.scene.views_lightgroup_list: + if view_lightgroup.view_number < len(self.scene.render.views) and self.scene.render.views[view_lightgroup.view_number].use: + view_lightgroup_camera_data_list.append(viewLightGroupCameraData(self.scene.objects[camera_base_name+self.scene.render.views[view_lightgroup.view_number].camera_suffix], self.scene.render.views[view_lightgroup.view_number], view_lightgroup.light_group)) + + for view_lightgroup_camera_data in view_lightgroup_camera_data_list: + + if bpy.types.YAFA_RENDER.useViewToRender: + camera_name = "3D viewport" + elif view_lightgroup_camera_data.view == None: + camera_name = view_lightgroup_camera_data.camera.name + elif view_lightgroup_camera_data.light_group == 0: + camera_name = view_lightgroup_camera_data.camera.name+" ("+view_lightgroup_camera_data.view.name+")" + else: + camera_name = view_lightgroup_camera_data.camera.name+" ("+view_lightgroup_camera_data.view.name+", LG "+str(view_lightgroup_camera_data.light_group)+")" + + if bpy.types.YAFA_RENDER.useViewToRender and bpy.types.YAFA_RENDER.viewMatrix: + # use the view matrix to calculate the inverted transformed + # points cam pos (0,0,0), front (0,0,1) and up (0,1,0) + # view matrix works like the opengl view part of the + # projection matrix, i.e. transforms everything so camera is + # at 0,0,0 looking towards 0,0,1 (y axis being up) + + m = bpy.types.YAFA_RENDER.viewMatrix + # m.transpose() --> not needed anymore: matrix indexing changed with Blender rev.42816 + inv = m.inverted() + + pos = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 0, 0, 1))) + aboveCam = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 1, 0, 1))) + frontCam = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 0, 1, 1))) + + dir = frontCam - pos + up = aboveCam - yi.paramsClearAll() + else: + # get cam worldspace transformation matrix, e.g. if cam is parented matrix_local does not work + matrix = view_lightgroup_camera_data.camera.matrix_world.copy() + # matrix indexing (row, colums) changed in Blender rev.42816, for explanation see also: + # http://wiki.blender.org/index.php/User:TrumanBlending/Matrix_Indexing + pos = matrix.col[3] + dir = matrix.col[2] + up = pos + matrix.col[1] + + to = pos - dir + + x = int(render.resolution_x * render.resolution_percentage * 0.01) + y = int(render.resolution_y * render.resolution_percentage * 0.01) + + yi.paramsClearAll() + + if view_lightgroup_camera_data.view: + yi.paramsSetString("view_name", view_lightgroup_camera_data.view.name) + else: + yi.paramsSetString("view_name", "") + yi.paramsSetInt("light_group_filter", view_lightgroup_camera_data.light_group) - if bpy.types.YAFA_RENDER.useViewToRender: - yi.paramsSetString("type", "perspective") - yi.paramsSetFloat("focal", 0.7) - bpy.types.YAFA_RENDER.useViewToRender = False + if bpy.types.YAFA_RENDER.useViewToRender: + yi.paramsSetString("type", "perspective") + yi.paramsSetFloat("focal", 0.7) + bpy.types.YAFA_RENDER.useViewToRender = False - else: - camera = camera.data - camType = camera.camera_type - - yi.paramsSetString("type", camType) - - if camera.use_clipping: - yi.paramsSetFloat("nearClip", camera.clip_start) - yi.paramsSetFloat("farClip", camera.clip_end) - - if camType == "orthographic": - yi.paramsSetFloat("scale", camera.ortho_scale) - - elif camType in {"perspective", "architect"}: - # Blenders GSOC 2011 project "tomato branch" merged into trunk. - # Check for sensor settings and use them in yafaray exporter also. - if camera.sensor_fit == 'AUTO': - horizontal_fit = (x > y) - sensor_size = camera.sensor_width - elif camera.sensor_fit == 'HORIZONTAL': - horizontal_fit = True - sensor_size = camera.sensor_width - else: - horizontal_fit = False - sensor_size = camera.sensor_height + else: + camera = view_lightgroup_camera_data.camera.data + camType = camera.camera_type + + yi.paramsSetString("type", camType) + + if camera.use_clipping: + yi.paramsSetFloat("nearClip", camera.clip_start) + yi.paramsSetFloat("farClip", camera.clip_end) + + if camType == "orthographic": + yi.paramsSetFloat("scale", camera.ortho_scale) + + elif camType in {"perspective", "architect"}: + # Blenders GSOC 2011 project "tomato branch" merged into trunk. + # Check for sensor settings and use them in yafaray exporter also. + if camera.sensor_fit == 'AUTO': + horizontal_fit = (x > y) + sensor_size = camera.sensor_width + elif camera.sensor_fit == 'HORIZONTAL': + horizontal_fit = True + sensor_size = camera.sensor_width + else: + horizontal_fit = False + sensor_size = camera.sensor_height - if horizontal_fit: - f_aspect = 1.0 - else: - f_aspect = x / y + if horizontal_fit: + f_aspect = 1.0 + else: + f_aspect = x / y - yi.paramsSetFloat("focal", camera.lens / (f_aspect * sensor_size)) + yi.paramsSetFloat("focal", camera.lens / (f_aspect * sensor_size)) - # DOF params, only valid for real camera - # use DOF object distance if present or fixed DOF - if camera.dof_object is not None: - # use DOF object distance - dist = (pos.xyz - camera.dof_object.location.xyz).length - dof_distance = dist - else: - # use fixed DOF distance - dof_distance = camera.dof_distance + # DOF params, only valid for real camera + # use DOF object distance if present or fixed DOF + if camera.dof_object is not None: + # use DOF object distance + dist = (pos.xyz - camera.dof_object.location.xyz).length + dof_distance = dist + else: + # use fixed DOF distance + dof_distance = camera.dof_distance - yi.paramsSetFloat("dof_distance", dof_distance) - yi.paramsSetFloat("aperture", camera.aperture) - # bokeh params - yi.paramsSetString("bokeh_type", camera.bokeh_type) - yi.paramsSetFloat("bokeh_rotation", camera.bokeh_rotation) + yi.paramsSetFloat("dof_distance", dof_distance) + yi.paramsSetFloat("aperture", camera.aperture) + # bokeh params + yi.paramsSetString("bokeh_type", camera.bokeh_type) + yi.paramsSetFloat("bokeh_rotation", camera.bokeh_rotation) - elif camType == "angular": - yi.paramsSetBool("circular", camera.circular) - yi.paramsSetBool("mirrored", camera.mirrored) - yi.paramsSetFloat("max_angle", camera.max_angle) - yi.paramsSetFloat("angle", camera.angular_angle) + elif camType == "angular": + yi.paramsSetBool("circular", camera.circular) + yi.paramsSetBool("mirrored", camera.mirrored) + yi.paramsSetFloat("max_angle", camera.max_angle) + yi.paramsSetFloat("angle", camera.angular_angle) - yi.paramsSetInt("resx", x) - yi.paramsSetInt("resy", y) + yi.paramsSetInt("resx", x) + yi.paramsSetInt("resy", y) - yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) - yi.paramsSetPoint("up", up[0], up[1], up[2]) - yi.paramsSetPoint("to", to[0], to[1], to[2]) - yi.createCamera("cam") + yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) + yi.paramsSetPoint("up", up[0], up[1], up[2]) + yi.paramsSetPoint("to", to[0], to[1], to[2]) + yi.createCamera(camera_name) def getBBCorners(self, object): bb = object.bound_box # look bpy.types.Object if there is any problem @@ -207,7 +248,10 @@ def writeInstanceBase(self, obj): obType = 512 # Create this geometry object as a base object for instances - self.writeGeometry(ID, obj, None, obType) # We want the vertices in object space + self.yi.paramsClearAll() + self.yi.paramsSetInt("obj_pass_index", obj.pass_index) + + self.writeGeometry(ID, obj, None, obj.pass_index, obType) # We want the vertices in object space return ID @@ -230,8 +274,11 @@ def writeMesh(self, obj, matrix): # Generate unique object ID ID = self.yi.getNextFreeID() + + self.yi.paramsClearAll() + self.yi.paramsSetInt("obj_pass_index", obj.pass_index) - self.writeGeometry(ID, obj, matrix) # obType in 0, default, the object is rendered + self.writeGeometry(ID, obj, matrix, obj.pass_index) # obType in 0, default, the object is rendered def writeBGPortal(self, obj, matrix): @@ -241,6 +288,7 @@ def writeBGPortal(self, obj, matrix): ID = self.yi.getNextFreeID() self.yi.paramsClearAll() + self.yi.paramsSetInt("obj_pass_index", obj.pass_index) self.yi.paramsSetString("type", "bgPortalLight") self.yi.paramsSetFloat("power", obj.bgp_power) self.yi.paramsSetInt("samples", obj.bgp_samples) @@ -252,7 +300,7 @@ def writeBGPortal(self, obj, matrix): obType = 256 # Makes object invisible to the renderer (doesn't enter the kdtree) - self.writeGeometry(ID, obj, matrix, obType) + self.writeGeometry(ID, obj, matrix, obj.pass_index, obType) def writeMeshLight(self, obj, matrix): @@ -265,27 +313,31 @@ def writeMeshLight(self, obj, matrix): ml_matname += obj.name + "." + str(obj.__hash__()) self.yi.paramsClearAll() + self.yi.paramsSetInt("obj_pass_index", obj.pass_index) self.yi.paramsSetString("type", "light_mat") self.yi.paramsSetBool("double_sided", obj.ml_double_sided) c = obj.ml_color self.yi.paramsSetColor("color", c[0], c[1], c[2]) self.yi.paramsSetFloat("power", obj.ml_power) + self.yi.paramsSetInt("light_group", obj.ml_light_group) ml_mat = self.yi.createMaterial(ml_matname) self.materialMap[ml_matname] = ml_mat # Export mesh light self.yi.paramsClearAll() + self.yi.paramsSetInt("obj_pass_index", obj.pass_index) self.yi.paramsSetString("type", "meshlight") self.yi.paramsSetBool("double_sided", obj.ml_double_sided) c = obj.ml_color self.yi.paramsSetColor("color", c[0], c[1], c[2]) self.yi.paramsSetFloat("power", obj.ml_power) self.yi.paramsSetInt("samples", obj.ml_samples) + self.yi.paramsSetInt("light_group", obj.ml_light_group) self.yi.paramsSetInt("object", ID) self.yi.createLight(obj.name) - self.writeGeometry(ID, obj, matrix, 0, ml_mat) # obType in 0, default, the object is rendered + self.writeGeometry(ID, obj, matrix, obj.pass_index, 0, ml_mat) # obType in 0, default, the object is rendered def writeVolumeObject(self, obj, matrix): @@ -296,6 +348,7 @@ def writeVolumeObject(self, obj, matrix): # me_materials = me.materials /* UNUSED */ yi.paramsClearAll() + yi.paramsSetInt("obj_pass_index", obj.pass_index) if obj.vol_region == 'ExpDensity Volume': yi.paramsSetString("type", "ExpDensityVolume") @@ -345,7 +398,7 @@ def writeVolumeObject(self, obj, matrix): yi.createVolumeRegion("VR.{0}-{1}".format(obj.name, str(obj.__hash__()))) bpy.data.meshes.remove(mesh) - def writeGeometry(self, ID, obj, matrix, obType=0, oMat=None): + def writeGeometry(self, ID, obj, matrix, pass_index, obType=0, oMat=None): mesh = obj.to_mesh(self.scene, True, 'RENDER') isSmooth = False @@ -410,7 +463,7 @@ def writeGeometry(self, ID, obj, matrix, obType=0, oMat=None): self.yi.paramsClearAll() self.yi.startGeometry() - self.yi.startTriMesh(ID, len(mesh.vertices), len(getattr(mesh, face_attr)), hasOrco, hasUV, obType) + self.yi.startTriMesh(ID, len(mesh.vertices), len(getattr(mesh, face_attr)), hasOrco, hasUV, obType, pass_index) for ind, v in enumerate(mesh.vertices): if hasOrco: diff --git a/io/yaf_scene.py b/io/yaf_scene.py index 6635fcdd..6f3a20e4 100644 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -92,7 +92,37 @@ def exportRenderSettings(yi, scene): yi.paramsSetString("integrator_name", "default") yi.paramsSetString("volintegrator_name", "volintegr") - yi.paramsSetFloat("gamma", scene.gs_gamma) + output_device_color_space = "LinearRGB" + output_device_gamma = 1.0 + + if scene.gs_type_render == "file" or scene.gs_type_render == "xml": + output_device_color_space = "sRGB" + + if scene.img_output == "OPEN_EXR" or scene.img_output == "HDR": #If the output file is a HDR/EXR file, we force the render output to Linear + output_device_color_space = "LinearRGB" + + elif scene.display_settings.display_device == "sRGB": + output_device_color_space = "sRGB" + + elif scene.display_settings.display_device == "XYZ": + output_device_color_space = "XYZ" + + elif scene.display_settings.display_device == "None": + output_device_color_space = "Raw_Manual_Gamma" + output_device_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" + + else: #Render into Blender + output_device_color_space = "LinearRGB" #Blender expects a linear output from YafaRay + + if scene.display_settings.display_device == "sRGB" or scene.display_settings.display_device == "XYZ" or scene.display_settings.display_device == "Rec709": + output_device_color_space = "LinearRGB" #If we render into Blender, YafaRay generates linear output and Blender does the conversion to the color space + + elif scene.display_settings.display_device == "None": + output_device_color_space = "Raw_Manual_Gamma" + output_device_gamma = scene.gs_gamma #We only use the selected gamma if the output device is set to "None" + + yi.paramsSetString("color_space", output_device_color_space) + yi.paramsSetFloat("gamma", output_device_gamma) exportAA(yi, scene) @@ -114,11 +144,6 @@ def exportRenderSettings(yi, scene): yi.paramsSetInt("tile_size", scene.gs_tile_size) yi.paramsSetString("tiles_order", scene.gs_tile_order) - yi.paramsSetBool("z_channel", scene.gs_z_channel) - - if scene.gs_type_render == "into_blender": - yi.paramsSetBool("normalize_z_channel", False) - yi.paramsSetBool("drawParams", scene.gs_draw_params) yi.paramsSetString("customString", scene.gs_custom_string) @@ -133,3 +158,157 @@ def exportRenderSettings(yi, scene): yi.paramsSetFloat("adv_shadow_bias_value", scene.adv_shadow_bias_value) yi.paramsSetBool("adv_auto_min_raydist_enabled", scene.adv_auto_min_raydist_enabled) yi.paramsSetFloat("adv_min_raydist_value", scene.adv_min_raydist_value) + + yi.paramsSetBool("pass_enable", scene.pass_enable) + + yi.paramsSetInt("pass_mask_obj_index", scene.pass_mask_obj_index) + yi.paramsSetInt("pass_mask_mat_index", scene.pass_mask_mat_index) + yi.paramsSetBool("pass_mask_invert", scene.pass_mask_invert) + yi.paramsSetBool("pass_mask_only", scene.pass_mask_only) + + if scene.pass_enable and scene.render.layers[0].use_pass_z: + yi.paramsSetString("pass_Depth", scene.pass_Depth) + else: + yi.paramsSetString("pass_Depth", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_vector: + yi.paramsSetString("pass_Vector", scene.pass_Vector) + else: + yi.paramsSetString("pass_Vector", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_normal: + yi.paramsSetString("pass_Normal", scene.pass_Normal) + else: + yi.paramsSetString("pass_Normal", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_uv: + yi.paramsSetString("pass_UV", scene.pass_UV) + else: + yi.paramsSetString("pass_UV", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_color: + yi.paramsSetString("pass_Color", scene.pass_Color) + else: + yi.paramsSetString("pass_Color", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_emit: + yi.paramsSetString("pass_Emit", scene.pass_Emit) + else: + yi.paramsSetString("pass_Emit", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_mist: + yi.paramsSetString("pass_Mist", scene.pass_Mist) + else: + yi.paramsSetString("pass_Mist", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_diffuse: + yi.paramsSetString("pass_Diffuse", scene.pass_Diffuse) + else: + yi.paramsSetString("pass_Diffuse", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_specular: + yi.paramsSetString("pass_Spec", scene.pass_Spec) + else: + yi.paramsSetString("pass_Spec", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_ambient_occlusion: + yi.paramsSetString("pass_AO", scene.pass_AO) + else: + yi.paramsSetString("pass_AO", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_environment: + yi.paramsSetString("pass_Env", scene.pass_Env) + else: + yi.paramsSetString("pass_Env", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_indirect: + yi.paramsSetString("pass_Indirect", scene.pass_Indirect) + else: + yi.paramsSetString("pass_Indirect", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_shadow: + yi.paramsSetString("pass_Shadow", scene.pass_Shadow) + else: + yi.paramsSetString("pass_Shadow", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_reflection: + yi.paramsSetString("pass_Reflect", scene.pass_Reflect) + else: + yi.paramsSetString("pass_Reflect", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_refraction: + yi.paramsSetString("pass_Refract", scene.pass_Refract) + else: + yi.paramsSetString("pass_Refract", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_object_index: + yi.paramsSetString("pass_IndexOB", scene.pass_IndexOB) + else: + yi.paramsSetString("pass_IndexOB", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_material_index: + yi.paramsSetString("pass_IndexMA", scene.pass_IndexMA) + else: + yi.paramsSetString("pass_IndexMA", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_diffuse_direct: + yi.paramsSetString("pass_DiffDir", scene.pass_DiffDir) + else: + yi.paramsSetString("pass_DiffDir", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_diffuse_indirect: + yi.paramsSetString("pass_DiffInd", scene.pass_DiffInd) + else: + yi.paramsSetString("pass_DiffInd", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_diffuse_color: + yi.paramsSetString("pass_DiffCol", scene.pass_DiffCol) + else: + yi.paramsSetString("pass_DiffCol", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_glossy_direct: + yi.paramsSetString("pass_GlossDir", scene.pass_GlossDir) + else: + yi.paramsSetString("pass_GlossDir", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_glossy_indirect: + yi.paramsSetString("pass_GlossInd", scene.pass_GlossInd) + else: + yi.paramsSetString("pass_GlossInd", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_glossy_color: + yi.paramsSetString("pass_GlossCol", scene.pass_GlossCol) + else: + yi.paramsSetString("pass_GlossCol", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_transmission_direct: + yi.paramsSetString("pass_TransDir", scene.pass_TransDir) + else: + yi.paramsSetString("pass_TransDir", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_transmission_indirect: + yi.paramsSetString("pass_TransInd", scene.pass_TransInd) + else: + yi.paramsSetString("pass_TransInd", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_transmission_color: + yi.paramsSetString("pass_TransCol", scene.pass_TransCol) + else: + yi.paramsSetString("pass_TransCol", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_subsurface_direct: + yi.paramsSetString("pass_SubsurfaceDir", scene.pass_SubsurfaceDir) + else: + yi.paramsSetString("pass_SubsurfaceDir", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_subsurface_indirect: + yi.paramsSetString("pass_SubsurfaceInd", scene.pass_SubsurfaceInd) + else: + yi.paramsSetString("pass_SubsurfaceInd", "disabled") + + if scene.pass_enable and scene.render.layers[0].use_pass_subsurface_color: + yi.paramsSetString("pass_SubsurfaceCol", scene.pass_SubsurfaceCol) + else: + yi.paramsSetString("pass_SubsurfaceCol", "disabled") + + diff --git a/io/yaf_texture.py b/io/yaf_texture.py index 67d52a81..30d44de7 100644 --- a/io/yaf_texture.py +++ b/io/yaf_texture.py @@ -314,7 +314,28 @@ def writeTexture(self, scene, tex): yi.paramsSetBool("use_alpha", tex.yaf_use_alpha) yi.paramsSetBool("calc_alpha", tex.use_calculate_alpha) yi.paramsSetBool("normalmap", tex.yaf_is_normal_map) - yi.paramsSetFloat("gamma", scene.gs_gamma_input) + yi.paramsSetString("fileformat", fileformat.upper()) + + texture_color_space = "sRGB" + texture_gamma = 1.0 + + if tex.image.colorspace_settings.name == "sRGB" or tex.image.colorspace_settings.name == "VD16": + texture_color_space = "sRGB" + + elif tex.image.colorspace_settings.name == "XYZ": + texture_color_space = "XYZ" + + elif tex.image.colorspace_settings.name == "Linear" or tex.image.colorspace_settings.name == "Linear ACES" or tex.image.colorspace_settings.name == "Non-Color": + texture_color_space = "LinearRGB" + + elif tex.image.colorspace_settings.name == "Raw": + texture_color_space = "Raw_Manual_Gamma" + texture_gamma = tex.yaf_gamma_input #We only use the selected gamma if the color space is set to "Raw" + + yi.paramsSetString("color_space", texture_color_space) + yi.paramsSetFloat("gamma", texture_gamma) + + yi.printInfo("Exporter: Creating Texture: '{0}' type {1}: {2}. Texture Color Space: '{3}', gamma={4}".format(name, tex.yaf_tex_type, image_tex, texture_color_space, texture_gamma)) # repeat repeat_x = 1 diff --git a/io/yaf_world.py b/io/yaf_world.py index 67c02b36..0dbedbec 100644 --- a/io/yaf_world.py +++ b/io/yaf_world.py @@ -76,6 +76,25 @@ def exportWorld(self, scene): interpolate = 'bilinear' # yi.paramsSetString("interpolate", interpolate) + + texture_color_space = "sRGB" + texture_gamma = 1.0 + + if worldTex.image.colorspace_settings.name == "sRGB" or worldTex.image.colorspace_settings.name == "VD16": + texture_color_space = "sRGB" + + elif worldTex.image.colorspace_settings.name == "XYZ": + texture_color_space = "XYZ" + + elif worldTex.image.colorspace_settings.name == "Linear" or worldTex.image.colorspace_settings.name == "Linear ACES" or worldTex.image.colorspace_settings.name == "Non-Color": + texture_color_space = "LinearRGB" + + elif worldTex.image.colorspace_settings.name == "Raw": + texture_color_space = "Raw_manualGamma" + texture_gamma = worldTex.yaf_gamma_input #We only use the selected gamma if the color space is set to "Raw" + + yi.paramsSetString("color_space", texture_color_space) + yi.paramsSetFloat("gamma", texture_gamma) yi.createTexture("world_texture") diff --git a/prop/yaf_light.py b/prop/yaf_light.py index de86b878..4fff606b 100644 --- a/prop/yaf_light.py +++ b/prop/yaf_light.py @@ -144,6 +144,12 @@ def register(): name="Cast shadows", description="Enable casting shadows. This is the normal and expected behavior. Disable it only for special cases!", default=True) + + Lamp.light_group = IntProperty( + name="Light Group", + description="Light Group number for Light Group render filtering", + min=1, max=100, + default=1) def unregister(): del Lamp.lamp_type @@ -162,3 +168,4 @@ def unregister(): del Lamp.yaf_show_dist_clip del Lamp.light_enabled del Lamp.cast_shadows + del Lamp.light_group diff --git a/prop/yaf_object.py b/prop/yaf_object.py index fcd59739..006d8df7 100644 --- a/prop/yaf_object.py +++ b/prop/yaf_object.py @@ -59,6 +59,12 @@ def register(): name="Double sided", description="Emit light at both sides of every face", default=False) + + Object.ml_light_group = IntProperty( + name="Light Group", + description="Light Group number for Light Group render filtering", + min=1, max=100, + default=1) Object.bgp_enable = BoolProperty( name="Enable BG portal light", @@ -162,6 +168,7 @@ def unregister(): del Object.ml_power del Object.ml_samples del Object.ml_double_sided + del Object.ml_light_group del Object.bgp_enable del Object.bgp_power del Object.bgp_samples diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index d87677fb..52d11af7 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -25,7 +25,8 @@ FloatVectorProperty, EnumProperty, BoolProperty, - StringProperty) + StringProperty, + CollectionProperty) Scene = bpy.types.Scene @@ -36,17 +37,8 @@ def call_update_fileformat(self, context): render = scene.render if scene.img_output is not render.image_settings.file_format: render.image_settings.file_format = scene.img_output - if render.image_settings.file_format == "OPEN_EXR" and scene.gs_z_channel: - render.image_settings.use_zbuffer = True - def register(): - # Default Gamma values for Windows = 2.2, for Linux and MacOS = 1.8 - if platform == "win32": - gamma = 2.20 - else: - gamma = 1.80 - ########### YafaRays general settings properties ############# Scene.gs_ray_depth = IntProperty( name="Ray depth", @@ -67,12 +59,12 @@ def register(): name="Gamma", description="Gamma correction applied to final output, inverse correction " "of textures and colors is performed", - min=0, max=5, default= 1.0) #gamma) + min=0, max=5, default= 1.0) Scene.gs_gamma_input = FloatProperty( name="Gamma input", description="Gamma correction applied to input", - min=0, max=5, default=gamma) + min=0, max=5, default=1.0) Scene.gs_tile_size = IntProperty( name="Tile size", @@ -195,12 +187,7 @@ def register(): name="Show sample pixels", description="Masks pixels marked for resampling during adaptive passes", default=True) - - Scene.gs_z_channel = BoolProperty( - name="Render depth map", - description="Render depth map (Z-Buffer)", - default=False) - + Scene.gs_verbose = BoolProperty( name="Log info to console", description="Print YafaRay engine log messages in console window", @@ -230,6 +217,11 @@ def register(): ), default='PNG', update=call_update_fileformat) + Scene.img_multilayer = BoolProperty( + name="MultiLayer", + description="Enable MultiLayer image export, only available in certain formats as EXR", + default=False) + ########### YafaRays integrator properties ############# Scene.intg_light_method = EnumProperty( name="Lighting Method", @@ -440,6 +432,352 @@ def register(): ('lanczos', "Lanczos", "AA filter type") ), default="gauss") + + Scene.pass_enable = BoolProperty( + name="Enable render passes", + default=False) + + Scene.pass_mask_obj_index = IntProperty( + name="Mask Object Index", + description="Object index used for masking in the Mask render passes", + min=0, + default=0) + + Scene.pass_mask_mat_index = IntProperty( + name="Mask Material Index", + description="Material index used for masking in the Mask render passes", + min=0, + default=0) + + Scene.pass_mask_invert = BoolProperty( + name="Invert Mask selection", + description="Property to mask-in or mask-out the desired objects/materials in the Mask render passes", + default=False) + + Scene.pass_mask_only = BoolProperty( + name="Mask Only", + description="Property to show the mask only instead of the masked rendered image", + default=False) + + + #The numbers here MUST NEVER CHANGE to keep backwards compatibility with older scenes. The numbers do not need to match the Core internal pass numbers. + #The matching between these properties and the YafaRay Core internal passes is done via the first string, for example 'z-depth-abs'. They must match the list of strings for internal passes in the Core: include/core_api/color.h + + renderPassItemsDisabled=sorted(( + ('disabled', "Disabled", "Disable this pass", "", 999999), + ), key=lambda index: index[1]) + + renderPassItemsBasic=sorted(( + ('combined', "Basic: Combined image", "Basic: Combined standard image", "", 0), + ('diffuse', "Basic: Diffuse", "Basic: Diffuse materials", "", 1), + ('diffuse-noshadow', "Basic: Diffuse (no shadows)", "Basic: Diffuse materials (without shadows)", "", 2), + ('shadow', "Basic: Shadow", "Basic: Shadows", "", 3), + ('env', "Basic: Environment", "Basic: Environmental light", "", 4), + ('indirect', "Basic: Indirect", "Basic: Indirect light (all, including caustics and diffuse)", "", 5), + ('emit', "Basic: Emit", "Basic: Objects emitting light", "", 6), + ('reflect', "Basic: Reflection", "Basic: Reflections (all, including perfect and glossy)", "", 7), + ('refract', "Basic: Refraction", "Basic: Refractions (all, including perfect and sampled)", "", 8), + ('mist', "Basic: Mist", "Basic: Mist", "", 9), + ), key=lambda index: index[1]) + + renderPassItemsDepth=sorted(( + ('z-depth-abs', "Z-Depth (absolute)", "Z-Depth (absolute values)", "", 101), + ('z-depth-norm', "Z-Depth (normalized)", "Z-Depth (normalized values)", "", 102), + ), key=lambda index: index[1]) + + renderPassItemsIndex=sorted(( + ('obj-index-abs', "Index-Object (absolute)", "Index-Object: Grayscale value = obj.index in the object properties (absolute values)", "", 201), + ('obj-index-norm', "Index-Object (normalized)", "Index-Object: Grayscale value = obj.index in the object properties (normalized values)", "", 202), + ('obj-index-auto', "Index-Object (auto)", "Index-Object: A color automatically generated for each object", "", 203), + ('obj-index-mask', "Index-Object Mask", "", "Index-Object: Masking object based on obj.index.mask setting", 204), + ('obj-index-mask-shadow', "Index-Object Mask Shadow", "", "Index-Object: Masking object shadow based on obj.index.mask setting", 205), + ('obj-index-mask-all', "Index-Object Mask All (Object+Shadow)", "", "Index-Object: Masking object+shadow based on obj.index.mask setting", 206), + ('mat-index-abs', "Index-Material (absolute)", "Index-Material: Grayscale value = mat.index in the material properties (absolute values)", "", 207), + ('mat-index-norm', "Index-Material (normalized)", "Index-Material: Grayscale value = mat.index in the material properties (normalized values)", "", 208), + ('mat-index-auto', "Index-Material (auto)", "Index-Material: A color automatically generated for each material", "", 209), + ('mat-index-mask', "Index-Material Mask", "", "Index-Material: Masking material based on mat.index.mask setting", 210), + ('mat-index-mask-shadow', "Index-Material Mask Shadow", "", "Index-Material: Masking material shadow based on mat.index.mask setting", 211), + ('mat-index-mask-all', "Index-Material Mask All (Object+Shadow)", "", "Index-Material: Masking material+shadow based on mat.index.mask setting", 212) + ), key=lambda index: index[1]) + + renderPassItemsDebug=sorted(( + ('debug-aa-samples', "Debug: AA sample count", "Debug: Adaptative AA sample count (estimation), normalized", "", 301), + ('debug-uv', "Debug: UV", "Debug: UV coordinates (black for objects with no UV mapping)", "", 302), + ('debug-dsdv', "Debug: dSdV", "Debug: shading dSdV", "", 303), + ('debug-dsdu', "Debug: dSdU", "Debug: shading dSdU", "", 304), + ('debug-dpdv', "Debug: dPdV", "Debug: surface dPdV", "", 305), + ('debug-dpdu', "Debug: dPdU", "Debug: surface dPdU", "", 306), + ('debug-nv', "Debug: NV", "Debug - surface NV", "", 307), + ('debug-nu', "Debug: NU", "Debug - surface NU", "", 308), + ('debug-normal-geom', "Debug: Normals (geometric)", "Normals (geometric, no smoothness)", "", 309), + ('debug-normal-smooth', "Debug: Normals (smooth)", "Normals (including smoothness)", "", 310), + ), key=lambda index: index[1]) + + renderInternalPassAdvanced=sorted(( + ('adv-reflect', "Adv: Reflection ", "Reflections (perfect only)", "", 401), + ('adv-refract', "Adv: Refraction", "Refractions (perfect only)", "", 402), + ('adv-radiance', "Adv: Photon Radiance map", "Advanced: Radiance map (only for photon mapping)", "", 403), + ('adv-volume-transmittance', "Adv: Volume Transmittance", "Advanced: Volume Transmittance", "", 404), + ('adv-volume-integration', "Adv: Volume integration", "Advanced: Volume integration", "", 405), + ('adv-diffuse-indirect', "Adv: Diffuse Indirect", "Advanced: Diffuse Indirect light", "", 406), + ('adv-diffuse-color', "Adv: Diffuse color", "Advanced: Diffuse color", "", 407), + ('adv-glossy', "Adv: Glossy", "Advanced: Glossy materials", "", 408), + ('adv-glossy-indirect', "Adv: Glossy Indirect", "Advanced: Glossy Indirect light", "", 409), + ('adv-glossy-color', "Adv: Glossy color", "Advanced: Glossy color", "", 410), + ('adv-trans', "Adv: Transmissive", "Advanced: Transmissive materials", "", 411), + ('adv-trans-indirect', "Adv: Trans.Indirect", "Advanced: Transmissive Indirect light", "", 412), + ('adv-trans-color', "Adv: Trans.color", "Advanced: Transmissive color", "", 413), + ('adv-subsurface', "Adv: SubSurface", "Advanced: SubSurface materials", "", 414), + ('adv-subsurface-indirect', "Adv: SubSurf.Indirect", "Advanced: SubSurface Indirect light", "", 415), + ('adv-subsurface-color', "Adv: SubSurf.color", "Advanced: SubSurface color", "", 416), + ('adv-indirect', "Adv: Indirect", "Adv: Indirect light (depends on the integrator but usually caustics only)", "", 417), + ), key=lambda index: index[1]) + + renderPassItemsAO=sorted(( + ('ao', "AO", "Ambient Occlusion", "", 501), + ), key=lambda index: index[1]) + + renderPassItemsLightGroup=sorted(( + ('light-group-0', "Light Group 0", "Pass illuminated by lights from the selected light group", "", 600), + ('light-group-1', "Light Group 1", "Pass illuminated by lights from the selected light group", "", 601), + ('light-group-2', "Light Group 2", "Pass illuminated by lights from the selected light group", "", 602), + ('light-group-3', "Light Group 3", "Pass illuminated by lights from the selected light group", "", 603), + ('light-group-4', "Light Group 4", "Pass illuminated by lights from the selected light group", "", 604), + ('light-group-5', "Light Group 5", "Pass illuminated by lights from the selected light group", "", 605), + ('light-group-6', "Light Group 6", "Pass illuminated by lights from the selected light group", "", 606), + ('light-group-7', "Light Group 7", "Pass illuminated by lights from the selected light group", "", 607), + ), key=lambda index: index[1]) + + #This property is not currently used by YafaRay Core, as the combined external pass is always using the internal combined pass. + Scene.pass_Combined = EnumProperty( + name="Combined", #RGBA (4 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsDisabled + ), + default="disabled") + + Scene.pass_Depth = EnumProperty( + name="Depth", #Gray (1 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsDepth + ), + default="z-depth-norm") + + Scene.pass_Vector = EnumProperty( + name="Vector", #RGBA (4 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex+renderPassItemsDebug + ), + default="obj-index-auto") + + Scene.pass_Normal = EnumProperty( + name="Normal", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex+renderPassItemsDebug + ), + default="debug-normal-smooth") + + Scene.pass_UV = EnumProperty( + name="UV", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex+renderPassItemsDebug + ), + default="debug-uv") + + Scene.pass_Color = EnumProperty( + name="Color", #RGBA (4 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex+renderPassItemsDebug + ), + default="mat-index-auto") + + Scene.pass_Emit = EnumProperty( + name="Emit", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="emit") + + Scene.pass_Mist = EnumProperty( + name="Mist", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="mist") + + Scene.pass_Diffuse = EnumProperty( + name="Diffuse", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="diffuse") + + Scene.pass_Spec = EnumProperty( + name="Spec", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="adv-reflect") + + Scene.pass_AO = EnumProperty( + name="AO", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsAO + ), + default="ao") + + Scene.pass_Env = EnumProperty( + name="Env", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="env") + + Scene.pass_Indirect = EnumProperty( + name="Indirect", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="indirect") + + Scene.pass_Shadow = EnumProperty( + name="Shadow", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="shadow") + + Scene.pass_Reflect = EnumProperty( + name="Reflect", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="reflect") + + Scene.pass_Refract = EnumProperty( + name="Refract", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="refract") + + Scene.pass_IndexOB = EnumProperty( + name="Object Index", #Gray (1 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex + ), + default="obj-index-norm") + + Scene.pass_IndexMA = EnumProperty( + name="Material Index", #Gray (1 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex + ), + default="mat-index-norm") + + Scene.pass_DiffDir = EnumProperty( + name="Diff Dir", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="diffuse") + + Scene.pass_DiffInd = EnumProperty( + name="Diff Ind", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-diffuse-indirect") + + Scene.pass_DiffCol = EnumProperty( + name="Diff Col", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-diffuse-color") + + Scene.pass_GlossDir = EnumProperty( + name="Gloss Dir", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-glossy") + + Scene.pass_GlossInd = EnumProperty( + name="Gloss Ind", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-glossy-indirect") + + Scene.pass_GlossCol = EnumProperty( + name="Gloss Col", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-glossy-color") + + Scene.pass_TransDir = EnumProperty( + name="Trans Dir", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-trans") + + Scene.pass_TransInd = EnumProperty( + name="Trans Ind", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-trans-indirect") + + Scene.pass_TransCol = EnumProperty( + name="Trans Col", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-trans-color") + + Scene.pass_SubsurfaceDir = EnumProperty( + name="SubSurface Dir", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-subsurface") + + Scene.pass_SubsurfaceInd = EnumProperty( + name="SubSurface Ind", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-subsurface-indirect") + + Scene.pass_SubsurfaceCol = EnumProperty( + name="SubSurface Col", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-subsurface-color") + + + class ViewsLightGroupList(bpy.types.PropertyGroup): + view_number = IntProperty( + name="View Number", + description="View Number to which we will assign a light group filter", + default=0, + min=0) + + light_group = IntProperty( + name="Light Group", + description="Light group filter [1..100]. Value 0 will render all light groups", + default=0, + min=0, + max=100) + + bpy.utils.register_class(ViewsLightGroupList) + + Scene.views_lightgroup_list = CollectionProperty(type = ViewsLightGroupList) + Scene.views_lightgroup_list_index = IntProperty(name = "Index for the Views Light Group List", default = -1) def unregister(): @@ -470,11 +808,11 @@ def unregister(): Scene.gs_transp_shad Scene.gs_clamp_rgb Scene.gs_show_sam_pix - Scene.gs_z_channel Scene.gs_verbose Scene.gs_type_render Scene.img_output + Scene.img_multilayer Scene.intg_light_method Scene.intg_use_caustics @@ -510,3 +848,43 @@ def unregister(): Scene.AA_threshold Scene.AA_pixelwidth Scene.AA_filter_type + + Scene.pass_enable + Scene.pass_mask_obj_index + Scene.pass_mask_mat_index + Scene.pass_mask_invert + Scene.pass_mask_only + Scene.pass_Combined + Scene.pass_Depth + Scene.pass_Vector + Scene.pass_Normal + Scene.pass_UV + Scene.pass_Color + Scene.pass_Emit + Scene.pass_Mist + Scene.pass_Diffuse + Scene.pass_Spec + Scene.pass_AO + Scene.pass_Env + Scene.pass_Indirect + Scene.pass_Shadow + Scene.pass_Reflect + Scene.pass_Refract + Scene.pass_IndexOB + Scene.pass_IndexMA + Scene.pass_DiffDir + Scene.pass_DiffInd + Scene.pass_DiffCol + Scene.pass_GlossDir + Scene.pass_GlossInd + Scene.pass_GlossCol + Scene.pass_TransDir + Scene.pass_TransInd + Scene.pass_TransCol + Scene.pass_SubsurfaceDir + Scene.pass_SubsurfaceInd + Scene.pass_SubsurfaceCol + + Scene.views_lightgroup_list + Scene.views_lightgroup_list_index + bpy.utils.unregister_class(ViewsLightGroupList) diff --git a/prop/yaf_texture.py b/prop/yaf_texture.py index b238c485..2e3b8111 100644 --- a/prop/yaf_texture.py +++ b/prop/yaf_texture.py @@ -20,7 +20,8 @@ import bpy from bpy.props import (EnumProperty, - BoolProperty) + BoolProperty, + FloatProperty) Texture = bpy.types.Texture @@ -61,9 +62,15 @@ def register(): name="Use alpha image info", description="Use alpha values for image mapping", default=False) + + Texture.yaf_gamma_input = FloatProperty( + name="Gamma input", + description="Gamma correction applied to input texture", + min=0, max=5, default=1.0) def unregister(): Texture.yaf_tex_type Texture.yaf_is_normal_map Texture.yaf_use_alpha + Texture.yaf_gamma_input diff --git a/ui/__init__.py b/ui/__init__.py index 8f6e52c0..8271381c 100644 --- a/ui/__init__.py +++ b/ui/__init__.py @@ -26,6 +26,8 @@ from . import properties_yaf_strand from . import properties_yaf_object from . import properties_yaf_light +from . import properties_yaf_scene +from . import properties_yaf_layer_passes from bl_ui import properties_object as properties_object for member in dir(properties_object): # add all "object" panels from blender @@ -63,12 +65,16 @@ pass del properties_data_speaker -# YafaRay did not display the Scene panels anymore, due to addition of COMPAT_ENGINES to them from bl_ui import properties_scene as properties_scene for member in dir(properties_scene): - subclass = getattr(properties_scene, member) - try: - subclass.COMPAT_ENGINES.add('YAFA_RENDER') - except: - pass + + if member != "SCENE_PT_color_management": #YafaRay Color management panel is customized in properties_yaf_scene. + #FIXME: The customized YafaRay panel appears at the end of the Blender scene tab panels, I don't know how to rearrange the panels to keep YafaRay color management in the same place as Blender Color Management panel was. + + subclass = getattr(properties_scene, member) + try: + subclass.COMPAT_ENGINES.add('YAFA_RENDER') + except: + pass + del properties_scene diff --git a/ui/properties_yaf_AA_settings.py b/ui/properties_yaf_AA_settings.py index 1bec4d8d..5b84af29 100644 --- a/ui/properties_yaf_AA_settings.py +++ b/ui/properties_yaf_AA_settings.py @@ -27,6 +27,7 @@ class YAF_PT_AA_settings(RenderButtonsPanel, Panel): bl_label = "Anti-Aliasing" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): diff --git a/ui/properties_yaf_camera.py b/ui/properties_yaf_camera.py index ff6db443..1c2e1d3c 100644 --- a/ui/properties_yaf_camera.py +++ b/ui/properties_yaf_camera.py @@ -27,6 +27,7 @@ class YAF_PT_lens(CameraButtonsPanel, Panel): bl_label = "Lens" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): layout = self.layout @@ -81,6 +82,7 @@ def draw(self, context): class YAF_PT_camera(CameraButtonsPanel, Panel): bl_label = "Camera" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): layout = self.layout @@ -110,6 +112,7 @@ def draw(self, context): class YAF_PT_camera_display(CameraButtonsPanel, Panel): bl_label = "Display" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): layout = self.layout diff --git a/ui/properties_yaf_general_settings.py b/ui/properties_yaf_general_settings.py index 83acba25..e599da74 100644 --- a/ui/properties_yaf_general_settings.py +++ b/ui/properties_yaf_general_settings.py @@ -28,13 +28,16 @@ class YAFARAY_MT_presets_render(Menu): bl_label = "Yafaray Render Presets" + COMPAT_ENGINES = {'YAFA_RENDER'} + preset_subdir = "render" preset_operator = "script.execute_preset" draw = yafaray_presets.Yafaray_Menu.draw_preset - + class YAF_PT_general_settings(RenderButtonsPanel, Panel): bl_label = "General Settings" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): layout = self.layout @@ -51,7 +54,6 @@ def draw(self, context): split = layout.split(percentage=0.58) col = split.column() col.prop(scene, "gs_ray_depth") - col.prop(scene, "gs_gamma") col.prop(scene, "gs_type_render") sub = col.column() sub.enabled = scene.gs_type_render == "into_blender" @@ -61,7 +63,7 @@ def draw(self, context): sub = col.column() sub.enabled = scene.gs_transp_shad sub.prop(scene, "gs_shadow_depth") - col.prop(scene, "gs_gamma_input") + #col.prop(scene, "gs_gamma_input") #No longer needed sub = col.column() sub.enabled = scene.gs_auto_threads == False sub.prop(scene, "gs_threads") @@ -73,7 +75,6 @@ def draw(self, context): split = layout.split() col = split.column() - col.prop(scene, "gs_z_channel", toggle=True) col.prop(scene, "gs_transp_shad", toggle=True) col.prop(scene, "gs_draw_params", toggle=True) col.prop(scene, "gs_clamp_rgb", toggle=True) @@ -99,6 +100,7 @@ def draw(self, context): class YAFARAY_MT_clay_render(RenderButtonsPanel, Panel): bl_label = "Clay Render Settings" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): layout = self.layout diff --git a/ui/properties_yaf_integrator.py b/ui/properties_yaf_integrator.py index 23d4efe6..917067fc 100644 --- a/ui/properties_yaf_integrator.py +++ b/ui/properties_yaf_integrator.py @@ -27,6 +27,7 @@ class YAF_PT_render(RenderButtonsPanel, Panel): bl_label = "Integrator" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): layout = self.layout diff --git a/ui/properties_yaf_layer_passes.py b/ui/properties_yaf_layer_passes.py new file mode 100755 index 00000000..4c8cbb06 --- /dev/null +++ b/ui/properties_yaf_layer_passes.py @@ -0,0 +1,404 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# + +import bpy +from bpy.types import Panel +from bl_ui.properties_render_layer import RenderLayerButtonsPanel + +RenderLayerButtonsPanel.COMPAT_ENGINES = {'YAFA_RENDER'} + +class ViewsLightGroupList_UL_List(bpy.types.UIList): + COMPAT_ENGINES = {'YAFA_RENDER'} + def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + + if self.layout_type in {'DEFAULT', 'COMPACT'}: + layout.prop(item, "view_number") + + if item.view_number < len(context.scene.render.views): + layout.label("", icon = 'SCENE') + layout.label(context.scene.render.views[item.view_number].name) + layout.label("", icon = 'LAMP') + layout.prop(item, "light_group") + else: + layout.label("", icon = 'ERROR') + layout.label("View not defined, skipping.") + + elif self.layout_type in {'GRID'}: + layout.alignment = 'CENTER' + layout.label("", icon = custom_icon) + +bpy.utils.register_class(ViewsLightGroupList_UL_List) # ( inside register() ) FIXME DAVID?? + +class ViewsLightGroupList_OT_NewItem(bpy.types.Operator): + bl_idname = "views_lightgroup_list.new_item" + bl_label = "Add a new View-Light Group Filter assignment" + COMPAT_ENGINES = {'YAFA_RENDER'} + + def execute(self, context): + context.scene.views_lightgroup_list.add() + + return{'FINISHED'} + +bpy.utils.register_class(ViewsLightGroupList_OT_NewItem) # ( inside register() ) FIXME DAVID?? + +class ViewsLightGroupList_OT_DeleteItem(bpy.types.Operator): + bl_idname = "views_lightgroup_list.delete_item" + bl_label = "Delete a View-Light Group Filter assignment" + COMPAT_ENGINES = {'YAFA_RENDER'} + + @classmethod + def poll(self, context): + return len(context.scene.views_lightgroup_list) > 0 + + def execute(self, context): + list = context.scene.views_lightgroup_list + index = context.scene.views_lightgroup_list_index + + list.remove(index) + + if index > 0: + index = index - 1 + + return{'FINISHED'} + +bpy.utils.register_class(ViewsLightGroupList_OT_DeleteItem) # ( inside register() ) FIXME DAVID?? + +class YAFRENDER_PT_layers(RenderLayerButtonsPanel, Panel): + bl_label = "Layers" + COMPAT_ENGINES = {'YAFA_RENDER'} +# bl_options = {'DEFAULT_CLOSED'} + + def draw(self, context): + layout = self.layout + + scene = context.scene + rd = scene.render + + row = layout.row() + if bpy.app.version < (2, 65, 3 ): + row.template_list(rd, "layers", rd.layers, "active_index", rows=2) + else: + row.template_list("RENDERLAYER_UL_renderlayers", "", rd, "layers", rd.layers, "active_index", rows=2) + + col = row.column(align=True) + col.operator("scene.render_layer_add", icon='ZOOMIN', text="") + col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="") + + row = layout.row() + rl = rd.layers.active + row.prop(rl, "name") + row.prop(rd, "use_single_layer", text="", icon_only=True) + + split = layout.split() + + col = split.column() + col.prop(scene, "layers", text="Scene") + # TODO: Implement material override + #col.prop(rl, "material_override", text="Material") + + col = split.column() + # TODO: Implement render layers + #col.prop(rl, "layers", text="Layer") + +class YAFRENDER_PT_layer_passes(RenderLayerButtonsPanel, Panel): + bl_label = "Render Passes" + COMPAT_ENGINES = {'YAFA_RENDER'} + + def draw_header(self, context): + scene = context.scene + self.layout.prop(scene, "pass_enable", text="") + + def draw(self, context): + layout = self.layout + + scene = context.scene + rd = scene.render + rl = rd.layers.active + + #row = layout.row(align=True) + #row.alignment = 'LEFT' + + #row.prop(scene, "pass_enable", toggle=True) #, "optional extended description") + if scene.pass_enable: + + row = layout.row() #(align=True) + #row.alignment = 'LEFT' + ##row.prop(rl, "use_pass_combined") + ##if scene.render.layers[0].use_pass_combined: + ## sub = row.column(align=True) + ## sub.prop(scene, "pass_combined", "") + + row = layout.row() #(align=True) + #row.alignment = 'LEFT' + row.prop(rl, "use_pass_z") #, "Z-depth") + if scene.render.layers[0].use_pass_z: + sub = row.column(align=True) + sub.prop(scene, "pass_Depth", "") + + row = layout.row() + row.prop(rl, "use_pass_vector") + if scene.render.layers[0].use_pass_vector: + sub = row.column(align=True) + sub.prop(scene, "pass_Vector", "") + + row = layout.row() + row.prop(rl, "use_pass_normal") + if scene.render.layers[0].use_pass_normal: + sub = row.column(align=True) + sub.prop(scene, "pass_Normal", "") + + row = layout.row() + row.prop(rl, "use_pass_uv") + if scene.render.layers[0].use_pass_uv: + sub = row.column(align=True) + sub.prop(scene, "pass_UV", "") + + row = layout.row() + row.prop(rl, "use_pass_color") + if scene.render.layers[0].use_pass_color: + sub = row.column(align=True) + sub.prop(scene, "pass_Color", "") + + row = layout.row() + row.prop(rl, "use_pass_emit") + if scene.render.layers[0].use_pass_emit: + sub = row.column(align=True) + sub.prop(scene, "pass_Emit", "") + + row = layout.row() + row.prop(rl, "use_pass_mist") + if scene.render.layers[0].use_pass_mist: + sub = row.column(align=True) + sub.prop(scene, "pass_Mist", "") + + row = layout.row() + row.prop(rl, "use_pass_diffuse") + if scene.render.layers[0].use_pass_diffuse: + sub = row.column(align=True) + sub.prop(scene, "pass_Diffuse", "") + + row = layout.row() + row.prop(rl, "use_pass_specular") + if scene.render.layers[0].use_pass_specular: + sub = row.column(align=True) + sub.prop(scene, "pass_Spec", "") + + row = layout.row() + row.prop(rl, "use_pass_ambient_occlusion") + if scene.render.layers[0].use_pass_ambient_occlusion: + sub = row.column(align=True) + sub.prop(scene, "pass_AO", "") + row = layout.row() + col = row.column() + col.prop(scene, "intg_AO_color") + col.prop(scene, "intg_AO_samples") + col.prop(scene, "intg_AO_distance") + + row = layout.row() + row.prop(rl, "use_pass_environment") + if scene.render.layers[0].use_pass_environment: + sub = row.column(align=True) + sub.prop(scene, "pass_Env", "") + + row = layout.row() + row.prop(rl, "use_pass_indirect") + if scene.render.layers[0].use_pass_indirect: + sub = row.column(align=True) + sub.prop(scene, "pass_Indirect", "") + + row = layout.row() + row.prop(rl, "use_pass_shadow") + if scene.render.layers[0].use_pass_shadow: + sub = row.column(align=True) + sub.prop(scene, "pass_Shadow", "") + + row = layout.row() + row.prop(rl, "use_pass_reflection") + if scene.render.layers[0].use_pass_reflection: + sub = row.column(align=True) + sub.prop(scene, "pass_Reflect", "") + + row = layout.row() + row.prop(rl, "use_pass_refraction") + if scene.render.layers[0].use_pass_refraction: + sub = row.column(align=True) + sub.prop(scene, "pass_Refract", "") + + row = layout.row() + row.prop(rl, "use_pass_object_index") + if scene.render.layers[0].use_pass_object_index: + sub = row.column(align=True) + sub.prop(scene, "pass_IndexOB", "") + + row = layout.row() + row.prop(rl, "use_pass_material_index") + if scene.render.layers[0].use_pass_material_index: + sub = row.column(align=True) + sub.prop(scene, "pass_IndexMA", "") + + row = layout.row() + row.prop(rl, "use_pass_diffuse_direct") + if scene.render.layers[0].use_pass_diffuse_direct: + sub = row.column(align=True) + sub.prop(scene, "pass_DiffDir", "") + + row = layout.row() + row.prop(rl, "use_pass_diffuse_indirect") + if scene.render.layers[0].use_pass_diffuse_indirect: + sub = row.column(align=True) + sub.prop(scene, "pass_DiffInd", "") + + row = layout.row() + row.prop(rl, "use_pass_diffuse_color") + if scene.render.layers[0].use_pass_diffuse_color: + sub = row.column(align=True) + sub.prop(scene, "pass_DiffCol", "") + + row = layout.row() + row.prop(rl, "use_pass_glossy_direct") + if scene.render.layers[0].use_pass_glossy_direct: + sub = row.column(align=True) + sub.prop(scene, "pass_GlossDir", "") + + row = layout.row() + row.prop(rl, "use_pass_glossy_indirect") + if scene.render.layers[0].use_pass_glossy_indirect: + sub = row.column(align=True) + sub.prop(scene, "pass_GlossInd", "") + + row = layout.row() + row.prop(rl, "use_pass_glossy_color") + if scene.render.layers[0].use_pass_glossy_color: + sub = row.column(align=True) + sub.prop(scene, "pass_GlossCol", "") + + row = layout.row() + row.prop(rl, "use_pass_transmission_direct") + if scene.render.layers[0].use_pass_transmission_direct: + sub = row.column(align=True) + sub.prop(scene, "pass_TransDir", "") + + row = layout.row() + row.prop(rl, "use_pass_transmission_indirect") + if scene.render.layers[0].use_pass_transmission_indirect: + sub = row.column(align=True) + sub.prop(scene, "pass_TransInd", "") + + row = layout.row() + row.prop(rl, "use_pass_transmission_color") + if scene.render.layers[0].use_pass_transmission_color: + sub = row.column(align=True) + sub.prop(scene, "pass_TransCol", "") + + row = layout.row() + row.prop(rl, "use_pass_subsurface_direct") + if scene.render.layers[0].use_pass_subsurface_direct: + sub = row.column(align=True) + sub.prop(scene, "pass_SubsurfaceDir", "") + + row = layout.row() + row.prop(rl, "use_pass_subsurface_indirect") + if scene.render.layers[0].use_pass_subsurface_indirect: + sub = row.column(align=True) + sub.prop(scene, "pass_SubsurfaceInd", "") + + row = layout.row() + row.prop(rl, "use_pass_subsurface_color") + if scene.render.layers[0].use_pass_subsurface_color: + sub = row.column(align=True) + sub.prop(scene, "pass_SubsurfaceCol", "") + + row = layout.row() + row.prop(scene, "pass_mask_obj_index") + + sub = row.column(align=True) + sub.prop(scene, "pass_mask_mat_index") + + row = layout.row() + row.prop(scene, "pass_mask_invert") + + sub = row.column(align=True) + sub.prop(scene, "pass_mask_only") + + +class YAFRENDER_PT_views(RenderLayerButtonsPanel, Panel): + bl_label = "Views" + COMPAT_ENGINES = {'YAFA_RENDER'} + + def draw_header(self, context): + rd = context.scene.render + self.layout.prop(rd, "use_multiview", text="") + + def draw(self, context): + layout = self.layout + + scene = context.scene + rd = scene.render + rv = rd.views.active + + if rd.use_multiview: + layout.active = rd.use_multiview + basic_stereo = rd.views_format == 'STEREO_3D' + + row = layout.row() + row.prop(rd, "views_format", expand=True) + + if basic_stereo: + row = layout.row() + row.template_list("RENDERLAYER_UL_renderviews", "name", rd, "stereo_views", rd.views, "active_index", rows=2) + + row = layout.row() + row.label(text="File Suffix:") + row.prop(rv, "file_suffix", text="") + + else: + row = layout.row() + row.template_list("RENDERLAYER_UL_renderviews", "name", rd, "views", rd.views, "active_index", rows=2) + + col = row.column(align=True) + col.operator("scene.render_view_add", icon='ZOOMIN', text="") + col.operator("scene.render_view_remove", icon='ZOOMOUT', text="") + + row = layout.row() + row.label(text="Camera Suffix:") + row.prop(rv, "camera_suffix", text="") + + row = layout.row() + row.label(text="Views - Light Group filters:") + if len(scene.views_lightgroup_list) == 0: + row = layout.row() + row.label(icon="INFO", text="No views/light group filters defined.") + row = layout.row() + row.label(icon="INFO", text="By default all views will be rendered with all lights.") + row = layout.row() + row.template_list("ViewsLightGroupList_UL_List", "ViewsLightGroupList", scene, "views_lightgroup_list", scene, "views_lightgroup_list_index", rows=2) + col = row.column(align=True) + col.operator('views_lightgroup_list.new_item', icon='ZOOMIN', text="") + col.operator('views_lightgroup_list.delete_item', icon='ZOOMOUT', text="") + if len(scene.views_lightgroup_list) > 0: + row = layout.row() + row.label(icon="INFO", text="Only the selected views with the assigned light groups will be rendered") + row = layout.row() + row.label(icon="INFO", text="If several light groups are assigned to the same view, ONLY THE LAST ONE will be imported into Blender.") + + +if __name__ == "__main__": # only for live edit. + import bpy + bpy.utils.register_module(__name__) diff --git a/ui/properties_yaf_light.py b/ui/properties_yaf_light.py index 2d548bc0..743a3733 100644 --- a/ui/properties_yaf_light.py +++ b/ui/properties_yaf_light.py @@ -53,6 +53,7 @@ def draw(self, context): layout.prop(lamp, "lamp_type", expand=True) layout.prop(lamp, "light_enabled") + layout.prop(lamp, "light_group") if lamp.lamp_type == "area": layout.prop(lamp, "color") diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index 81803aff..cc7c0c7c 100644 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -100,6 +100,7 @@ def draw(self, context): class YAF_MATERIAL_PT_preview(MaterialButtonsPanel, Panel): bl_label = "Preview" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): self.layout.template_preview(context.material) @@ -135,6 +136,7 @@ def draw(self, context): class YAF_MT_presets_ior_list(Menu): bl_label = "Glass" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): sl = self.layout @@ -144,6 +146,7 @@ def draw(self, context): class YAF_PT_shinydiffuse_diffuse(MaterialTypePanel, Panel): bl_label = "Diffuse reflection" + COMPAT_ENGINES = {'YAFA_RENDER'} material_type = 'shinydiffusemat' def draw(self, context): @@ -178,6 +181,7 @@ def draw(self, context): class YAF_PT_shinydiffuse_specular(MaterialTypePanel, Panel): bl_label = "Specular reflection" + COMPAT_ENGINES = {'YAFA_RENDER'} material_type = 'shinydiffusemat' def draw(self, context): @@ -195,10 +199,11 @@ def draw(self, context): sub.enabled = yaf_mat.fresnel_effect sub.prop(yaf_mat, "IOR_reflection", slider=True) layout.row().prop(yaf_mat, "specular_reflect", slider=True) - + class YAF_PT_glossy_diffuse(MaterialTypePanel, Panel): bl_label = "Diffuse reflection" + COMPAT_ENGINES = {'YAFA_RENDER'} material_type = 'glossy', 'coated_glossy' def draw(self, context): @@ -221,6 +226,7 @@ def draw(self, context): class YAF_PT_glossy_specular(MaterialTypePanel, Panel): bl_label = "Specular reflection" + COMPAT_ENGINES = {'YAFA_RENDER'} material_type = 'glossy', 'coated_glossy' def draw(self, context): @@ -261,6 +267,7 @@ def draw(self, context): class YAF_PT_glass_real(MaterialTypePanel, Panel): bl_label = "Real glass settings" + COMPAT_ENGINES = {'YAFA_RENDER'} material_type = 'glass', 'rough_glass' def draw(self, context): @@ -292,6 +299,7 @@ def draw(self, context): class YAF_PT_glass_fake(MaterialTypePanel, Panel): bl_label = "Fake glass settings" + COMPAT_ENGINES = {'YAFA_RENDER'} material_type = 'glass', 'rough_glass' def draw(self, context): @@ -309,6 +317,7 @@ def draw(self, context): class YAF_PT_blend_(MaterialTypePanel, Panel): bl_label = "Blend material settings" + COMPAT_ENGINES = {'YAFA_RENDER'} material_type = 'blend' def draw(self, context): @@ -347,12 +356,15 @@ def draw(self, context): class YAF_PT_advanced(MaterialButtonsPanel, Panel): bl_label = "Advanced settings" + COMPAT_ENGINES = {'YAFA_RENDER'} bl_options = {'DEFAULT_CLOSED'} def draw(self, context): layout = self.layout yaf_mat = active_node_mat(context.material) + layout.prop(yaf_mat, "pass_index") + split = layout.split() col = split.column() layout.row().prop(yaf_mat, "visibility") diff --git a/ui/properties_yaf_object.py b/ui/properties_yaf_object.py index 7cbdd6c5..0f7a2b6f 100644 --- a/ui/properties_yaf_object.py +++ b/ui/properties_yaf_object.py @@ -42,6 +42,7 @@ def draw(self, context): if ob.ml_enable: col = layout.column(align=True) + col.prop(ob, "ml_light_group") col.prop(ob, "ml_color") col.prop(ob, "ml_power") layout.prop(ob, "ml_samples") @@ -78,6 +79,7 @@ def draw(self, context): col.prop(ob, "vol_cover") col.prop(ob, "vol_density") + #layout.prop(ob, "pass_index") #no need for this, there is a pass_index field by default in the object properties panel, but just in case I'm leaving this here. if __name__ == "__main__": # only for live edit. import bpy diff --git a/ui/properties_yaf_render.py b/ui/properties_yaf_render.py index 4f54a5ac..a77c000d 100644 --- a/ui/properties_yaf_render.py +++ b/ui/properties_yaf_render.py @@ -27,6 +27,7 @@ class YAFRENDER_PT_render(RenderButtonsPanel, Panel): bl_label = "Render" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): @@ -39,46 +40,9 @@ def draw(self, context): layout.row().operator("render.render_view", text="Render 3D View", icon='VIEW3D') layout.prop(rd, "display_mode", text="Display") - -class YAFRENDER_PT_layers(RenderButtonsPanel, Panel): - bl_label = "Layers" - bl_options = {'DEFAULT_CLOSED'} - - def draw(self, context): - layout = self.layout - - scene = context.scene - rd = scene.render - - row = layout.row() - if bpy.app.version < (2, 65, 3 ): - row.template_list(rd, "layers", rd.layers, "active_index", rows=2) - else: - row.template_list("RENDERLAYER_UL_renderlayers", "", rd, "layers", rd.layers, "active_index", rows=2) - - col = row.column(align=True) - col.operator("scene.render_layer_add", icon='ZOOMIN', text="") - col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="") - - row = layout.row() - rl = rd.layers.active - row.prop(rl, "name") - row.prop(rd, "use_single_layer", text="", icon_only=True) - - split = layout.split() - - col = split.column() - col.prop(scene, "layers", text="Scene") - # TODO: Implement material override - #col.prop(rl, "material_override", text="Material") - - col = split.column() - # TODO: Implement render layers - #col.prop(rl, "layers", text="Layer") - - class YAFRENDER_PT_dimensions(RenderButtonsPanel, Panel): bl_label = "Dimensions" + COMPAT_ENGINES = {'YAFA_RENDER'} bl_options = {'DEFAULT_CLOSED'} def draw(self, context): @@ -121,6 +85,7 @@ def draw(self, context): class YAFRENDER_PT_output(RenderButtonsPanel, Panel): bl_label = "Output" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): layout = self.layout @@ -137,9 +102,36 @@ def draw(self, context): col = split.column() col.row().prop(image_settings, "color_mode", text="Color", expand=True) + if sc.img_output == "OPEN_EXR": + split = layout.split() + split.prop(sc, "img_multilayer") + + if sc.img_output == "OPEN_EXR" or sc.img_output == "HDR": #If the output file is a HDR/EXR file, we force the render output to Linear + pass + elif sc.gs_type_render == "file" or sc.gs_type_render == "xml": + split = layout.split(percentage=0.6) + col = split.column() + col.prop(sc.display_settings, "display_device") + + if sc.display_settings.display_device == "None": + col = split.column() + col.prop(scene, "gs_gamma", text = "Gamma") + + if sc.display_settings.display_device == "sRGB": + pass + elif sc.display_settings.display_device == "None": + pass + elif sc.display_settings.display_device == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + sc.display_settings.display_device + "', assuming sRGB", icon="ERROR") + class YAFRENDER_PT_post_processing(RenderButtonsPanel, Panel): bl_label = "Post Processing" + COMPAT_ENGINES = {'YAFA_RENDER'} bl_options = {'DEFAULT_CLOSED'} def draw(self, context): @@ -157,16 +149,18 @@ def draw(self, context): col.prop(rd, "dither_intensity", text="Dither", slider=True) -class YAF_PT_convert(RenderButtonsPanel, Panel): +class YAFRENDER_PT_convert(RenderButtonsPanel, Panel): bl_label = "Convert old YafaRay Settings" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): layout = self.layout layout.column().operator("data.convert_yafaray_properties", text="Convert data from 2.4x") -class YAF_PT_advanced(RenderButtonsPanel, Panel): +class YAFRENDER_PT_advanced(RenderButtonsPanel, Panel): bl_label = "Advanced Settings - only for experts" + COMPAT_ENGINES = {'YAFA_RENDER'} bl_options = {'DEFAULT_CLOSED'} def draw(self, context): diff --git a/ui/properties_yaf_scene.py b/ui/properties_yaf_scene.py new file mode 100644 index 00000000..71abc501 --- /dev/null +++ b/ui/properties_yaf_scene.py @@ -0,0 +1,59 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# + +import bpy +from yafaray.ot import yafaray_presets +from bl_ui.properties_scene import SceneButtonsPanel +from bpy.types import Panel, Menu + +class YAF_PT_color_management(SceneButtonsPanel, Panel): + bl_label = "Color Management" + COMPAT_ENGINES = {'YAFA_RENDER'} + + def draw(self, context): + layout = self.layout + + scene = context.scene + + col = layout.column() + col.label(text="Display:") + col.prop(scene.display_settings, "display_device") + + if scene.display_settings.display_device == "sRGB": + pass + elif scene.display_settings.display_device == "None": + row = layout.row(align=True) + row.prop(scene, "gs_gamma", text = "Display device output gamma") + elif scene.display_settings.display_device == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + scene.display_settings.display_device + "', assuming sRGB", icon="ERROR") + + col = layout.column() + col.separator() + col.label(text="Render:") + col.template_colormanaged_view_settings(scene, "view_settings") + + +if __name__ == "__main__": # only for live edit. + import bpy + bpy.utils.register_module(__name__) diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index 76c6948c..f4cd7f53 100644 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -259,6 +259,28 @@ def draw(self, context): tex = context.texture layout.template_image(tex, "image", tex.image_user) + if tex.image.colorspace_settings.name == "sRGB" or tex.image.colorspace_settings.name == "Linear" or tex.image.colorspace_settings.name == "Non-Color": + pass + + elif tex.image.colorspace_settings.name == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Linear ACES": + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming linear RGB", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Raw": + row = layout.row(align=True) + row.prop(tex, "yaf_gamma_input", text="Texture gamma input correction") + + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming sRGB", icon="ERROR") + + row = layout.row(align=True) + row.label(text="Note: for bump/normal maps, textures are always considered Linear", icon="INFO") + class YAF_TEXTURE_PT_image_sampling(YAF_TextureTypePanel, Panel): bl_label = "Image Sampling" diff --git a/ui/properties_yaf_volume_integrator.py b/ui/properties_yaf_volume_integrator.py index e44b7e1d..34108d16 100644 --- a/ui/properties_yaf_volume_integrator.py +++ b/ui/properties_yaf_volume_integrator.py @@ -27,6 +27,7 @@ class YAF_PT_vol_integrator(WorldButtonsPanel, Panel): bl_label = "YafaRay Volume Integrator" + COMPAT_ENGINES = {'YAFA_RENDER'} def draw(self, context): layout = self.layout diff --git a/ui/properties_yaf_world.py b/ui/properties_yaf_world.py index e87dab89..d39c524e 100644 --- a/ui/properties_yaf_world.py +++ b/ui/properties_yaf_world.py @@ -36,6 +36,7 @@ class YAFWORLD_PT_world(WorldButtonsPanel, Panel): bl_label = "Background Settings" + COMPAT_ENGINES = {'YAFA_RENDER'} ibl = True def draw(self, context): @@ -78,6 +79,26 @@ def draw(self, context): if tex.yaf_tex_type == "IMAGE": # it allows to change the used image # layout.template_image(tex, "image", tex.image_user, compact=True) + + if tex.image.colorspace_settings.name == "sRGB" or tex.image.colorspace_settings.name == "Linear" or tex.image.colorspace_settings.name == "Non-Color": + pass + + elif tex.image.colorspace_settings.name == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Linear ACES": + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming linear RGB", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Raw": + row = layout.row(align=True) + row.prop(tex, "yaf_gamma_input", text="Texture gamma input correction") + + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming sRGB", icon="ERROR") + # else: # TODO: create message about not allow texture type From 6739e1a0141f6707ef5bda1e3d1fd42fdc53ddf4 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 10 Oct 2015 18:30:46 +0100 Subject: [PATCH 28/81] Some after-merge cleanup Changes to be committed: modified: ui/properties_yaf_render.py --- ui/properties_yaf_render.py | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/ui/properties_yaf_render.py b/ui/properties_yaf_render.py index 45caa140..a77c000d 100755 --- a/ui/properties_yaf_render.py +++ b/ui/properties_yaf_render.py @@ -101,6 +101,7 @@ def draw(self, context): col.prop(sc, "img_output", text="", icon='IMAGE_DATA') col = split.column() col.row().prop(image_settings, "color_mode", text="Color", expand=True) + if sc.img_output == "OPEN_EXR": split = layout.split() split.prop(sc, "img_multilayer") @@ -127,28 +128,6 @@ def draw(self, context): row = layout.row(align=True) row.label(text="YafaRay doesn't support '" + sc.display_settings.display_device + "', assuming sRGB", icon="ERROR") - if sc.img_output == "OPEN_EXR" or sc.img_output == "HDR": #If the output file is a HDR/EXR file, we force the render output to Linear - pass - elif sc.gs_type_render == "file" or sc.gs_type_render == "xml": - split = layout.split(percentage=0.6) - col = split.column() - col.prop(sc.display_settings, "display_device") - - if sc.display_settings.display_device == "None": - col = split.column() - col.prop(scene, "gs_gamma", text = "Gamma") - - if sc.display_settings.display_device == "sRGB": - pass - elif sc.display_settings.display_device == "None": - pass - elif sc.display_settings.display_device == "XYZ": - row = layout.row(align=True) - row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") - else: - row = layout.row(align=True) - row.label(text="YafaRay doesn't support '" + sc.display_settings.display_device + "', assuming sRGB", icon="ERROR") - class YAFRENDER_PT_post_processing(RenderButtonsPanel, Panel): bl_label = "Post Processing" From bfa4296fb878260f93ade276c2a91d75ef1ec396 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sun, 11 Oct 2015 07:19:32 +0100 Subject: [PATCH 29/81] Added the advanced:surface integration render pass in the exporter Changes to be committed: modified: prop/yaf_scene.py --- prop/yaf_scene.py | 1 + 1 file changed, 1 insertion(+) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 52d11af7..5efb15ff 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -531,6 +531,7 @@ def register(): ('adv-subsurface-indirect', "Adv: SubSurf.Indirect", "Advanced: SubSurface Indirect light", "", 415), ('adv-subsurface-color', "Adv: SubSurf.color", "Advanced: SubSurface color", "", 416), ('adv-indirect', "Adv: Indirect", "Adv: Indirect light (depends on the integrator but usually caustics only)", "", 417), + ('adv-surface-integration', "Adv: Surface Integration", "Advanced: Surface Integration", "", 418), ), key=lambda index: index[1]) renderPassItemsAO=sorted(( From a79fafc5342a9ff90ad98f953e4059d71cd5f054 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sun, 11 Oct 2015 22:15:12 +0100 Subject: [PATCH 30/81] Output Alpha Premultiply corrections As described in http://yafaray.org/node/682 the Blender Exporter has problems in the Alpha Premultiply option: * Blender expects an already premultiplied output from YafaRay, but if premultiply was disabled in an older version of YafaRay, it's no longer possible to enable it in recent versions of the Exporter, causing wrong renders into Blender. * Now, premultiply is always forced to "True" when exporting into Blender * Also, when exporting into File or XML, a checkbox next to the output file name is shown to allow enabling or disabling Premultiply Alpha, giving more choices to the users depending whether they want their output images to be premultiplied or not Changes to be committed: modified: io/yaf_scene.py modified: ui/properties_yaf_render.py --- io/yaf_scene.py | 6 +++++- ui/properties_yaf_render.py | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/io/yaf_scene.py b/io/yaf_scene.py index b30ad1bb..c0e9f65c 100644 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -139,7 +139,11 @@ def exportRenderSettings(yi, scene): yi.paramsSetBool("clamp_rgb", scene.gs_clamp_rgb) yi.paramsSetBool("show_sam_pix", scene.gs_show_sam_pix) - yi.paramsSetBool("premult", scene.gs_premult) + + if scene.gs_type_render == "file" or scene.gs_type_render == "xml": + yi.paramsSetBool("premult", scene.gs_premult) + else: + yi.paramsSetBool("premult", True) #We force alpha premultiply when rendering into Blender as it expects premultiplied input yi.paramsSetInt("tile_size", scene.gs_tile_size) yi.paramsSetString("tiles_order", scene.gs_tile_order) diff --git a/ui/properties_yaf_render.py b/ui/properties_yaf_render.py index 5d6151a3..8f656805 100644 --- a/ui/properties_yaf_render.py +++ b/ui/properties_yaf_render.py @@ -158,6 +158,17 @@ def draw(self, context): else: row = layout.row(align=True) row.label(text="YafaRay doesn't support '" + sc.display_settings.display_device + "', assuming sRGB", icon="ERROR") + + if sc.gs_type_render == "file" or sc.gs_type_render == "xml": + split = layout.split(percentage=0.6) + col = split.column() + col.prop(sc, "gs_premult", text = "Premultiply Alpha") + if sc.img_output == "OPEN_EXR" and not sc.gs_premult: + row = layout.row(align=True) + row.label(text="Typically you should enable Premultiply in EXR files", icon="INFO") + if sc.img_output == "PNG" and sc.gs_premult: + row = layout.row(align=True) + row.label(text="Typically you should disable Premultiply in PNG files", icon="INFO") class YAFRENDER_PT_post_processing(RenderButtonsPanel, Panel): From d58de1a02521711307b107fa3f21c60982ecf93a Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Tue, 13 Oct 2015 21:02:44 +0100 Subject: [PATCH 31/81] New release version number, Readme files and Changelog --- CHANGELOG | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++++ INSTALL | 21 +++++++ README | 77 ++++++------------------- __init__.py | 2 +- 4 files changed, 204 insertions(+), 59 deletions(-) create mode 100644 CHANGELOG create mode 100644 INSTALL diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 00000000..14e11202 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,163 @@ +YafaRay-E (Experimental) Change Log (current version at the top, oldest at the bottom) + +Note: this CHANGELOG file only shows the YafaRay-E releases and changes, not the official stable YafaRay changes. + +For more information about releases and changes see: https://github.com/DavidBluecame/Blender-Exporter/releases + + +Yafaray-E v1.0.0 (2015-10-13) for Blender 2.76: +----------------------------------------------- +Note: from v1.0.0 I will no longer use the suffix "beta", as all YafaRay-Experimental versions are inherently betas ;-). I will use for version scheme: "Major.Minor.Bugfix". Major will be very important and structural changes with possible API breakage, Minor will be new and modified functionality without API breakage, Bugfix will be small changes and bugfixes. + +- IMPORTANT CHANGES to Color Management and Color Pipeline Linear Workflow: http://www.yafaray.org/node/670 + +Initial prototype to try to fix the (apparently broken) YafaRay color pipeline workflow and to replace the simple gamma input/output correction with a proper sRGB decoding/coding in non-HDR files. + +More information here: http://www.yafaray.org/node/670 + +So, I've prepared a YafaRay prototype that fixes the next issues: + +* Improved Blender Color Space integration. +* The "simple" gamma correction has been replaced by Color Spaces: + - LinearRGB Linear values, no gamma correction + - sRGB sRGB encoding/decoding + - XYZ XYZ (very experimental) support + - Raw_Manual_Gamma Raw linear values that allow to set a simple gamma output correction manually + +* Fixed: Double application of input gamma to the Blender Color picker. So now scenes will look brighter in general, but they should also look more realistic with less tweaking. +* Gamma input correction no longer used. The color picker floating point color values will be considered already linear and no conversion applied to them. +* For textures, added specific per-texture Color Space and gamma parameters. +* The color values exported to the XML file will be encoded acording to Blender Output Device Color Space setting. +* In yafaray-xml, new commandline option added: "-ics" or "--input-color-space" that allows to select how to interpret the XML color values. By default, for backwards compatibility, color values will be read as "LinearRGB", but using "-ics sRGB", the color values will be interpreted as sRGB. This setting does *not* affect the textures, as they have already per-texture specific color space/gamma parameters. +* Fixed: when exporting to file there was an error in Blender while reopening it to be shown in the Blender image view. + + +Several bug tracker entries are supposed to be fixed with this change: +* Color pipeline bug: http://www.yafaray.org/node/670 +* Linear output forced on every scene: http://www.yafaray.org/node/603 +* Gamma 1.80 input on linux: http://www.yafaray.org/node/604 +* Forward compatibility with Blender Color Management: http://www.yafaray.org/node/547 +* Gamma correction performed on EXR files: http://www.yafaray.org/node/549 + + + +- IMPORTANT CHANGES to Volumetrics for proper raytracing of volumes: + +Problems with volumes and transparent objects have been reported in the bug tracker several times: +http://yafaray.org/node/289 +http://yafaray.org/node/666 + +The problem was that Volumes were not really included in the raytracing process, so they were not reflected nor refracted. Now Volumes have been included in the raytracing process, so they can be refracted and reflected as any other objects. This is a significant change that could cause new issues, so please let us know about any problems in YafaRay bug tracker. + +Now, if there are no parameters set in the XML for transparent background or transparent refracted background, their default values will be "false" and not "true" as until now. This will avoid confusion due to the new way "transparent refracted background" works, not rendering the background at all so volumes rendered against a transparent background do not carry "remains" of the background with them. + +- Fix for attenuation when using 2 or more volumetric objects: http://www.yafaray.org/node/332 + +- Fix for error message "Index out of bounds in pdf1D_t" when spotlights with falloff > 0.70 and photons were used: http://www.yafaray.org/node/681 + +- Fix for Alpha Premultiply broken in Blender exporter: http://www.yafaray.org/node/682 Now the "Premultiply Alpha" option is back in the Exporter, but only when Export to file or to xml is selected. Premultiply will now be forced to true when exporting into Blender. + + + +Yafaray-E v0.1.99-beta4c (2015-07-29) for Blender 2.75 RC: +---------------------------------------------------------- +Note: builds were not created for this version, as it was only used for limited-scale testing. However, the changes made in this version remain in newer Releases and builds. + +More info about the discussion and changes: http://www.yafaray.org/node/662 + +- Fix for issue where Final Gather uses non-IBL background in glass: http://www.yafaray.org/node/572 + +- Fix for white dots in Path Tracer integrator: http://www.yafaray.org/node/662 + +- Fix for bump mapping artifacts: http://www.yafaray.org/node/660 +WARNING: I've made significant changes to the bump mapping when using image textures, trying to improve it and get results more similar to Blender, but it could cause new issues so enough testing should be done to make sure bump/normal mapping still works correctly. + +- Improvements to the noise fireflies in Rough Glass: http://www.yafaray.org/node/663 + +- New parameter to enable/disable lights. In the XML, into each "light" section you can add: + or + +- Ability to control per-light shadow casting. In blender exporter this is in the new "advanced settings" at the very bottom of the light panel. In the xml file, you can add this to the "light" sections: + or + +- New per-material "visibility" enum parameter that can have the following values: + +'normal' (default): Normal - Normal visibility - visible casting shadows. +'no_shadows': No shadows - visible but not casting shadows. +'shadow_only': Shadows only - invisible but casting shadows. +'invisible': Invisible: totally invisible material. + +This new parameter is at the bottom of the material panel, in the new advanced settings. In XML it would be something like, in the material section, for example: + + + + + +Yafaray-E v0.1.99-beta4 (2015-06-20) for Blender 2.75 RC: +--------------------------------------------------------- + +- Changes to the blend material "component" material1,material2 handling: http://www.yafaray.org/node/546 + +In previous versions if you created or deleted materials in the .blend file, sometimes all the material components of the blend materials changed or dissapeared randomly. To avoid it, now the materials are referenced by name using strings. You cannot use dropdown menus anymore to select the blend submaterials, and you have to be careful now not to rename the materials used by "blend" materials. However, with the new system if you create or delete other materials it will not affect the blend material1,material2 assignments. + +Increased the level of detail in the YafaRay Log, so if there are any problems with missing components in blend materials it should be easy to spot and correct by reading the YafaRay Log. + +WARNING: this change breaks backwards compatibility. When opening a .blend created with an older version of YafaRay the blend material components will be "upgraded" to the new system, but the"blend" materials in a blend made with the new version could behave wrongly if you open it with an older version. + +- New advanced parameters for fine control of Shadow Bias/Min Ray Dist if the automatic calculation is not good enough. Please give us feedback about it in the forum: http://www.yafaray.org/community/forum/viewtopic.php?f=23&t=5084 + +- Fix for caustics noise coming from Non-IBL background in Photon Mapping. Now the background will only be used for Caustics if IBL is enabled and (if there is a caustics parameter available in the background settings) if caustics is enabled in the background. + +- Background "power" parameters relocated to places where they make more sense. They were hidden and only visible when IBL was enabled, but most of the times the power parameter affects the background rendering even if IBL is disabled. + + + +Yafaray-E v0.1.99-beta3 (2015-05-02) for Blender 2.74.5 (up to Blender builbots for 2015-05-02): +------------------------------------------------------------------------------------------------ +Blender made a change to their API in their development branch 2.74.4 to include MultiView. That change caused YafaRay to render black images despite being working fine. + +Very kindly Jens Verwiebe sent us the fix for Blender Exporter so YafaRay can work again with Blender 2.74.4. This fix is not a full integration in the new MultiView functionality, it just allows YafaRay to work again with Blender. + +More changes in this beta3 version: + +- Fix for -NAN results in the Bidirectional integrator when using Architectural, Angular and Ortho cameras. See: http://www.yafaray.org/node/538 + +- Fix for problem with Rough Glass too bright when dispersion is enabled. See: http://www.yafaray.org/node/642 + +- Extended Texture Mapping system, allowing using textures to map additional properties in materials, to be able to create either more realistic or more exotic materials and reduce the dependency on the "blend" material. More information in: http://www.yafaray.org/community/forum/viewtopic.php?f=22&t=5091 + +Important note: when using some of the new mappings, the renders may slow down. I'm not sure whether it's because of the additional calculations (very likely) or if it's something we can optimize further in the future. In any case, it should only be noticeable when using the new mappings, and I think it's worth the ability to create new materials now. + +The new texture mappings in addition to the existing ones are: + - Diffuse Reflection Amount in Shiny Diffuse, Glossy and Coated Glossy materials + - Sigma factor for Oren Nayar in Shiny Diffuse, Glossy and Coated Glossy materials + - Filter color in Glass and Rough Glass. + - IOR refractive factor in Glass and Rough Glass. The texture amounts are added to the IOR of the material. + - IOR refractive factor for the Fresnel in Shiny Diffuse and Coated Glossy materials. + - Roughness factor in Rough Glass material. + - Exponent factor in Glossy and Coated Glossy materials + - Mirror amount in Coated Glossy materials. + - Mirror Color in Coated Glossy Materials + +Also added a (non-texture) mirror amount slider in the Coated Glossy material + +Unfortunately due to Blender API limitations, in some of the new texture sliders, the "tooltip" information that appears when hovering the mouse over the slider, can be misleading and not represent the actual function of that slider. However, I took care in setting the description correctly so just by looking at the slider itself you can see what does it map. + + + +Yafaray-E v0.1.99-beta2 (2015-04-18) for Blender 2.74: +------------------------------------------------------- +- New Clay Material, with a small correction since the previous beta1 +- Fix for bad NaN normals that happened sometimes. +- Calculate automatically Shadow Bias and Minimum Ray Dist depending on the scene size. This is to avoid black artifacts when resizing the objects. However as it's a fundamental change that affects everything, perhaps some new artifacts could appear in the images now and further fine tuning needed in this new formula. Please give us feedback about it in the forum: +http://www.yafaray.org/community/forum/viewtopic.php?f=23&t=5084 + + + +Yafaray-E v0.1.99-beta1 (2015-04-11) for Blender 2.74: +------------------------------------------------------ +Based on the official stable YafaRay v0.1.5 git version + +- New Clay Material system, more powerful and flexible +- Texture mapping of Sigma factor in Shiny Diffuse/Oren Nayar +- Fix for Negated colors in Musgrave/Voronoi textures mapped to diffuse color. diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..66364dec --- /dev/null +++ b/INSTALL @@ -0,0 +1,21 @@ +To install YafaRay-E (Experimental) into Blender: + +Don't use the Blender from the distro repositories. Download the Blender official builds from: +https://www.blender.org/download/ + +Once Blender is installed, locate the folder where it was installed. The paths given below are just examples, but they will probably be different in your system. + +Copy this entire folder "yafaray" to (for example): + - in Linux 64bit, for example: "$HOME/blender-2.74-linux-glibc211-x86_64/2.74/scripts/addons" folder. + - in Windows 64bit, for example: "C:\Program Files\Blender Foundation\Blender\2.74\scripts\addons" folder. + +After it, start Blender, go to User Preferences, AddOns and try to enable Render:YafaRay. Once (hopefully) enabled you should see it in the list of renderers. + +* Important: the YafaRay-E Linux 32bit build requires a processor with SSE/SSE2 instructions. Any non-ancient processor should have them... + +If you have any issues: + +* Check that you have copied the "yafaray" folder into the correct Blender addons folder. +* Check that you have downloaded the appropiate YafaRay build for your Operating System and Blender build (32/64 bit) +* Check that you are using the official Blender build from www.blender.org and it's a version supported by YafaRay (see CHANGELOG) +* If you still have problems, please ask for help in the yafaRay.org forums or post a bug report in http://www.yafaray.org/development/bugtracker/yafaray diff --git a/README b/README index ee4b52fd..ec263232 100755 --- a/README +++ b/README @@ -1,67 +1,30 @@ -Yafaray 0.2.0-beta1 (2015-10-03) David Bluecame experimental exporter for Blender 2.76: -** THIS BUILD CONTAINS EXPERIMENTAL CHANGES AND FEATURES - DO NOT USE FOR PRODUCTION SCENES ** +DESCRIPTION +----------- +YafaRay is a free open-source montecarlo raytracing engine released under the LGPL 2.1 license. Raytracing is a rendering technique for generating realistic images by tracing the path of light through a 3D scene. -Unofficial build for XXXX (XX bits) by David Bluecame -* Important: the Linux 32bit build requires a processor with SSE/SSE2 instructions. Any non-ancient processor should have them * +For more information, see: http://www.yafaray.org -Based on YafaRay git version + pull requests from David Bluecame not yet in master for -FIXME: (PENDING TO UPDATE CHANGELOG!!!!!) - -- New Clay Material system, more flexible and powerful. More information in: http://www.yafaray.org/community/forum/viewtopic.php?f=16&t=5079 - -- Fix for problem with Rough Glass too bright when dispersion is enabled. See: http://www.yafaray.org/node/642 - -- Extended Texture Mapping system (very experimental!!), allowing using textures to map additional properties in materials, to be able to create either more realistic or more exotic materials and reduce the dependency on the "blend" material. More information in: http://www.yafaray.org/community/forum/viewtopic.php?f=22&t=5091 - -Important note: when using some of the new mappings, the renders may slow down. I'm not sure whether it's because of the additional calculations (very likely) or if it's something we can optimize further in the future. In any case, it should only be noticeable when using the new mappings, and I think it's worth the ability to create new materials now. - -The new texture mappings in addition to the existing ones are: - - Diffuse Reflection Amount in Shiny Diffuse, Glossy and Coated Glossy materials - - Sigma factor for Oren Nayar in Shiny Diffuse, Glossy and Coated Glossy materials - - Filter color in Glass and Rough Glass. - - IOR refractive factor in Glass and Rough Glass. The texture amounts are added to the IOR of the material. - - IOR refractive factor for the Fresnel in Shiny Diffuse and Coated Glossy materials. - - Roughness factor in Rough Glass material. - - Exponent factor in Glossy and Coated Glossy materials - - Mirror amount in Coated Glossy materials. - - Mirror Color in Coated Glossy Materials - - -I also added a (non-texture) mirror amount slider in the Coated Glossy material - -Unfortunately due to Blender API limitations, in some of the new texture sliders, the "tooltip" information that appears when hovering the mouse over the slider, can be misleading and not represent the actual function of that slider. However, I took care in setting the description correctly so just by looking at the slider itself you can see what does it map. - - -* Changes to the blend material "component" material1,material2 handling. In previous versions if you created or deleted materials in the .blend file, sometimes all the material components of the blend materials changed or dissapeared randomly. To avoid it, now the materials are referenced by name using strings. You cannot use dropdown menus anymore to select the blend submaterials, and you have to be careful now not to rename the materials used by "blend" materials. However, with the new system if you create or delete other materials it will not affect the blend material1,material2 assignments. - -Also, I've increased the level of detail in the YafaRay Log, so if there are any problems with missing components in blend materials it should be easy to spot and correct by reading the YafaRay Log. - -WARNING: this change breaks backwards compatibility. When opening a .blend created with an older version of YafaRay the blend material components will be "upgraded" to the new system, but the"blend" materials in a blend made with the new version could behave wrongly if you open it with an older version. - -* New advanced parameters for fine control of Shadow Bias/Min Ray Dist if the automatic calculation is not good enough. Please give us feedback about it in the forum: http://www.yafaray.org/community/forum/viewtopic.php?f=23&t=5084 - -* Fix for caustics noise coming from Non-IBL background in Photon Mapping. Now the background will only be used for Caustics if IBL is enabled and (if there is a caustics parameter available in the background settings) if caustics is enabled in the background. - -* Background "power" parameters relocated to places where they make more sense. They were hidden and only visible when IBL was enabled, but most of the times the power parameter affects the background rendering even if IBL is disabled. +YafaRay-E (Experimental) is an unofficial testing/unstable branch for fixes and new features, maintained by David Bluecame. Some of these fixes and features could be eventually accepted into the official/stable YafaRay, while others may end up rejected or implemented in a different way. +*WARNING*: YafaRay-E contains EXPERIMENTAL CHANGES AND FEATURES, so it's recommended not to use it for production scenes. This application is provided as is, and no guarantee is given that this code will preform in the desired way. +Please post bugreports and feature requests here: +http://www.yafaray.org/development/bugtracker/yafaray -To install YafaRay to blender: -* Don't use the Blender from the distro repositories. Download the Blender official Linux 64bit build from: http://ftp.halifax.rwth-aachen.de/blender/release/Blender2.74/blender-2.74-linux-glibc211-x86_64.tar.bz2 and uncompress it in a folder, for example in $HOME/ -* Copy this entire folder "yafaray" to: - - in Linux 64bit, for example: "$HOME/blender-2.74-linux-glibc211-x86_64/2.74/scripts/addons" folder. - - in Windows 64bit, for example: "C:\Program Files\Blender Foundation\Blender\2.74\scripts\addons" folder. -After it, start Blender, go to User Preferences, AddOns and try to enable Render:YafaRay. Once (hopefully) enabled you should see it in the list of renderers. +RELEASES +-------- -This application is provided as is, and no guarantee is given that this code will preform in the desired way. +YafaRay-E (Experimental) releases can be found here: +https://github.com/DavidBluecame/Blender-Exporter/releases -I hope this helps and you can start or continue to use this very nice and fast renderer! +YafaRay-E latest source code: +* Core code: https://github.com/DavidBluecame/Core +* Blender Exporter: https://github.com/DavidBluecame/Blender-Exporter -Best regards. David. +More information about the changes in each YafaRay-E version see the file CHANGELOG -**** For the official YafaRay latest exporter updates check: @@ -69,14 +32,12 @@ For the official YafaRay latest exporter updates check: https://github.com/YafaRay/Blender-Exporter and for the latest Yafaray builds (including exporter files too) -check for builds on graphicall.org: +check for builds here: -http://www.graphicall.org/yafaray +* http://www.yafaray.org/download +* http://www.graphicall.org/yafaray or look into this forum post for other platform builds: - -http://www.yafaray.org/community/forum/viewtopic.php?f=16&t=3520 - http://www.yafaray.org/community/forum/viewforum.php?f=12 Please post bugreports and feature requests here: diff --git a/__init__.py b/__init__.py index 763c9519..aeddb2b4 100755 --- a/__init__.py +++ b/__init__.py @@ -35,7 +35,7 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": ('experimental', 0, 2, 0, 'beta1'), + "version": ('Experimental', 1, 0, 0), "blender": (2, 7, 6), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", From 22fd3b4f4028f30cd75f7a40c66fd0b53402b1ca Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Tue, 13 Oct 2015 21:19:22 +0100 Subject: [PATCH 32/81] Adding another entry to the ChangeLog --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 14e11202..f9beff76 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -57,6 +57,9 @@ Now, if there are no parameters set in the XML for transparent background or tra - Fix for Alpha Premultiply broken in Blender exporter: http://www.yafaray.org/node/682 Now the "Premultiply Alpha" option is back in the Exporter, but only when Export to file or to xml is selected. Premultiply will now be forced to true when exporting into Blender. +- Fix for some YafaRay camera panels incorrectly appearing in LuxRender! http://www.luxrender.net/forum/viewtopic.php?f=16&t=12405&sid=14e5a712bb33cbdee95c65fb1920ad38&start=20 +https://github.com/DavidBluecame/Blender-Exporter/commit/70138b7ec2c2aa3f94d3c820babc10d12af6f943 + Yafaray-E v0.1.99-beta4c (2015-07-29) for Blender 2.75 RC: From 3851094c6227d87b04675af9eba702a664df398d Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Tue, 13 Oct 2015 22:13:19 +0100 Subject: [PATCH 33/81] Fix for error I introduced during Color Pipeline changes --- ui/properties_yaf_render.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/properties_yaf_render.py b/ui/properties_yaf_render.py index 8f656805..710eb2fe 100644 --- a/ui/properties_yaf_render.py +++ b/ui/properties_yaf_render.py @@ -146,7 +146,7 @@ def draw(self, context): if sc.display_settings.display_device == "None": col = split.column() - col.prop(scene, "gs_gamma", text = "Gamma") + col.prop(sc, "gs_gamma", text = "Gamma") if sc.display_settings.display_device == "sRGB": pass From 323271ec44f5d527fae06fba54da8fa288d5c2b6 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sun, 25 Oct 2015 08:19:42 +0000 Subject: [PATCH 34/81] Improved automatic multi-platform detection/library loading --- __init__.py | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/__init__.py b/__init__.py index aeddb2b4..08734e3e 100755 --- a/__init__.py +++ b/__init__.py @@ -46,19 +46,34 @@ # Preload needed libraries # Loading order of the dlls is sensible please do not alter it if sys.platform == 'win32': - for file in os.listdir(BIN_PATH): - # load dll's from a MSVC installation - if file in {'yafaraycore.dll'}: - dllArray = ['zlib1', 'iconv', 'zlib', 'libpng15', 'libxml2', 'yafaraycore', 'yafarayplugin'] - break - # load dll's from a MinGW installation - else: - dllArray = ['libwinpthread-1', 'libgcc_s_sjlj-1', 'libstdc++-6', 'iconv', 'zlib1', 'libxml2-2', 'libHalf-11', 'libIex-2_1-11', 'libIlmThread-2_1-11', 'libIlmImf-Imf_2_1-21', 'libjpeg-62', 'libpng16-16', 'libtiff-5', 'libbz2-1', 'libfreetype-6', 'libyafaraycore', 'libyafarayplugin'] + if sys.maxsize == 2**63 - 1: # Windows 64bit system + for file in os.listdir(BIN_PATH): + # load dll's from a MSVC installation + if file in {'yafaraycore.dll'}: + dllArray = ['zlib1', 'iconv', 'zlib', 'libpng15', 'libxml2', 'yafaraycore', 'yafarayplugin'] + break + # load dll's from a MinGW64 installation + else: + dllArray = ['libwinpthread-1', 'libgcc_s_seh-1', 'libstdc++-6', 'libiconv-2', 'libzlib1', 'libxml2-2', 'libHalf', 'libIex', 'libImath', 'libIlmThread', 'libIlmImf', 'libjpeg-8', 'libpng16', 'libtiff-5', 'libbz2-1', 'libfreetype-6', 'libyafaraycore', 'libyafarayplugin'] + + else: # Windows 32bit system + for file in os.listdir(BIN_PATH): + # load dll's from a MSVC installation + if file in {'yafaraycore.dll'}: + dllArray = ['zlib1', 'iconv', 'zlib', 'libpng15', 'libxml2', 'yafaraycore', 'yafarayplugin'] + break + # load dll's from a MinGW32 installation + else: + dllArray = ['libwinpthread-1', 'libgcc_s_sjlj-1', 'libstdc++-6', 'libiconv-2', 'libzlib1', 'libxml2-2', 'libHalf', 'libIex', 'libImath', 'libIlmThread', 'libIlmImf', 'libjpeg-8', 'libpng16', 'libtiff-5', 'libbz2-1', 'libfreetype-6', 'libyafaraycore', 'libyafarayplugin'] elif sys.platform == 'darwin': dllArray = ['libyafaraycore.dylib', 'libyafarayplugin.dylib'] else: - dllArray = ['libHalf.so.6.0.0', 'libIex.so.6.0.0', 'libImath.so.6.0.0', 'libIlmThread.so.6.0.0', 'libIlmImf.so.6.0.0', 'libpython3.4m.so.1.0', 'libjpeg.so.62.0.0', 'libz.so.1.2.3.4', 'libpng12.so.0.44.0', 'libtiff.so.4.3.3', 'libfreetype.so.6.6.0', 'libyafaraycore.so', 'libyafarayplugin.so'] + if sys.maxsize == 2**63 - 1: # Linux 64bit system + dllArray = ['libHalf.so.6.0.0', 'libIex.so.6.0.0', 'libImath.so.6.0.0', 'libIlmThread.so.6.0.0', 'libIlmImf.so.6.0.0', 'libpython3.4m.so.1.0', 'libjpeg.so.62.0.0', 'libz.so.1.2.3.4', 'libpng12.so.0.44.0', 'libtiff.so.4.3.3', 'libfreetype.so.6.6.0', 'libyafaraycore.so', 'libyafarayplugin.so'] + + else: # Linux 32bit system + dllArray = ['libHalf.so.6.0.0', 'libIex.so.6.0.0', 'libImath.so.6.0.0', 'libIlmThread.so.6.0.0', 'libIlmImf.so.6.0.0', 'libpython3.4m.so.1.0', 'libjpeg.so.62.0.0', 'libz.so.1.2.3.4', 'libpng12.so.0.44.0', 'libtiff.so.4.3.3', 'libfreetype.so.6.6.0', 'libyafaraycore.so', 'libyafarayplugin.so'] for dll in dllArray: try: From 841d54c65a80fe5a91c7e45a21113707650e6947 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Thu, 29 Oct 2015 03:46:35 +0000 Subject: [PATCH 35/81] New "Receive Shadows" functionality As requested in the bugtracker http://yafaray.org/node/687 I've added a new per-material parameter "receive_shadows" so the user can select whether a material is to receive shadows from other objects or not. This parameter can be combined with the already existing material "visibility" parameter. Changes to be committed: modified: io/yaf_material.py modified: prop/yaf_material.py modified: ui/properties_yaf_material.py --- io/yaf_material.py | 4 ++++ prop/yaf_material.py | 6 ++++++ ui/properties_yaf_material.py | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/io/yaf_material.py b/io/yaf_material.py index a7383a07..2eb38947 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -236,6 +236,7 @@ def writeGlassShader(self, mat, scene, rough): yi.paramsSetFloat("dispersion_power", mat.dispersion_power) yi.paramsSetBool("fake_shadows", mat.fake_shadows) yi.paramsSetString("visibility", mat.visibility) + yi.paramsSetBool("receive_shadows", mat.receive_shadows) mcolRoot = '' # fcolRoot = '' /* UNUSED */ @@ -316,6 +317,7 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c yi.paramsSetFloat("exp_v", mat.exp_v) yi.paramsSetFloat("specular_reflect", bSpecr) yi.paramsSetString("visibility", mat.visibility) + yi.paramsSetBool("receive_shadows", mat.receive_shadows) diffRoot = '' # mcolRoot = '' /* UNUSED */ @@ -548,6 +550,7 @@ def writeShinyDiffuseShader(self, mat, scene): yi.paramsSetBool("fresnel_effect", mat.fresnel_effect) yi.paramsSetFloat("IOR", mat.IOR_reflection) # added IOR for reflection yi.paramsSetString("visibility", mat.visibility) + yi.paramsSetBool("receive_shadows", mat.receive_shadows) if scene.gs_clay_render and not mat.clay_exclude: if scene.gs_clay_oren_nayar: @@ -598,6 +601,7 @@ def writeBlendShader(self, mat, scene): yi.paramsSetFloat("blend_value", mat.blend_value) yi.paramsSetString("visibility", mat.visibility) + yi.paramsSetBool("receive_shadows", mat.receive_shadows) return yi.createMaterial(self.namehash(mat)) diff --git a/prop/yaf_material.py b/prop/yaf_material.py index 158482a7..502d100e 100644 --- a/prop/yaf_material.py +++ b/prop/yaf_material.py @@ -299,6 +299,11 @@ def register(): ), default='normal') + + Material.receive_shadows = BoolProperty( + name="Receive Shadows", + description="If this parameter is set to false, the material will not receive shadows from other objects", + default=True) def unregister(): del Material.mat_type @@ -336,3 +341,4 @@ def unregister(): del Material.material1name del Material.material2name del Material.visibility + del Material.receive_shadows diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index f8301ca9..6f38a316 100755 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -357,6 +357,10 @@ def draw(self, context): col = split.column() layout.row().prop(yaf_mat, "visibility") + split = layout.split() + col = split.column() + layout.row().prop(yaf_mat, "receive_shadows") + if __name__ == "__main__": # only for live edit. import bpy From cf789b40b02e4f4233fc054c7b852b17ef29c0ad Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Thu, 29 Oct 2015 06:10:59 +0000 Subject: [PATCH 36/81] Blend materials can be selected with drop-down menus Changes to be able to select the blend materials using drop down menus, in a similar way as it was done in the past with the old (buggy) "enum" parameters. This solution combines the reliability of using string parameters to select the blend material components with the ease of use of the dropdown menus for material selection. These changes have been adapted from povmaniaco's The Bounty renderer. Thanks, povmaniaco! :-) Changes to be committed: modified: ui/properties_yaf_material.py --- ui/properties_yaf_material.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index 6f38a316..14863ed2 100755 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -28,6 +28,22 @@ MaterialButtonsPanel.COMPAT_ENGINES = {'YAFA_RENDER'} +def blend_one_draw(layout, mat): + try: + layout.prop_search(mat, "material1name", bpy.data, "materials") + except: + return False + + return True + +def blend_two_draw(layout, mat): + try: + layout.prop_search(mat, "material2name", bpy.data, "materials") + except: + return False + return True + + class MaterialTypePanel(MaterialButtonsPanel): COMPAT_ENGINES = {'YAFA_RENDER'} @@ -335,14 +351,8 @@ def draw(self, context): #col.label(text="Material two:") #col.prop(yaf_mat, "material2", text="") - split = box.split() - col = split.column() - col.label(text="Material one:") - col.prop(yaf_mat, "material1name", text="") - - col = split.column() - col.label(text="Material two:") - col.prop(yaf_mat, "material2name", text="") + blend_one_draw(layout, yaf_mat) + blend_two_draw(layout, yaf_mat) class YAF_PT_advanced(MaterialButtonsPanel, Panel): From c154886dec18ec149f8597004090c4a65c9b6c46 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 6 Nov 2015 04:27:34 +0000 Subject: [PATCH 37/81] Version and changelog changes for release modified: CHANGELOG modified: __init__.py --- CHANGELOG | 16 ++++++++++++++++ __init__.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index f9beff76..0912d969 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,22 @@ Note: this CHANGELOG file only shows the YafaRay-E releases and changes, not the For more information about releases and changes see: https://github.com/DavidBluecame/Blender-Exporter/releases +Yafaray-E v1.1.0 (2015-11-06) for Blender 2.76: +----------------------------------------------- +- Changes to the Core code and build files to enable building for Mac OSX 64bit (v10.6 or higher), based on the excellent work from Jens Verwiebe. Thank you very much, Jens!! + +- Added a new "Resampled Floor" parameter to the Adaptative AA calculations, to increase the noise reduction performance. The idea is that if the amount of resampled pixels go below that "floor" value during a certain pass, the AA threshold is automatically decreased in 10% for the next pass. More information: http://yafaray.org/node/690 + +- Blend materials can now be selected using drop down menus. This feature has been ported from povmaniaco's The Bounty fork of YafaRay. Thanks, povmaniaco!! + +- Added a new texture sampling parameter in Blender Exporter to control the type of interpolation in the image texture. Options will be: bilinear (default), bicubic or none. See: http://www.yafaray.org/community/forum/viewtopic.php?f=22&t=5121 + +- Added a per-material parameter to control reception of shadows. Now it's possible to select if a material should receive shadows from other objects (as default) or not. See: http://yafaray.org/node/687 + +- Minor changes for existing material visibility feature to improve (just a tiny bit) performance. + + + Yafaray-E v1.0.0 (2015-10-13) for Blender 2.76: ----------------------------------------------- Note: from v1.0.0 I will no longer use the suffix "beta", as all YafaRay-Experimental versions are inherently betas ;-). I will use for version scheme: "Major.Minor.Bugfix". Major will be very important and structural changes with possible API breakage, Minor will be new and modified functionality without API breakage, Bugfix will be small changes and bugfixes. diff --git a/__init__.py b/__init__.py index 08734e3e..7d767a8c 100755 --- a/__init__.py +++ b/__init__.py @@ -35,7 +35,7 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": ('Experimental', 1, 0, 0), + "version": ('Experimental', 1, 1, 0), "blender": (2, 7, 6), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", From a406a3382a70af657b986044254f3c4b3d7f9b20 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Tue, 10 Nov 2015 23:09:20 +0000 Subject: [PATCH 38/81] Material preview fix - extending to new material params in Experimental Adding the same fix as in the previous commits also for the new material params that were added to the Experimental YafaRay branch --- prop/yaf_material.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/prop/yaf_material.py b/prop/yaf_material.py index 3306f602..ec2d3907 100644 --- a/prop/yaf_material.py +++ b/prop/yaf_material.py @@ -240,7 +240,7 @@ def register(): default=False) Material.clay_exclude = BoolProperty( - name="Exclude from Clay render", + update=update_preview, name="Exclude from Clay render", description="Exclude from Clay render mode: this material will be rendered normally even in Clay render mode", default=False) @@ -283,17 +283,17 @@ def register(): #New blend material component String references, when opening old scenes it should copy the old Enum Property materials to the new String Properties Material.material1name = StringProperty( - name="Material one", + update=update_preview, name="Material one", description="First blend material") #, get=get_blend_mat1_old_scenes) Material.material2name = StringProperty( - name="Material two", + update=update_preview, name="Material two", description="Second blend material") #, get=get_blend_mat2_old_scenes) Material.visibility = EnumProperty( - name="Visibility", + update=update_preview, name="Visibility", items=( ('invisible', "Invisible", "Totally invisible"), ('shadow_only', "Shadows only", "Invisible but casting shadows"), @@ -304,7 +304,7 @@ def register(): default='normal') Material.receive_shadows = BoolProperty( - name="Receive Shadows", + update=update_preview, name="Receive Shadows", description="If this parameter is set to false, the material will not receive shadows from other objects", default=True) From 9183932af4472abd1c903eb0dd6a87f1f26339d8 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Wed, 18 Nov 2015 05:53:24 +0000 Subject: [PATCH 39/81] Advanced noise detection and control parameters After a request from samo I have been experimenting new ways of detecting and controlling noise in YafaRay, as well as new ways of doing the progressive AA passes. All the new options are in the AntiAliasing panel: * Clamp samples: it clamps the RGB value for all the samples to the maximum value set in this parameter. Value 0 disables the clamping. I made a new clamp function that does not just clamp the RGB values. To preserve color information as much as possible, I'm clamping the maximum of the RGB values and proportionally scale the rest. * Clamp indirect: it clamps only indirect light such as Final Gather or Caustics. If more than 1 pass is selected, you will also have the next new/modified parameters: * Resampled floor is now in % of the total pixels, so you don't need to calculate how many pixels you want to keep resampling as a minimum. This function allows you to set a certain AA threshold as usual, but if the amount of resampled pixels go below the Resampled Floor value, the AA threshold will automatically decrease before the next AA pass. This should help reducing noise in progressive AA. * Color noise detection: if not checked, noise and edges are detected as before (by comparing brightness between a pixel and its neighbours). If checker, it will also compare the individual color RGB components. Checking it will be equivalent to lower the AA threshold a bit, and it will also be more sensitive to noise caused by pixels with similar brightness but different hue. * Dark areas noise detection factor [0.0 - 0.8]. If this factor is 0.0, noise detection will work as usual. If you make it bigger (up to 0.8) it will lower the AA threshold for the darker pixels proportionally to the pixel brightness. This should allow to reduce noise better in dark areas, but it will take more time to reduce the noise in bright areas. Variance: I've added a new experimental way of detecting noise by creating a window around each pixel, and evaluating how much color variance there is in that window. If there are more variancing pixels than a certain variance pixels amout, the entire window is marked for resampling for the next AA pass. You could setup this feature by setting: * Variance Window: size of the edge of the variance detection window * Variance pixels: amount of pixels with color variance that trigger the resampling of the entire variance window for the next pass. If set to "0" the variance function would be disabled. Honestly I don't know if this will be too efficient for now, but perhaps it can be improved for the future... Multipliers: I've added three sample multipliers, one for the AA samples, another for Lights and another for indirect samples (like FG). The idea is that every AA pass will be done as follows: - Effective AA Samples = AA samples set in the AA window * internal AA multiplier - Effective Lights Samples = samples set in the Light definition * internal Light multiplier - Effective Indirect Samples = samples set in the Final Gather for example * internal Internal multiplier We cannot control directly the value of these multipliers, but we can set how do we want them to evolve from one AA pass to the next. For example if we setup: - AA Sample multiplier factor = 2.0. This will cause the multiplier to grow exponentially as: PASS 1: AA multiplier = 1.0 PASS 2: AA multiplier = 2.0 PASS 3: AA multiplier = 4.0 PASS 4: AA multiplier = 8.0 etc This would allow us to increase the number of samples automatically from one pass to the next, even exponentially (something that samo mentioned to me he would like to experiment with). I've limited those multiplier factors to be in the range: 1.0 (multiplier does not change, normal behavior) to 2.0 (exponential). I didn't allow more than 2.0 because it would grow too quickly. I would try values around 1.01, 1.1, etc. They would allow a progressive increase of the samples but not too quickly... --- io/yaf_scene.py | 11 ++++- prop/yaf_scene.py | 79 ++++++++++++++++++++++++++++---- ui/properties_yaf_AA_settings.py | 33 +++++++++++-- 3 files changed, 111 insertions(+), 12 deletions(-) diff --git a/io/yaf_scene.py b/io/yaf_scene.py index b5bbac8a..28371529 100755 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -79,7 +79,16 @@ def exportAA(yi, scene): yi.paramsSetFloat("AA_pixelwidth", scene.AA_pixelwidth) yi.paramsSetFloat("AA_threshold", scene.AA_threshold) yi.paramsSetString("filter_type", scene.AA_filter_type) - yi.paramsSetInt("AA_resampled_floor", scene.AA_resampled_floor) + yi.paramsSetFloat("AA_resampled_floor", scene.AA_resampled_floor) + yi.paramsSetFloat("AA_sample_multiplier_factor", scene.AA_sample_multiplier_factor) + yi.paramsSetFloat("AA_light_sample_multiplier_factor", scene.AA_light_sample_multiplier_factor) + yi.paramsSetFloat("AA_indirect_sample_multiplier_factor", scene.AA_indirect_sample_multiplier_factor) + yi.paramsSetBool("AA_detect_color_noise", scene.AA_detect_color_noise) + yi.paramsSetFloat("AA_dark_threshold_factor", scene.AA_dark_threshold_factor) + yi.paramsSetInt("AA_variance_edge_size", scene.AA_variance_edge_size) + yi.paramsSetInt("AA_variance_pixels", scene.AA_variance_pixels) + yi.paramsSetFloat("AA_clamp_samples", scene.AA_clamp_samples) + yi.paramsSetFloat("AA_clamp_indirect", scene.AA_clamp_indirect) def exportRenderSettings(yi, scene): diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 7e17cf52..c7195d27 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -399,7 +399,7 @@ def register(): min=0.0, default=1.0) - ######### YafaRays anti-aliasing properties ########### + ######### YafaRays anti-aliasing/noise properties ########### Scene.AA_min_samples = IntProperty( name="Samples", description="Number of samples for first AA pass", @@ -425,13 +425,6 @@ def register(): min=0.0, max=1.0, precision=4, default=0.05) - Scene.AA_resampled_floor = IntProperty( - name="Resampled floor", - description=("For better noise reduction, if the amount of resampled pixels go below this value," - " the AA threshold will automatically decrease before the next pass"), - min=0, - default=0) - Scene.AA_pixelwidth = FloatProperty( name="Pixelwidth", description="AA filter size", @@ -448,6 +441,67 @@ def register(): ), default="gauss") + Scene.AA_resampled_floor = FloatProperty( + name="Resampled floor (%)", + description=("Noise reduction: when resampled pixels go below this value (% of total pixels)," + " the AA threshold will automatically decrease before the next pass"), + min=0.0, max=100.0, precision=1, + default=0.0) + + Scene.AA_sample_multiplier_factor = FloatProperty( + name="AA sample multiplier factor", + description="Factor to increase the AA samples multiplier for next AA pass.", + min=1.0, max=2.0, precision=2, + default=1.0) + + Scene.AA_light_sample_multiplier_factor = FloatProperty( + name="Light sample multiplier factor", + description="Factor to increase the light samples multiplier for next AA pass.", + min=1.0, max=2.0, precision=2, + default=1.0) + + Scene.AA_indirect_sample_multiplier_factor = FloatProperty( + name="Indirect sample multiplier factor", + description="Factor to increase the indirect samples (FG for example) multiplier for next AA pass.", + min=1.0, max=2.0, precision=2, + default=1.0) + + Scene.AA_detect_color_noise = BoolProperty( + name="Color noise detection", + description="Detect noise in RGB components in addidion to pixel brightness", + default=False) + + Scene.AA_dark_threshold_factor = FloatProperty( + name="Dark areas noise detection factor", + description=("Factor used to reduce the AA threshold in dark areas." + " It will reduce noise in dark areas, but noise in bright areas will take longer."), + min=0.0, max=0.8, precision=2, + default=0.0) + + Scene.AA_variance_edge_size = IntProperty( + name="Variance window", + description="Window edge size for variance noise detection.", + min=4, max=20, + default=10) + + Scene.AA_variance_pixels = IntProperty( + name="Variance threshold", + description="Threshold (in pixels) for variance noise detection. 0 disables variance detection", + min=0, max=10, + default=0) + + Scene.AA_clamp_samples = FloatProperty( + name="Clamp samples", + description="Clamp RGB values in all samples, less noise but less realism. 0.0 disables clamping.", + min=0.0, precision=1, + default=0.0) + + Scene.AA_clamp_indirect = FloatProperty( + name="Clamp indirect", + description="Clamp RGB values in the indirect light, less noise but less realism. 0.0 disables clamping.", + min=0.0, precision=1, + default=0.0) + def unregister(): Scene.gs_ray_depth @@ -518,3 +572,12 @@ def unregister(): Scene.AA_pixelwidth Scene.AA_filter_type Scene.AA_resampled_floor + Scene.AA_sample_multiplier_factor + Scene.AA_light_sample_multiplier_factor + Scene.AA_indirect_sample_multiplier_factor + Scene.AA_detect_color_noise + Scene.AA_dark_threshold_factor + Scene.AA_variance_edge_size + Scene.AA_variance_pixels + Scene.AA_clamp_samples + Scene.AA_clamp_indirect diff --git a/ui/properties_yaf_AA_settings.py b/ui/properties_yaf_AA_settings.py index 250dd9a7..04507fb9 100644 --- a/ui/properties_yaf_AA_settings.py +++ b/ui/properties_yaf_AA_settings.py @@ -26,13 +26,19 @@ class YAF_PT_AA_settings(RenderButtonsPanel, Panel): - bl_label = "Anti-Aliasing" + bl_label = "Anti-Aliasing / Noise control" def draw(self, context): scene = context.scene layout = self.layout + split = layout.split() + col = split.column() + col.prop(scene, "AA_clamp_samples") + col = split.column() + col.prop(scene, "AA_clamp_indirect") + split = layout.split() col = split.column() col.prop(scene, "AA_filter_type") @@ -50,9 +56,30 @@ def draw(self, context): spp.prop(scene, "AA_passes") sub.prop(scene, "AA_inc_samples") sub.prop(scene, "AA_threshold") - if scene.intg_light_method != "SPPM": - sub.prop(scene, "AA_resampled_floor") + row = layout.row() + row.enabled = False + + if scene.AA_passes > 1 and scene.intg_light_method != "SPPM": + row.enabled = True + + row.prop(scene, "AA_detect_color_noise") + + row = layout.row() + row.enabled = False + + if scene.AA_passes > 1 and scene.intg_light_method != "SPPM": + row.enabled = True + + col = row.column() + col.prop(scene, "AA_dark_threshold_factor") + col.prop(scene, "AA_sample_multiplier_factor") + col.prop(scene, "AA_light_sample_multiplier_factor") + col.prop(scene, "AA_indirect_sample_multiplier_factor") + col = row.column() + col.prop(scene, "AA_resampled_floor") + col.prop(scene, "AA_variance_edge_size") + col.prop(scene, "AA_variance_pixels") if __name__ == "__main__": # only for live edit. import bpy From 7067cfe309c2f464a56185168b6b74a0c26ec4bc Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 21 Nov 2015 06:54:30 +0000 Subject: [PATCH 40/81] Added original AO sampling to AO render pass Renamed "clay" AO to "clay-ao", so now "ao" will be colored, and "clay-ao" grayscale with all materials clay --- prop/yaf_scene.py | 1 + 1 file changed, 1 insertion(+) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 426a1b73..e8e17ebc 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -536,6 +536,7 @@ def register(): renderPassItemsAO=sorted(( ('ao', "AO", "Ambient Occlusion", "", 501), + ('ao-clay', "AO clay", "Ambient Occlusion (clay)", "", 502), ), key=lambda index: index[1]) renderPassItemsLightGroup=sorted(( From cfd1eb71e768d9bcd39546c6cd0e30ed06a93bd9 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 21 Nov 2015 06:59:34 +0000 Subject: [PATCH 41/81] Removed old clamp function, replaced by new sample-level proportional flexible clamping --- io/yaf_scene.py | 1 - prop/yaf_scene.py | 6 ------ ui/properties_yaf_general_settings.py | 1 - 3 files changed, 8 deletions(-) diff --git a/io/yaf_scene.py b/io/yaf_scene.py index c906d4db..0d619654 100755 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -147,7 +147,6 @@ def exportRenderSettings(yi, scene): yi.paramsSetInt("width", sizeX) yi.paramsSetInt("height", sizeY) - yi.paramsSetBool("clamp_rgb", scene.gs_clamp_rgb) yi.paramsSetBool("show_sam_pix", scene.gs_show_sam_pix) if scene.gs_type_render == "file" or scene.gs_type_render == "xml": diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index e8e17ebc..e4b1b3be 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -178,11 +178,6 @@ def register(): description="Compute transparent shadows", default=False) - Scene.gs_clamp_rgb = BoolProperty( - name="Clamp RGB", - description="Reduce the color's brightness to a low dynamic range", - default=False) - Scene.gs_show_sam_pix = BoolProperty( name="Show sample pixels", description="Masks pixels marked for resampling during adaptive passes", @@ -869,7 +864,6 @@ def unregister(): Scene.gs_custom_string Scene.gs_premult Scene.gs_transp_shad - Scene.gs_clamp_rgb Scene.gs_show_sam_pix Scene.gs_verbose Scene.gs_type_render diff --git a/ui/properties_yaf_general_settings.py b/ui/properties_yaf_general_settings.py index e599da74..126bb5e4 100755 --- a/ui/properties_yaf_general_settings.py +++ b/ui/properties_yaf_general_settings.py @@ -77,7 +77,6 @@ def draw(self, context): col = split.column() col.prop(scene, "gs_transp_shad", toggle=True) col.prop(scene, "gs_draw_params", toggle=True) - col.prop(scene, "gs_clamp_rgb", toggle=True) col = split.column() col.prop(scene, "gs_auto_threads", toggle=True) From b0cbdc7282b98ebf2155201b29824664d7339dbe Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 28 Nov 2015 10:22:49 +0000 Subject: [PATCH 42/81] Grouping new passes and noise parameters Grouping the passes and new noise parameters to avoid cluttering the Scene property datablocks Changes to be committed: modified: io/yaf_scene.py modified: prop/yaf_scene.py modified: ui/properties_yaf_AA_settings.py modified: ui/properties_yaf_layer_passes.py --- io/yaf_scene.py | 146 +-- prop/yaf_scene.py | 1429 ++++++++++++++--------------- ui/properties_yaf_AA_settings.py | 20 +- ui/properties_yaf_layer_passes.py | 74 +- 4 files changed, 822 insertions(+), 847 deletions(-) diff --git a/io/yaf_scene.py b/io/yaf_scene.py index 0d619654..6472dd8e 100755 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -79,16 +79,16 @@ def exportAA(yi, scene): yi.paramsSetFloat("AA_pixelwidth", scene.AA_pixelwidth) yi.paramsSetFloat("AA_threshold", scene.AA_threshold) yi.paramsSetString("filter_type", scene.AA_filter_type) - yi.paramsSetFloat("AA_resampled_floor", scene.AA_resampled_floor) - yi.paramsSetFloat("AA_sample_multiplier_factor", scene.AA_sample_multiplier_factor) - yi.paramsSetFloat("AA_light_sample_multiplier_factor", scene.AA_light_sample_multiplier_factor) - yi.paramsSetFloat("AA_indirect_sample_multiplier_factor", scene.AA_indirect_sample_multiplier_factor) - yi.paramsSetBool("AA_detect_color_noise", scene.AA_detect_color_noise) - yi.paramsSetFloat("AA_dark_threshold_factor", scene.AA_dark_threshold_factor) - yi.paramsSetInt("AA_variance_edge_size", scene.AA_variance_edge_size) - yi.paramsSetInt("AA_variance_pixels", scene.AA_variance_pixels) - yi.paramsSetFloat("AA_clamp_samples", scene.AA_clamp_samples) - yi.paramsSetFloat("AA_clamp_indirect", scene.AA_clamp_indirect) + yi.paramsSetFloat("AA_resampled_floor", scene.yafaray.noise_control.resampled_floor) + yi.paramsSetFloat("AA_sample_multiplier_factor", scene.yafaray.noise_control.sample_multiplier_factor) + yi.paramsSetFloat("AA_light_sample_multiplier_factor", scene.yafaray.noise_control.light_sample_multiplier_factor) + yi.paramsSetFloat("AA_indirect_sample_multiplier_factor", scene.yafaray.noise_control.indirect_sample_multiplier_factor) + yi.paramsSetBool("AA_detect_color_noise", scene.yafaray.noise_control.detect_color_noise) + yi.paramsSetFloat("AA_dark_threshold_factor", scene.yafaray.noise_control.dark_threshold_factor) + yi.paramsSetInt("AA_variance_edge_size", scene.yafaray.noise_control.variance_edge_size) + yi.paramsSetInt("AA_variance_pixels", scene.yafaray.noise_control.variance_pixels) + yi.paramsSetFloat("AA_clamp_samples", scene.yafaray.noise_control.clamp_samples) + yi.paramsSetFloat("AA_clamp_indirect", scene.yafaray.noise_control.clamp_indirect) def exportRenderSettings(yi, scene): @@ -172,155 +172,155 @@ def exportRenderSettings(yi, scene): yi.paramsSetBool("adv_auto_min_raydist_enabled", scene.adv_auto_min_raydist_enabled) yi.paramsSetFloat("adv_min_raydist_value", scene.adv_min_raydist_value) - yi.paramsSetBool("pass_enable", scene.pass_enable) + yi.paramsSetBool("pass_enable", scene.yafaray.passes.pass_enable) - yi.paramsSetInt("pass_mask_obj_index", scene.pass_mask_obj_index) - yi.paramsSetInt("pass_mask_mat_index", scene.pass_mask_mat_index) - yi.paramsSetBool("pass_mask_invert", scene.pass_mask_invert) - yi.paramsSetBool("pass_mask_only", scene.pass_mask_only) + yi.paramsSetInt("pass_mask_obj_index", scene.yafaray.passes.pass_mask_obj_index) + yi.paramsSetInt("pass_mask_mat_index", scene.yafaray.passes.pass_mask_mat_index) + yi.paramsSetBool("pass_mask_invert", scene.yafaray.passes.pass_mask_invert) + yi.paramsSetBool("pass_mask_only", scene.yafaray.passes.pass_mask_only) - if scene.pass_enable and scene.render.layers[0].use_pass_z: - yi.paramsSetString("pass_Depth", scene.pass_Depth) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_z: + yi.paramsSetString("pass_Depth", scene.yafaray.passes.pass_Depth) else: yi.paramsSetString("pass_Depth", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_vector: - yi.paramsSetString("pass_Vector", scene.pass_Vector) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_vector: + yi.paramsSetString("pass_Vector", scene.yafaray.passes.pass_Vector) else: yi.paramsSetString("pass_Vector", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_normal: - yi.paramsSetString("pass_Normal", scene.pass_Normal) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_normal: + yi.paramsSetString("pass_Normal", scene.yafaray.passes.pass_Normal) else: yi.paramsSetString("pass_Normal", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_uv: - yi.paramsSetString("pass_UV", scene.pass_UV) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_uv: + yi.paramsSetString("pass_UV", scene.yafaray.passes.pass_UV) else: yi.paramsSetString("pass_UV", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_color: - yi.paramsSetString("pass_Color", scene.pass_Color) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_color: + yi.paramsSetString("pass_Color", scene.yafaray.passes.pass_Color) else: yi.paramsSetString("pass_Color", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_emit: - yi.paramsSetString("pass_Emit", scene.pass_Emit) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_emit: + yi.paramsSetString("pass_Emit", scene.yafaray.passes.pass_Emit) else: yi.paramsSetString("pass_Emit", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_mist: - yi.paramsSetString("pass_Mist", scene.pass_Mist) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_mist: + yi.paramsSetString("pass_Mist", scene.yafaray.passes.pass_Mist) else: yi.paramsSetString("pass_Mist", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_diffuse: - yi.paramsSetString("pass_Diffuse", scene.pass_Diffuse) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_diffuse: + yi.paramsSetString("pass_Diffuse", scene.yafaray.passes.pass_Diffuse) else: yi.paramsSetString("pass_Diffuse", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_specular: - yi.paramsSetString("pass_Spec", scene.pass_Spec) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_specular: + yi.paramsSetString("pass_Spec", scene.yafaray.passes.pass_Spec) else: yi.paramsSetString("pass_Spec", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_ambient_occlusion: - yi.paramsSetString("pass_AO", scene.pass_AO) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_ambient_occlusion: + yi.paramsSetString("pass_AO", scene.yafaray.passes.pass_AO) else: yi.paramsSetString("pass_AO", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_environment: - yi.paramsSetString("pass_Env", scene.pass_Env) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_environment: + yi.paramsSetString("pass_Env", scene.yafaray.passes.pass_Env) else: yi.paramsSetString("pass_Env", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_indirect: - yi.paramsSetString("pass_Indirect", scene.pass_Indirect) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_indirect: + yi.paramsSetString("pass_Indirect", scene.yafaray.passes.pass_Indirect) else: yi.paramsSetString("pass_Indirect", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_shadow: - yi.paramsSetString("pass_Shadow", scene.pass_Shadow) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_shadow: + yi.paramsSetString("pass_Shadow", scene.yafaray.passes.pass_Shadow) else: yi.paramsSetString("pass_Shadow", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_reflection: - yi.paramsSetString("pass_Reflect", scene.pass_Reflect) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_reflection: + yi.paramsSetString("pass_Reflect", scene.yafaray.passes.pass_Reflect) else: yi.paramsSetString("pass_Reflect", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_refraction: - yi.paramsSetString("pass_Refract", scene.pass_Refract) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_refraction: + yi.paramsSetString("pass_Refract", scene.yafaray.passes.pass_Refract) else: yi.paramsSetString("pass_Refract", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_object_index: - yi.paramsSetString("pass_IndexOB", scene.pass_IndexOB) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_object_index: + yi.paramsSetString("pass_IndexOB", scene.yafaray.passes.pass_IndexOB) else: yi.paramsSetString("pass_IndexOB", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_material_index: - yi.paramsSetString("pass_IndexMA", scene.pass_IndexMA) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_material_index: + yi.paramsSetString("pass_IndexMA", scene.yafaray.passes.pass_IndexMA) else: yi.paramsSetString("pass_IndexMA", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_diffuse_direct: - yi.paramsSetString("pass_DiffDir", scene.pass_DiffDir) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_diffuse_direct: + yi.paramsSetString("pass_DiffDir", scene.yafaray.passes.pass_DiffDir) else: yi.paramsSetString("pass_DiffDir", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_diffuse_indirect: - yi.paramsSetString("pass_DiffInd", scene.pass_DiffInd) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_diffuse_indirect: + yi.paramsSetString("pass_DiffInd", scene.yafaray.passes.pass_DiffInd) else: yi.paramsSetString("pass_DiffInd", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_diffuse_color: - yi.paramsSetString("pass_DiffCol", scene.pass_DiffCol) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_diffuse_color: + yi.paramsSetString("pass_DiffCol", scene.yafaray.passes.pass_DiffCol) else: yi.paramsSetString("pass_DiffCol", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_glossy_direct: - yi.paramsSetString("pass_GlossDir", scene.pass_GlossDir) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_glossy_direct: + yi.paramsSetString("pass_GlossDir", scene.yafaray.passes.pass_GlossDir) else: yi.paramsSetString("pass_GlossDir", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_glossy_indirect: - yi.paramsSetString("pass_GlossInd", scene.pass_GlossInd) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_glossy_indirect: + yi.paramsSetString("pass_GlossInd", scene.yafaray.passes.pass_GlossInd) else: yi.paramsSetString("pass_GlossInd", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_glossy_color: - yi.paramsSetString("pass_GlossCol", scene.pass_GlossCol) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_glossy_color: + yi.paramsSetString("pass_GlossCol", scene.yafaray.passes.pass_GlossCol) else: yi.paramsSetString("pass_GlossCol", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_transmission_direct: - yi.paramsSetString("pass_TransDir", scene.pass_TransDir) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_transmission_direct: + yi.paramsSetString("pass_TransDir", scene.yafaray.passes.pass_TransDir) else: yi.paramsSetString("pass_TransDir", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_transmission_indirect: - yi.paramsSetString("pass_TransInd", scene.pass_TransInd) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_transmission_indirect: + yi.paramsSetString("pass_TransInd", scene.yafaray.passes.pass_TransInd) else: yi.paramsSetString("pass_TransInd", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_transmission_color: - yi.paramsSetString("pass_TransCol", scene.pass_TransCol) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_transmission_color: + yi.paramsSetString("pass_TransCol", scene.yafaray.passes.pass_TransCol) else: yi.paramsSetString("pass_TransCol", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_subsurface_direct: - yi.paramsSetString("pass_SubsurfaceDir", scene.pass_SubsurfaceDir) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_subsurface_direct: + yi.paramsSetString("pass_SubsurfaceDir", scene.yafaray.passes.pass_SubsurfaceDir) else: yi.paramsSetString("pass_SubsurfaceDir", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_subsurface_indirect: - yi.paramsSetString("pass_SubsurfaceInd", scene.pass_SubsurfaceInd) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_subsurface_indirect: + yi.paramsSetString("pass_SubsurfaceInd", scene.yafaray.passes.pass_SubsurfaceInd) else: yi.paramsSetString("pass_SubsurfaceInd", "disabled") - if scene.pass_enable and scene.render.layers[0].use_pass_subsurface_color: - yi.paramsSetString("pass_SubsurfaceCol", scene.pass_SubsurfaceCol) + if scene.yafaray.passes.pass_enable and scene.render.layers[0].use_pass_subsurface_color: + yi.paramsSetString("pass_SubsurfaceCol", scene.yafaray.passes.pass_SubsurfaceCol) else: yi.paramsSetString("pass_SubsurfaceCol", "disabled") diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index e4b1b3be..2215e56f 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -26,6 +26,7 @@ EnumProperty, BoolProperty, StringProperty, + PointerProperty, CollectionProperty) Scene = bpy.types.Scene @@ -38,804 +39,820 @@ def call_update_fileformat(self, context): if scene.img_output is not render.image_settings.file_format: render.image_settings.file_format = scene.img_output -def register(): - ########### YafaRays general settings properties ############# - Scene.gs_ray_depth = IntProperty( - name="Ray depth", - description="Maximum depth for recursive raytracing", - min=0, max=64, default=2) +class YafaRayProperties(bpy.types.PropertyGroup): + pass + +class YafaRayNoiseControlProperties(bpy.types.PropertyGroup): + resampled_floor = FloatProperty( + name="Resampled floor (%)", + description=("Noise reduction: when resampled pixels go below this value (% of total pixels)," + " the AA threshold will automatically decrease before the next pass"), + min=0.0, max=100.0, precision=1, + default=0.0) - Scene.gs_shadow_depth = IntProperty( - name="Shadow depth", - description="Max. depth for transparent shadows calculation (if enabled)", - min=0, max=64, default=2) + sample_multiplier_factor = FloatProperty( + name="AA sample multiplier factor", + description="Factor to increase the AA samples multiplier for next AA pass.", + min=1.0, max=2.0, precision=2, + default=1.0) - Scene.gs_threads = IntProperty( - name="Threads", - description="Number of threads to use for rendering", - min=1, default=1) + light_sample_multiplier_factor = FloatProperty( + name="Light sample multiplier factor", + description="Factor to increase the light samples multiplier for next AA pass.", + min=1.0, max=2.0, precision=2, + default=1.0) - Scene.gs_gamma = FloatProperty( - name="Gamma", - description="Gamma correction applied to final output, inverse correction " - "of textures and colors is performed", - min=0, max=5, default= 1.0) + indirect_sample_multiplier_factor = FloatProperty( + name="Indirect sample multiplier factor", + description="Factor to increase the indirect samples (FG for example) multiplier for next AA pass.", + min=1.0, max=2.0, precision=2, + default=1.0) - Scene.gs_gamma_input = FloatProperty( - name="Gamma input", - description="Gamma correction applied to input", - min=0, max=5, default=1.0) + detect_color_noise = BoolProperty( + name="Color noise detection", + description="Detect noise in RGB components in addidion to pixel brightness", + default=False) + + dark_threshold_factor = FloatProperty( + name="Dark areas noise detection factor", + description=("Factor used to reduce the AA threshold in dark areas." + " It will reduce noise in dark areas, but noise in bright areas will take longer."), + min=0.0, max=0.8, precision=2, + default=0.0) - Scene.gs_tile_size = IntProperty( - name="Tile size", - description="Size of the render buckets (tiles)", - min=0, max=1024, default=32) + variance_edge_size = IntProperty( + name="Variance window", + description="Window edge size for variance noise detection.", + min=4, max=20, + default=10) - Scene.gs_tile_order = EnumProperty( - name="Tile order", - description="Selects tiles order type", - items=( - ('linear', "Linear", ""), - ('random', "Random", "") - ), - default='random') + variance_pixels = IntProperty( + name="Variance threshold", + description="Threshold (in pixels) for variance noise detection. 0 disables variance detection", + min=0, max=10, + default=0) - Scene.gs_auto_threads = BoolProperty( - name="Auto threads", - description="Activate thread number auto detection", - default=True) + clamp_samples = FloatProperty( + name="Clamp samples", + description="Clamp RGB values in all samples, less noise but less realism. 0.0 disables clamping.", + min=0.0, precision=1, + default=0.0) - Scene.gs_clay_render = BoolProperty( - name="Render clay", - description="Override all materials with a white diffuse material", - default=False) + clamp_indirect = FloatProperty( + name="Clamp indirect", + description="Clamp RGB values in the indirect light, less noise but less realism. 0.0 disables clamping.", + min=0.0, precision=1, + default=0.0) - Scene.gs_clay_render_keep_transparency = BoolProperty( - name="Keep transparency", - description="Keep transparency during clay render", + +class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): + pass_enable = BoolProperty( + name="Enable render passes", default=False) - Scene.gs_clay_render_keep_normals = BoolProperty( - name="Keep normal/bump maps", - description="Keep normal and bump maps during clay render", + pass_mask_obj_index = IntProperty( + name="Mask Object Index", + description="Object index used for masking in the Mask render passes", + min=0, + default=0) + + pass_mask_mat_index = IntProperty( + name="Mask Material Index", + description="Material index used for masking in the Mask render passes", + min=0, + default=0) + + pass_mask_invert = BoolProperty( + name="Invert Mask selection", + description="Property to mask-in or mask-out the desired objects/materials in the Mask render passes", + default=False) + + pass_mask_only = BoolProperty( + name="Mask Only", + description="Property to show the mask only instead of the masked rendered image", default=False) - Scene.gs_clay_oren_nayar = BoolProperty( - name="Oren-Nayar", - description="Use Oren-Nayar shader for a more realistic diffuse clay render", - default=True) - Scene.gs_clay_sigma = FloatProperty( - name="Sigma", - description="Roughness of the clay surfaces when rendering with Clay-Oren Nayar", - min=0.0, max=1.0, - step=1, precision=5, - soft_min=0.0, soft_max=1.0, - default=0.30000) + #The numbers here MUST NEVER CHANGE to keep backwards compatibility with older scenes. The numbers do not need to match the Core internal pass numbers. + #The matching between these properties and the YafaRay Core internal passes is done via the first string, for example 'z-depth-abs'. They must match the list of strings for internal passes in the Core: include/core_api/color.h + renderPassItemsDisabled=sorted(( + ('disabled', "Disabled", "Disable this pass", "", 999999), + ), key=lambda index: index[1]) - # added clay color property - Scene.gs_clay_col = FloatVectorProperty( - name="Clay color", - description="Color of clay render material", - subtype='COLOR', - min=0.0, max=1.0, - default=(0.5, 0.5, 0.5)) + renderPassItemsBasic=sorted(( + ('combined', "Basic: Combined image", "Basic: Combined standard image", "", 0), + ('diffuse', "Basic: Diffuse", "Basic: Diffuse materials", "", 1), + ('diffuse-noshadow', "Basic: Diffuse (no shadows)", "Basic: Diffuse materials (without shadows)", "", 2), + ('shadow', "Basic: Shadow", "Basic: Shadows", "", 3), + ('env', "Basic: Environment", "Basic: Environmental light", "", 4), + ('indirect', "Basic: Indirect", "Basic: Indirect light (all, including caustics and diffuse)", "", 5), + ('emit', "Basic: Emit", "Basic: Objects emitting light", "", 6), + ('reflect', "Basic: Reflection", "Basic: Reflections (all, including perfect and glossy)", "", 7), + ('refract', "Basic: Refraction", "Basic: Refractions (all, including perfect and sampled)", "", 8), + ('mist', "Basic: Mist", "Basic: Mist", "", 9), + ), key=lambda index: index[1]) + + renderPassItemsDepth=sorted(( + ('z-depth-abs', "Z-Depth (absolute)", "Z-Depth (absolute values)", "", 101), + ('z-depth-norm', "Z-Depth (normalized)", "Z-Depth (normalized values)", "", 102), + ), key=lambda index: index[1]) + + renderPassItemsIndex=sorted(( + ('obj-index-abs', "Index-Object (absolute)", "Index-Object: Grayscale value = obj.index in the object properties (absolute values)", "", 201), + ('obj-index-norm', "Index-Object (normalized)", "Index-Object: Grayscale value = obj.index in the object properties (normalized values)", "", 202), + ('obj-index-auto', "Index-Object (auto)", "Index-Object: A color automatically generated for each object", "", 203), + ('obj-index-mask', "Index-Object Mask", "", "Index-Object: Masking object based on obj.index.mask setting", 204), + ('obj-index-mask-shadow', "Index-Object Mask Shadow", "", "Index-Object: Masking object shadow based on obj.index.mask setting", 205), + ('obj-index-mask-all', "Index-Object Mask All (Object+Shadow)", "", "Index-Object: Masking object+shadow based on obj.index.mask setting", 206), + ('mat-index-abs', "Index-Material (absolute)", "Index-Material: Grayscale value = mat.index in the material properties (absolute values)", "", 207), + ('mat-index-norm', "Index-Material (normalized)", "Index-Material: Grayscale value = mat.index in the material properties (normalized values)", "", 208), + ('mat-index-auto', "Index-Material (auto)", "Index-Material: A color automatically generated for each material", "", 209), + ('mat-index-mask', "Index-Material Mask", "", "Index-Material: Masking material based on mat.index.mask setting", 210), + ('mat-index-mask-shadow', "Index-Material Mask Shadow", "", "Index-Material: Masking material shadow based on mat.index.mask setting", 211), + ('mat-index-mask-all', "Index-Material Mask All (Object+Shadow)", "", "Index-Material: Masking material+shadow based on mat.index.mask setting", 212) + ), key=lambda index: index[1]) + + renderPassItemsDebug=sorted(( + ('debug-aa-samples', "Debug: AA sample count", "Debug: Adaptative AA sample count (estimation), normalized", "", 301), + ('debug-uv', "Debug: UV", "Debug: UV coordinates (black for objects with no UV mapping)", "", 302), + ('debug-dsdv', "Debug: dSdV", "Debug: shading dSdV", "", 303), + ('debug-dsdu', "Debug: dSdU", "Debug: shading dSdU", "", 304), + ('debug-dpdv', "Debug: dPdV", "Debug: surface dPdV", "", 305), + ('debug-dpdu', "Debug: dPdU", "Debug: surface dPdU", "", 306), + ('debug-nv', "Debug: NV", "Debug - surface NV", "", 307), + ('debug-nu', "Debug: NU", "Debug - surface NU", "", 308), + ('debug-normal-geom', "Debug: Normals (geometric)", "Normals (geometric, no smoothness)", "", 309), + ('debug-normal-smooth', "Debug: Normals (smooth)", "Normals (including smoothness)", "", 310), + ), key=lambda index: index[1]) - Scene.gs_mask_render = BoolProperty( - name="Render mask", - description="Renders an object mask pass with different colors", - default=False) + renderInternalPassAdvanced=sorted(( + ('adv-reflect', "Adv: Reflection ", "Reflections (perfect only)", "", 401), + ('adv-refract', "Adv: Refraction", "Refractions (perfect only)", "", 402), + ('adv-radiance', "Adv: Photon Radiance map", "Advanced: Radiance map (only for photon mapping)", "", 403), + ('adv-volume-transmittance', "Adv: Volume Transmittance", "Advanced: Volume Transmittance", "", 404), + ('adv-volume-integration', "Adv: Volume integration", "Advanced: Volume integration", "", 405), + ('adv-diffuse-indirect', "Adv: Diffuse Indirect", "Advanced: Diffuse Indirect light", "", 406), + ('adv-diffuse-color', "Adv: Diffuse color", "Advanced: Diffuse color", "", 407), + ('adv-glossy', "Adv: Glossy", "Advanced: Glossy materials", "", 408), + ('adv-glossy-indirect', "Adv: Glossy Indirect", "Advanced: Glossy Indirect light", "", 409), + ('adv-glossy-color', "Adv: Glossy color", "Advanced: Glossy color", "", 410), + ('adv-trans', "Adv: Transmissive", "Advanced: Transmissive materials", "", 411), + ('adv-trans-indirect', "Adv: Trans.Indirect", "Advanced: Transmissive Indirect light", "", 412), + ('adv-trans-color', "Adv: Trans.color", "Advanced: Transmissive color", "", 413), + ('adv-subsurface', "Adv: SubSurface", "Advanced: SubSurface materials", "", 414), + ('adv-subsurface-indirect', "Adv: SubSurf.Indirect", "Advanced: SubSurface Indirect light", "", 415), + ('adv-subsurface-color', "Adv: SubSurf.color", "Advanced: SubSurface color", "", 416), + ('adv-indirect', "Adv: Indirect", "Adv: Indirect light (depends on the integrator but usually caustics only)", "", 417), + ('adv-surface-integration', "Adv: Surface Integration", "Advanced: Surface Integration", "", 418), + ), key=lambda index: index[1]) - Scene.gs_draw_params = BoolProperty( - name="Draw parameters", - description="Write the render parameters below the image", - default=False) + renderPassItemsAO=sorted(( + ('ao', "AO", "Ambient Occlusion", "", 501), + ('ao-clay', "AO clay", "Ambient Occlusion (clay)", "", 502), + ), key=lambda index: index[1]) - Scene.bg_transp = BoolProperty( - name="Transp.background", - description="Render the background as transparent", - default=False) + renderPassItemsLightGroup=sorted(( + ('light-group-0', "Light Group 0", "Pass illuminated by lights from the selected light group", "", 600), + ('light-group-1', "Light Group 1", "Pass illuminated by lights from the selected light group", "", 601), + ('light-group-2', "Light Group 2", "Pass illuminated by lights from the selected light group", "", 602), + ('light-group-3', "Light Group 3", "Pass illuminated by lights from the selected light group", "", 603), + ('light-group-4', "Light Group 4", "Pass illuminated by lights from the selected light group", "", 604), + ('light-group-5', "Light Group 5", "Pass illuminated by lights from the selected light group", "", 605), + ('light-group-6', "Light Group 6", "Pass illuminated by lights from the selected light group", "", 606), + ('light-group-7', "Light Group 7", "Pass illuminated by lights from the selected light group", "", 607), + ), key=lambda index: index[1]) - Scene.bg_transp_refract = BoolProperty( - name="Materials transp. refraction", - description="Materials refract the background as transparent", - default=True) + #This property is not currently used by YafaRay Core, as the combined external pass is always using the internal combined pass. + pass_Combined = EnumProperty( + name="Combined", #RGBA (4 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsDisabled + ), + default="disabled") - Scene.adv_auto_shadow_bias_enabled = BoolProperty( - name="Shadow Bias Automatic", - description="Shadow Bias Automatic Calculation (recommended). Disable ONLY if artifacts or black dots due to bad self-shadowing, otherwise LEAVE THIS ENABLED FOR NORMAL SCENES", - default=True) + pass_Depth = EnumProperty( + name="Depth", #Gray (1 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsDepth + ), + default="z-depth-norm") - Scene.adv_shadow_bias_value = FloatProperty( - name="Shadow Bias Factor", - description="Shadow Bias (default 0.0005). Change ONLY if artifacts or black dots due to bad self-shadowing. Increasing this value can led to artifacts and incorrect renders.", - min=0.00000001, max=10000, default=0.0005) + pass_Vector = EnumProperty( + name="Vector", #RGBA (4 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex+renderPassItemsDebug + ), + default="obj-index-auto") - Scene.adv_auto_min_raydist_enabled = BoolProperty( - name="Min Ray Dist Automatic", - description="Min Ray Dist Automatic Calculation (recommended), based on the Shadow Bias factor. Disable ONLY if artifacts or light leaks due to bad ray intersections, otherwise LEAVE THIS ENABLED FOR NORMAL SCENES", - default=True) + pass_Normal = EnumProperty( + name="Normal", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex+renderPassItemsDebug + ), + default="debug-normal-smooth") + + pass_UV = EnumProperty( + name="UV", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex+renderPassItemsDebug + ), + default="debug-uv") - Scene.adv_min_raydist_value = FloatProperty( - name="Min Ray Dist Factor", - description="Min Ray Dist (default 0.00005). Change ONLY if artifacts or light leaks due to bad ray intersections. Increasing this value can led to artifacts and incorrect renders.", - min=0.00000001, max=10000, default=0.00005) + pass_Color = EnumProperty( + name="Color", #RGBA (4 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex+renderPassItemsDebug + ), + default="mat-index-auto") - Scene.gs_custom_string = StringProperty( - name="Custom string", - description="Custom string will be added to the info bar, " - "use it for CPU, RAM etc", - default="") + pass_Emit = EnumProperty( + name="Emit", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="emit") + + pass_Mist = EnumProperty( + name="Mist", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="mist") - Scene.gs_premult = BoolProperty( - name="Premultiply", - description="Premultipy Alpha channel for renders with transparent background", - default=True) + pass_Diffuse = EnumProperty( + name="Diffuse", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="diffuse") + + pass_Spec = EnumProperty( + name="Spec", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="adv-reflect") - Scene.gs_transp_shad = BoolProperty( - name="Transparent shadows", - description="Compute transparent shadows", - default=False) + pass_AO = EnumProperty( + name="AO", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsAO + ), + default="ao") - Scene.gs_show_sam_pix = BoolProperty( - name="Show sample pixels", - description="Masks pixels marked for resampling during adaptive passes", - default=True) - - Scene.gs_verbose = BoolProperty( - name="Log info to console", - description="Print YafaRay engine log messages in console window", - default=True) + pass_Env = EnumProperty( + name="Env", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="env") - Scene.gs_type_render = EnumProperty( - name="Render", - description="Choose the render output method", - items=( - ('file', "Image file", "Render the Scene and write it to an Image File when finished"), - ('into_blender', "Into Blender", "Render the Scene into Blenders Renderbuffer"), - ('xml', "XML file", "Export the Scene to a XML File") + pass_Indirect = EnumProperty( + name="Indirect", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced ), - default='into_blender') + default="indirect") - ######### YafaRays own image output property ############ - Scene.img_output = EnumProperty( - name="Image File Type", - description="Image will be saved in this file format", - items=( - ('PNG', " PNG (Portable Network Graphics)", ""), - ('TARGA', " TGA (Truevision TARGA)", ""), - ('JPEG', " JPEG (Joint Photographic Experts Group)", ""), - ('TIFF', " TIFF (Tag Image File Format)", ""), - ('OPEN_EXR', " EXR (IL&M OpenEXR)", ""), - ('HDR', " HDR (Radiance RGBE)", "") + pass_Shadow = EnumProperty( + name="Shadow", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced ), - default='PNG', update=call_update_fileformat) + default="shadow") - Scene.img_multilayer = BoolProperty( - name="MultiLayer", - description="Enable MultiLayer image export, only available in certain formats as EXR", - default=False) + pass_Reflect = EnumProperty( + name="Reflect", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced + ), + default="reflect") - ########### YafaRays integrator properties ############# - Scene.intg_light_method = EnumProperty( - name="Lighting Method", - items=( - ('Direct Lighting', "Direct Lighting", ""), - ('Photon Mapping', "Photon Mapping", ""), - ('Pathtracing', "Pathtracing", ""), - ('Debug', "Debug", ""), - ('Bidirectional', "Bidirectional", ""), - ('SPPM', "SPPM", "") + pass_Refract = EnumProperty( + name="Refract", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced ), - default='Direct Lighting') + default="refract") - Scene.intg_use_caustics = BoolProperty( - name="Caustic Photons", - description="Enable photon map for caustics only", - default=False) + pass_IndexOB = EnumProperty( + name="Object Index", #Gray (1 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex + ), + default="obj-index-norm") + + pass_IndexMA = EnumProperty( + name="Material Index", #Gray (1 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsIndex + ), + default="mat-index-norm") - Scene.intg_photons = IntProperty( - name="Photons", - description="Number of photons to be shot", - min=1, max=100000000, - default=500000) + pass_DiffDir = EnumProperty( + name="Diff Dir", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="diffuse") + + pass_DiffInd = EnumProperty( + name="Diff Ind", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-diffuse-indirect") - Scene.intg_caustic_mix = IntProperty( - name="Caustic Mix", - description="Max. number of photons to mix (blur)", - min=1, max=10000, - default=100) + pass_DiffCol = EnumProperty( + name="Diff Col", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-diffuse-color") - Scene.intg_caustic_depth = IntProperty( - name="Caustic Depth", - description="Max. number of scatter events for photons", - min=0, max=50, - default=10) + pass_GlossDir = EnumProperty( + name="Gloss Dir", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-glossy") + + pass_GlossInd = EnumProperty( + name="Gloss Ind", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-glossy-indirect") - Scene.intg_caustic_radius = FloatProperty( - name="Caustic Radius", - description="Max. radius to search for photons", - min=0.0001, max=100.0, - default=1.0) + pass_GlossCol = EnumProperty( + name="Gloss Col", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-glossy-color") - Scene.intg_use_AO = BoolProperty( - name="Ambient Occlusion", - description="Enable ambient occlusion", - default=False) + pass_TransDir = EnumProperty( + name="Trans Dir", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-trans") + + pass_TransInd = EnumProperty( + name="Trans Ind", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-trans-indirect") - Scene.intg_AO_samples = IntProperty( - name="Samples", - description="Number of samples for ambient occlusion", - min=1, max=1000, - default=32) + pass_TransCol = EnumProperty( + name="Trans Col", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-trans-color") - Scene.intg_AO_distance = FloatProperty( - name="Distance", - description=("Max. occlusion distance," - " Surfaces further away do not occlude ambient light"), - min=0.0, max=10000.0, - default=1.0) + pass_SubsurfaceDir = EnumProperty( + name="SubSurface Dir", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-subsurface") + + pass_SubsurfaceInd = EnumProperty( + name="SubSurface Ind", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-subsurface-indirect") - Scene.intg_AO_color = FloatVectorProperty( - name="AO Color", - description="Color Settings", subtype='COLOR', - min=0.0, max=1.0, - default=(0.9, 0.9, 0.9)) + pass_SubsurfaceCol = EnumProperty( + name="SubSurface Col", #RGB (3 x float) + description="Select the type of image you want to be displayed in this pass.", + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + ), + default="adv-subsurface-color") - Scene.intg_bounces = IntProperty( - name="Depth", - description="", - min=1, - default=4) - Scene.intg_diffuse_radius = FloatProperty( - name="Search radius", - description="Radius to search for diffuse photons", - min=0.001, - default=1.0) +class ViewsLightGroupList(bpy.types.PropertyGroup): + view_number = IntProperty( + name="View Number", + description="View Number to which we will assign a light group filter", + default=0, + min=0) + + light_group = IntProperty( + name="Light Group", + description="Light group filter [1..100]. Value 0 will render all light groups", + default=0, + min=0, + max=100) - Scene.intg_cPhotons = IntProperty( - name="Count", - description="Number of caustic photons to be shot", - min=1, default=500000) - Scene.intg_search = IntProperty( - name="Search count", - description="Maximum number of diffuse photons to be filtered", - min=1, max=10000, - default=100) +def register(): + ########### YafaRays general settings properties ############# + Scene.gs_ray_depth = IntProperty( + name="Ray depth", + description="Maximum depth for recursive raytracing", + min=0, max=64, default=2) - Scene.intg_final_gather = BoolProperty( - name="Final Gather", - description="Use final gathering (recommended)", - default=True) + Scene.gs_shadow_depth = IntProperty( + name="Shadow depth", + description="Max. depth for transparent shadows calculation (if enabled)", + min=0, max=64, default=2) - Scene.intg_fg_bounces = IntProperty( - name="Bounces", - description="Allow gather rays to extend to paths of this length", - min=1, max=20, - default=3) + Scene.gs_threads = IntProperty( + name="Threads", + description="Number of threads to use for rendering", + min=1, default=1) - Scene.intg_fg_samples = IntProperty( - name="Samples", - description="Number of samples for final gathering", - min=1, - default=16) + Scene.gs_gamma = FloatProperty( + name="Gamma", + description="Gamma correction applied to final output, inverse correction " + "of textures and colors is performed", + min=0, max=5, default= 1.0) - Scene.intg_show_map = BoolProperty( - name="Show radiance map", - description="Directly show radiance map, useful to calibrate the photon map (disables final gathering step)", - default=False) + Scene.gs_gamma_input = FloatProperty( + name="Gamma input", + description="Gamma correction applied to input", + min=0, max=5, default=1.0) - Scene.intg_caustic_method = EnumProperty( - name="Caustic Method", + Scene.gs_tile_size = IntProperty( + name="Tile size", + description="Size of the render buckets (tiles)", + min=0, max=1024, default=32) + + Scene.gs_tile_order = EnumProperty( + name="Tile order", + description="Selects tiles order type", items=( - ('None', "None", ""), - ('Path', "Path", ""), - ('Path+Photon', "Path+Photon", ""), - ('Photon', "Photon", "")), - description="Choose caustic rendering method", - default='None') + ('linear', "Linear", ""), + ('random', "Random", "") + ), + default='random') - Scene.intg_path_samples = IntProperty( - name="Path Samples", - description="Number of path samples per pixel sample", - min=1, - default=32) + Scene.gs_auto_threads = BoolProperty( + name="Auto threads", + description="Activate thread number auto detection", + default=True) - Scene.intg_no_recursion = BoolProperty( - name="No Recursion", - description="No recursive raytracing, only pure path tracing", + Scene.gs_clay_render = BoolProperty( + name="Render clay", + description="Override all materials with a white diffuse material", default=False) - Scene.intg_debug_type = EnumProperty( - name="Debug type", - items=( - ('N', "N", ""), - ('dPdU', "dPdU", ""), - ('dPdV', "dPdV", ""), - ('NU', "NU", ""), - ('NV', "NV", ""), - ('dSdU', "dSdU", ""), - ('dSdV', "dSdV", "")), - default='dSdV') - - Scene.intg_show_perturbed_normals = BoolProperty( - name="Show perturbed normals", - description="Show the normals perturbed by bump and normal maps", + Scene.gs_clay_render_keep_transparency = BoolProperty( + name="Keep transparency", + description="Keep transparency during clay render", default=False) - Scene.intg_pm_ire = BoolProperty( - name="PM Initial Radius Estimate", + Scene.gs_clay_render_keep_normals = BoolProperty( + name="Keep normal/bump maps", + description="Keep normal and bump maps during clay render", default=False) - Scene.intg_pass_num = IntProperty( - name="Passes", - min=1, - default=1000) + Scene.gs_clay_oren_nayar = BoolProperty( + name="Oren-Nayar", + description="Use Oren-Nayar shader for a more realistic diffuse clay render", + default=True) - Scene.intg_times = FloatProperty( - name="Radius factor", - min=0.0, - description= "Initial radius times", - default=1.0) + Scene.gs_clay_sigma = FloatProperty( + name="Sigma", + description="Roughness of the clay surfaces when rendering with Clay-Oren Nayar", + min=0.0, max=1.0, + step=1, precision=5, + soft_min=0.0, soft_max=1.0, + default=0.30000) - Scene.intg_photon_radius = FloatProperty( - name="Search radius", - min=0.0, - default=1.0) - ######### YafaRays anti-aliasing/noise properties ########### - Scene.AA_min_samples = IntProperty( - name="Samples", - description="Number of samples for first AA pass", - min=1, - default=1) + # added clay color property + Scene.gs_clay_col = FloatVectorProperty( + name="Clay color", + description="Color of clay render material", + subtype='COLOR', + min=0.0, max=1.0, + default=(0.5, 0.5, 0.5)) - Scene.AA_inc_samples = IntProperty( - name="Additional Samples", - description="Number of samples for additional AA passes", - min=1, - default=1) + Scene.gs_mask_render = BoolProperty( + name="Render mask", + description="Renders an object mask pass with different colors", + default=False) - Scene.AA_passes = IntProperty( - name="Passes", - description=("Number of anti-aliasing passes," - " Adaptive sampling (passes > 1) uses different pattern"), - min=1, - default=1) + Scene.gs_draw_params = BoolProperty( + name="Draw parameters", + description="Write the render parameters below the image", + default=False) - Scene.AA_threshold = FloatProperty( - name="Threshold", - description="Color threshold for additional AA samples in next pass", - min=0.0, max=1.0, precision=4, - default=0.05) + Scene.bg_transp = BoolProperty( + name="Transp.background", + description="Render the background as transparent", + default=False) - Scene.AA_pixelwidth = FloatProperty( - name="Pixelwidth", - description="AA filter size", - min=1.0, max=20.0, precision=3, - default=1.5) + Scene.bg_transp_refract = BoolProperty( + name="Materials transp. refraction", + description="Materials refract the background as transparent", + default=True) - Scene.AA_filter_type = EnumProperty( - name="Filter", - items=( - ('box', "Box", "AA filter type"), - ('mitchell', "Mitchell", "AA filter type"), - ('gauss', "Gauss", "AA filter type"), - ('lanczos', "Lanczos", "AA filter type") - ), - default="gauss") - - Scene.pass_enable = BoolProperty( - name="Enable render passes", - default=False) - - Scene.pass_mask_obj_index = IntProperty( - name="Mask Object Index", - description="Object index used for masking in the Mask render passes", - min=0, - default=0) - - Scene.pass_mask_mat_index = IntProperty( - name="Mask Material Index", - description="Material index used for masking in the Mask render passes", - min=0, - default=0) - - Scene.pass_mask_invert = BoolProperty( - name="Invert Mask selection", - description="Property to mask-in or mask-out the desired objects/materials in the Mask render passes", - default=False) - - Scene.pass_mask_only = BoolProperty( - name="Mask Only", - description="Property to show the mask only instead of the masked rendered image", - default=False) + Scene.adv_auto_shadow_bias_enabled = BoolProperty( + name="Shadow Bias Automatic", + description="Shadow Bias Automatic Calculation (recommended). Disable ONLY if artifacts or black dots due to bad self-shadowing, otherwise LEAVE THIS ENABLED FOR NORMAL SCENES", + default=True) + Scene.adv_shadow_bias_value = FloatProperty( + name="Shadow Bias Factor", + description="Shadow Bias (default 0.0005). Change ONLY if artifacts or black dots due to bad self-shadowing. Increasing this value can led to artifacts and incorrect renders.", + min=0.00000001, max=10000, default=0.0005) - #The numbers here MUST NEVER CHANGE to keep backwards compatibility with older scenes. The numbers do not need to match the Core internal pass numbers. - #The matching between these properties and the YafaRay Core internal passes is done via the first string, for example 'z-depth-abs'. They must match the list of strings for internal passes in the Core: include/core_api/color.h + Scene.adv_auto_min_raydist_enabled = BoolProperty( + name="Min Ray Dist Automatic", + description="Min Ray Dist Automatic Calculation (recommended), based on the Shadow Bias factor. Disable ONLY if artifacts or light leaks due to bad ray intersections, otherwise LEAVE THIS ENABLED FOR NORMAL SCENES", + default=True) - renderPassItemsDisabled=sorted(( - ('disabled', "Disabled", "Disable this pass", "", 999999), - ), key=lambda index: index[1]) + Scene.adv_min_raydist_value = FloatProperty( + name="Min Ray Dist Factor", + description="Min Ray Dist (default 0.00005). Change ONLY if artifacts or light leaks due to bad ray intersections. Increasing this value can led to artifacts and incorrect renders.", + min=0.00000001, max=10000, default=0.00005) - renderPassItemsBasic=sorted(( - ('combined', "Basic: Combined image", "Basic: Combined standard image", "", 0), - ('diffuse', "Basic: Diffuse", "Basic: Diffuse materials", "", 1), - ('diffuse-noshadow', "Basic: Diffuse (no shadows)", "Basic: Diffuse materials (without shadows)", "", 2), - ('shadow', "Basic: Shadow", "Basic: Shadows", "", 3), - ('env', "Basic: Environment", "Basic: Environmental light", "", 4), - ('indirect', "Basic: Indirect", "Basic: Indirect light (all, including caustics and diffuse)", "", 5), - ('emit', "Basic: Emit", "Basic: Objects emitting light", "", 6), - ('reflect', "Basic: Reflection", "Basic: Reflections (all, including perfect and glossy)", "", 7), - ('refract', "Basic: Refraction", "Basic: Refractions (all, including perfect and sampled)", "", 8), - ('mist', "Basic: Mist", "Basic: Mist", "", 9), - ), key=lambda index: index[1]) - - renderPassItemsDepth=sorted(( - ('z-depth-abs', "Z-Depth (absolute)", "Z-Depth (absolute values)", "", 101), - ('z-depth-norm', "Z-Depth (normalized)", "Z-Depth (normalized values)", "", 102), - ), key=lambda index: index[1]) - - renderPassItemsIndex=sorted(( - ('obj-index-abs', "Index-Object (absolute)", "Index-Object: Grayscale value = obj.index in the object properties (absolute values)", "", 201), - ('obj-index-norm', "Index-Object (normalized)", "Index-Object: Grayscale value = obj.index in the object properties (normalized values)", "", 202), - ('obj-index-auto', "Index-Object (auto)", "Index-Object: A color automatically generated for each object", "", 203), - ('obj-index-mask', "Index-Object Mask", "", "Index-Object: Masking object based on obj.index.mask setting", 204), - ('obj-index-mask-shadow', "Index-Object Mask Shadow", "", "Index-Object: Masking object shadow based on obj.index.mask setting", 205), - ('obj-index-mask-all', "Index-Object Mask All (Object+Shadow)", "", "Index-Object: Masking object+shadow based on obj.index.mask setting", 206), - ('mat-index-abs', "Index-Material (absolute)", "Index-Material: Grayscale value = mat.index in the material properties (absolute values)", "", 207), - ('mat-index-norm', "Index-Material (normalized)", "Index-Material: Grayscale value = mat.index in the material properties (normalized values)", "", 208), - ('mat-index-auto', "Index-Material (auto)", "Index-Material: A color automatically generated for each material", "", 209), - ('mat-index-mask', "Index-Material Mask", "", "Index-Material: Masking material based on mat.index.mask setting", 210), - ('mat-index-mask-shadow', "Index-Material Mask Shadow", "", "Index-Material: Masking material shadow based on mat.index.mask setting", 211), - ('mat-index-mask-all', "Index-Material Mask All (Object+Shadow)", "", "Index-Material: Masking material+shadow based on mat.index.mask setting", 212) - ), key=lambda index: index[1]) - - renderPassItemsDebug=sorted(( - ('debug-aa-samples', "Debug: AA sample count", "Debug: Adaptative AA sample count (estimation), normalized", "", 301), - ('debug-uv', "Debug: UV", "Debug: UV coordinates (black for objects with no UV mapping)", "", 302), - ('debug-dsdv', "Debug: dSdV", "Debug: shading dSdV", "", 303), - ('debug-dsdu', "Debug: dSdU", "Debug: shading dSdU", "", 304), - ('debug-dpdv', "Debug: dPdV", "Debug: surface dPdV", "", 305), - ('debug-dpdu', "Debug: dPdU", "Debug: surface dPdU", "", 306), - ('debug-nv', "Debug: NV", "Debug - surface NV", "", 307), - ('debug-nu', "Debug: NU", "Debug - surface NU", "", 308), - ('debug-normal-geom', "Debug: Normals (geometric)", "Normals (geometric, no smoothness)", "", 309), - ('debug-normal-smooth', "Debug: Normals (smooth)", "Normals (including smoothness)", "", 310), - ), key=lambda index: index[1]) + Scene.gs_custom_string = StringProperty( + name="Custom string", + description="Custom string will be added to the info bar, " + "use it for CPU, RAM etc", + default="") - renderInternalPassAdvanced=sorted(( - ('adv-reflect', "Adv: Reflection ", "Reflections (perfect only)", "", 401), - ('adv-refract', "Adv: Refraction", "Refractions (perfect only)", "", 402), - ('adv-radiance', "Adv: Photon Radiance map", "Advanced: Radiance map (only for photon mapping)", "", 403), - ('adv-volume-transmittance', "Adv: Volume Transmittance", "Advanced: Volume Transmittance", "", 404), - ('adv-volume-integration', "Adv: Volume integration", "Advanced: Volume integration", "", 405), - ('adv-diffuse-indirect', "Adv: Diffuse Indirect", "Advanced: Diffuse Indirect light", "", 406), - ('adv-diffuse-color', "Adv: Diffuse color", "Advanced: Diffuse color", "", 407), - ('adv-glossy', "Adv: Glossy", "Advanced: Glossy materials", "", 408), - ('adv-glossy-indirect', "Adv: Glossy Indirect", "Advanced: Glossy Indirect light", "", 409), - ('adv-glossy-color', "Adv: Glossy color", "Advanced: Glossy color", "", 410), - ('adv-trans', "Adv: Transmissive", "Advanced: Transmissive materials", "", 411), - ('adv-trans-indirect', "Adv: Trans.Indirect", "Advanced: Transmissive Indirect light", "", 412), - ('adv-trans-color', "Adv: Trans.color", "Advanced: Transmissive color", "", 413), - ('adv-subsurface', "Adv: SubSurface", "Advanced: SubSurface materials", "", 414), - ('adv-subsurface-indirect', "Adv: SubSurf.Indirect", "Advanced: SubSurface Indirect light", "", 415), - ('adv-subsurface-color', "Adv: SubSurf.color", "Advanced: SubSurface color", "", 416), - ('adv-indirect', "Adv: Indirect", "Adv: Indirect light (depends on the integrator but usually caustics only)", "", 417), - ('adv-surface-integration', "Adv: Surface Integration", "Advanced: Surface Integration", "", 418), - ), key=lambda index: index[1]) + Scene.gs_premult = BoolProperty( + name="Premultiply", + description="Premultipy Alpha channel for renders with transparent background", + default=True) - renderPassItemsAO=sorted(( - ('ao', "AO", "Ambient Occlusion", "", 501), - ('ao-clay', "AO clay", "Ambient Occlusion (clay)", "", 502), - ), key=lambda index: index[1]) + Scene.gs_transp_shad = BoolProperty( + name="Transparent shadows", + description="Compute transparent shadows", + default=False) - renderPassItemsLightGroup=sorted(( - ('light-group-0', "Light Group 0", "Pass illuminated by lights from the selected light group", "", 600), - ('light-group-1', "Light Group 1", "Pass illuminated by lights from the selected light group", "", 601), - ('light-group-2', "Light Group 2", "Pass illuminated by lights from the selected light group", "", 602), - ('light-group-3', "Light Group 3", "Pass illuminated by lights from the selected light group", "", 603), - ('light-group-4', "Light Group 4", "Pass illuminated by lights from the selected light group", "", 604), - ('light-group-5', "Light Group 5", "Pass illuminated by lights from the selected light group", "", 605), - ('light-group-6', "Light Group 6", "Pass illuminated by lights from the selected light group", "", 606), - ('light-group-7', "Light Group 7", "Pass illuminated by lights from the selected light group", "", 607), - ), key=lambda index: index[1]) + Scene.gs_show_sam_pix = BoolProperty( + name="Show sample pixels", + description="Masks pixels marked for resampling during adaptive passes", + default=True) + + Scene.gs_verbose = BoolProperty( + name="Log info to console", + description="Print YafaRay engine log messages in console window", + default=True) - #This property is not currently used by YafaRay Core, as the combined external pass is always using the internal combined pass. - Scene.pass_Combined = EnumProperty( - name="Combined", #RGBA (4 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsDisabled + Scene.gs_type_render = EnumProperty( + name="Render", + description="Choose the render output method", + items=( + ('file', "Image file", "Render the Scene and write it to an Image File when finished"), + ('into_blender', "Into Blender", "Render the Scene into Blenders Renderbuffer"), + ('xml', "XML file", "Export the Scene to a XML File") ), - default="disabled") + default='into_blender') - Scene.pass_Depth = EnumProperty( - name="Depth", #Gray (1 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsDepth + ######### YafaRays own image output property ############ + Scene.img_output = EnumProperty( + name="Image File Type", + description="Image will be saved in this file format", + items=( + ('PNG', " PNG (Portable Network Graphics)", ""), + ('TARGA', " TGA (Truevision TARGA)", ""), + ('JPEG', " JPEG (Joint Photographic Experts Group)", ""), + ('TIFF', " TIFF (Tag Image File Format)", ""), + ('OPEN_EXR', " EXR (IL&M OpenEXR)", ""), + ('HDR', " HDR (Radiance RGBE)", "") ), - default="z-depth-norm") + default='PNG', update=call_update_fileformat) - Scene.pass_Vector = EnumProperty( - name="Vector", #RGBA (4 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsIndex+renderPassItemsDebug - ), - default="obj-index-auto") + Scene.img_multilayer = BoolProperty( + name="MultiLayer", + description="Enable MultiLayer image export, only available in certain formats as EXR", + default=False) - Scene.pass_Normal = EnumProperty( - name="Normal", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsIndex+renderPassItemsDebug - ), - default="debug-normal-smooth") - - Scene.pass_UV = EnumProperty( - name="UV", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsIndex+renderPassItemsDebug + ########### YafaRays integrator properties ############# + Scene.intg_light_method = EnumProperty( + name="Lighting Method", + items=( + ('Direct Lighting', "Direct Lighting", ""), + ('Photon Mapping', "Photon Mapping", ""), + ('Pathtracing', "Pathtracing", ""), + ('Debug', "Debug", ""), + ('Bidirectional', "Bidirectional", ""), + ('SPPM', "SPPM", "") ), - default="debug-uv") + default='Direct Lighting') - Scene.pass_Color = EnumProperty( - name="Color", #RGBA (4 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsIndex+renderPassItemsDebug - ), - default="mat-index-auto") + Scene.intg_use_caustics = BoolProperty( + name="Caustic Photons", + description="Enable photon map for caustics only", + default=False) - Scene.pass_Emit = EnumProperty( - name="Emit", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced - ), - default="emit") - - Scene.pass_Mist = EnumProperty( - name="Mist", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="mist") + Scene.intg_photons = IntProperty( + name="Photons", + description="Number of photons to be shot", + min=1, max=100000000, + default=500000) - Scene.pass_Diffuse = EnumProperty( - name="Diffuse", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced - ), - default="diffuse") - - Scene.pass_Spec = EnumProperty( - name="Spec", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced - ), - default="adv-reflect") + Scene.intg_caustic_mix = IntProperty( + name="Caustic Mix", + description="Max. number of photons to mix (blur)", + min=1, max=10000, + default=100) - Scene.pass_AO = EnumProperty( - name="AO", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsAO - ), - default="ao") + Scene.intg_caustic_depth = IntProperty( + name="Caustic Depth", + description="Max. number of scatter events for photons", + min=0, max=50, + default=10) - Scene.pass_Env = EnumProperty( - name="Env", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced - ), - default="env") + Scene.intg_caustic_radius = FloatProperty( + name="Caustic Radius", + description="Max. radius to search for photons", + min=0.0001, max=100.0, + default=1.0) - Scene.pass_Indirect = EnumProperty( - name="Indirect", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced - ), - default="indirect") + Scene.intg_use_AO = BoolProperty( + name="Ambient Occlusion", + description="Enable ambient occlusion", + default=False) - Scene.pass_Shadow = EnumProperty( - name="Shadow", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced - ), - default="shadow") + Scene.intg_AO_samples = IntProperty( + name="Samples", + description="Number of samples for ambient occlusion", + min=1, max=1000, + default=32) - Scene.pass_Reflect = EnumProperty( - name="Reflect", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced - ), - default="reflect") + Scene.intg_AO_distance = FloatProperty( + name="Distance", + description=("Max. occlusion distance," + " Surfaces further away do not occlude ambient light"), + min=0.0, max=10000.0, + default=1.0) + + Scene.intg_AO_color = FloatVectorProperty( + name="AO Color", + description="Color Settings", subtype='COLOR', + min=0.0, max=1.0, + default=(0.9, 0.9, 0.9)) - Scene.pass_Refract = EnumProperty( - name="Refract", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced - ), - default="refract") + Scene.intg_bounces = IntProperty( + name="Depth", + description="", + min=1, + default=4) - Scene.pass_IndexOB = EnumProperty( - name="Object Index", #Gray (1 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsIndex - ), - default="obj-index-norm") - - Scene.pass_IndexMA = EnumProperty( - name="Material Index", #Gray (1 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsIndex - ), - default="mat-index-norm") + Scene.intg_diffuse_radius = FloatProperty( + name="Search radius", + description="Radius to search for diffuse photons", + min=0.001, + default=1.0) - Scene.pass_DiffDir = EnumProperty( - name="Diff Dir", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="diffuse") - - Scene.pass_DiffInd = EnumProperty( - name="Diff Ind", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="adv-diffuse-indirect") + Scene.intg_cPhotons = IntProperty( + name="Count", + description="Number of caustic photons to be shot", + min=1, default=500000) - Scene.pass_DiffCol = EnumProperty( - name="Diff Col", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="adv-diffuse-color") + Scene.intg_search = IntProperty( + name="Search count", + description="Maximum number of diffuse photons to be filtered", + min=1, max=10000, + default=100) - Scene.pass_GlossDir = EnumProperty( - name="Gloss Dir", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="adv-glossy") - - Scene.pass_GlossInd = EnumProperty( - name="Gloss Ind", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="adv-glossy-indirect") + Scene.intg_final_gather = BoolProperty( + name="Final Gather", + description="Use final gathering (recommended)", + default=True) - Scene.pass_GlossCol = EnumProperty( - name="Gloss Col", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="adv-glossy-color") + Scene.intg_fg_bounces = IntProperty( + name="Bounces", + description="Allow gather rays to extend to paths of this length", + min=1, max=20, + default=3) - Scene.pass_TransDir = EnumProperty( - name="Trans Dir", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="adv-trans") - - Scene.pass_TransInd = EnumProperty( - name="Trans Ind", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="adv-trans-indirect") + Scene.intg_fg_samples = IntProperty( + name="Samples", + description="Number of samples for final gathering", + min=1, + default=16) - Scene.pass_TransCol = EnumProperty( - name="Trans Col", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="adv-trans-color") + Scene.intg_show_map = BoolProperty( + name="Show radiance map", + description="Directly show radiance map, useful to calibrate the photon map (disables final gathering step)", + default=False) - Scene.pass_SubsurfaceDir = EnumProperty( - name="SubSurface Dir", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="adv-subsurface") - - Scene.pass_SubsurfaceInd = EnumProperty( - name="SubSurface Ind", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="adv-subsurface-indirect") + Scene.intg_caustic_method = EnumProperty( + name="Caustic Method", + items=( + ('None', "None", ""), + ('Path', "Path", ""), + ('Path+Photon', "Path+Photon", ""), + ('Photon', "Photon", "")), + description="Choose caustic rendering method", + default='None') - Scene.pass_SubsurfaceCol = EnumProperty( - name="SubSurface Col", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug - ), - default="adv-subsurface-color") + Scene.intg_path_samples = IntProperty( + name="Path Samples", + description="Number of path samples per pixel sample", + min=1, + default=32) + Scene.intg_no_recursion = BoolProperty( + name="No Recursion", + description="No recursive raytracing, only pure path tracing", + default=False) - class ViewsLightGroupList(bpy.types.PropertyGroup): - view_number = IntProperty( - name="View Number", - description="View Number to which we will assign a light group filter", - default=0, - min=0) - - light_group = IntProperty( - name="Light Group", - description="Light group filter [1..100]. Value 0 will render all light groups", - default=0, - min=0, - max=100) + Scene.intg_debug_type = EnumProperty( + name="Debug type", + items=( + ('N', "N", ""), + ('dPdU', "dPdU", ""), + ('dPdV', "dPdV", ""), + ('NU', "NU", ""), + ('NV', "NV", ""), + ('dSdU', "dSdU", ""), + ('dSdV', "dSdV", "")), + default='dSdV') - bpy.utils.register_class(ViewsLightGroupList) + Scene.intg_show_perturbed_normals = BoolProperty( + name="Show perturbed normals", + description="Show the normals perturbed by bump and normal maps", + default=False) - Scene.views_lightgroup_list = CollectionProperty(type = ViewsLightGroupList) - Scene.views_lightgroup_list_index = IntProperty(name = "Index for the Views Light Group List", default = -1) + Scene.intg_pm_ire = BoolProperty( + name="PM Initial Radius Estimate", + default=False) - Scene.AA_resampled_floor = FloatProperty( - name="Resampled floor (%)", - description=("Noise reduction: when resampled pixels go below this value (% of total pixels)," - " the AA threshold will automatically decrease before the next pass"), - min=0.0, max=100.0, precision=1, - default=0.0) + Scene.intg_pass_num = IntProperty( + name="Passes", + min=1, + default=1000) - Scene.AA_sample_multiplier_factor = FloatProperty( - name="AA sample multiplier factor", - description="Factor to increase the AA samples multiplier for next AA pass.", - min=1.0, max=2.0, precision=2, + Scene.intg_times = FloatProperty( + name="Radius factor", + min=0.0, + description= "Initial radius times", default=1.0) - Scene.AA_light_sample_multiplier_factor = FloatProperty( - name="Light sample multiplier factor", - description="Factor to increase the light samples multiplier for next AA pass.", - min=1.0, max=2.0, precision=2, + Scene.intg_photon_radius = FloatProperty( + name="Search radius", + min=0.0, default=1.0) - Scene.AA_indirect_sample_multiplier_factor = FloatProperty( - name="Indirect sample multiplier factor", - description="Factor to increase the indirect samples (FG for example) multiplier for next AA pass.", - min=1.0, max=2.0, precision=2, - default=1.0) + ######### YafaRays anti-aliasing/noise properties ########### + Scene.AA_min_samples = IntProperty( + name="Samples", + description="Number of samples for first AA pass", + min=1, + default=1) - Scene.AA_detect_color_noise = BoolProperty( - name="Color noise detection", - description="Detect noise in RGB components in addidion to pixel brightness", - default=False) - - Scene.AA_dark_threshold_factor = FloatProperty( - name="Dark areas noise detection factor", - description=("Factor used to reduce the AA threshold in dark areas." - " It will reduce noise in dark areas, but noise in bright areas will take longer."), - min=0.0, max=0.8, precision=2, - default=0.0) + Scene.AA_inc_samples = IntProperty( + name="Additional Samples", + description="Number of samples for additional AA passes", + min=1, + default=1) - Scene.AA_variance_edge_size = IntProperty( - name="Variance window", - description="Window edge size for variance noise detection.", - min=4, max=20, - default=10) + Scene.AA_passes = IntProperty( + name="Passes", + description=("Number of anti-aliasing passes," + " Adaptive sampling (passes > 1) uses different pattern"), + min=1, + default=1) - Scene.AA_variance_pixels = IntProperty( - name="Variance threshold", - description="Threshold (in pixels) for variance noise detection. 0 disables variance detection", - min=0, max=10, - default=0) + Scene.AA_threshold = FloatProperty( + name="Threshold", + description="Color threshold for additional AA samples in next pass", + min=0.0, max=1.0, precision=4, + default=0.05) - Scene.AA_clamp_samples = FloatProperty( - name="Clamp samples", - description="Clamp RGB values in all samples, less noise but less realism. 0.0 disables clamping.", - min=0.0, precision=1, - default=0.0) + Scene.AA_pixelwidth = FloatProperty( + name="Pixelwidth", + description="AA filter size", + min=1.0, max=20.0, precision=3, + default=1.5) - Scene.AA_clamp_indirect = FloatProperty( - name="Clamp indirect", - description="Clamp RGB values in the indirect light, less noise but less realism. 0.0 disables clamping.", - min=0.0, precision=1, - default=0.0) + Scene.AA_filter_type = EnumProperty( + name="Filter", + items=( + ('box', "Box", "AA filter type"), + ('mitchell', "Mitchell", "AA filter type"), + ('gauss', "Gauss", "AA filter type"), + ('lanczos', "Lanczos", "AA filter type") + ), + default="gauss") + + bpy.utils.register_class(YafaRayProperties) + bpy.types.Scene.yafaray = PointerProperty(type=YafaRayProperties) + + bpy.utils.register_class(YafaRayRenderPassesProperties) + YafaRayProperties.passes = PointerProperty(type=YafaRayRenderPassesProperties) + + bpy.utils.register_class(YafaRayNoiseControlProperties) + YafaRayProperties.noise_control = PointerProperty(type=YafaRayNoiseControlProperties) + + bpy.utils.register_class(ViewsLightGroupList) + + Scene.views_lightgroup_list = CollectionProperty(type = ViewsLightGroupList) + Scene.views_lightgroup_list_index = IntProperty(name = "Index for the Views Light Group List", default = -1) def unregister(): @@ -905,52 +922,10 @@ def unregister(): Scene.AA_threshold Scene.AA_pixelwidth Scene.AA_filter_type - Scene.AA_resampled_floor - Scene.AA_sample_multiplier_factor - Scene.AA_light_sample_multiplier_factor - Scene.AA_indirect_sample_multiplier_factor - Scene.AA_detect_color_noise - Scene.AA_dark_threshold_factor - Scene.AA_variance_edge_size - Scene.AA_variance_pixels - Scene.AA_clamp_samples - Scene.AA_clamp_indirect - - Scene.pass_enable - Scene.pass_mask_obj_index - Scene.pass_mask_mat_index - Scene.pass_mask_invert - Scene.pass_mask_only - Scene.pass_Combined - Scene.pass_Depth - Scene.pass_Vector - Scene.pass_Normal - Scene.pass_UV - Scene.pass_Color - Scene.pass_Emit - Scene.pass_Mist - Scene.pass_Diffuse - Scene.pass_Spec - Scene.pass_AO - Scene.pass_Env - Scene.pass_Indirect - Scene.pass_Shadow - Scene.pass_Reflect - Scene.pass_Refract - Scene.pass_IndexOB - Scene.pass_IndexMA - Scene.pass_DiffDir - Scene.pass_DiffInd - Scene.pass_DiffCol - Scene.pass_GlossDir - Scene.pass_GlossInd - Scene.pass_GlossCol - Scene.pass_TransDir - Scene.pass_TransInd - Scene.pass_TransCol - Scene.pass_SubsurfaceDir - Scene.pass_SubsurfaceInd - Scene.pass_SubsurfaceCol + + bpy.utils.unregister_class(YafaRayNoiseControlProperties) + bpy.utils.unregister_class(YafaRayRenderPassesProperties) + bpy.utils.unregister_class(YafaRayProperties) Scene.views_lightgroup_list Scene.views_lightgroup_list_index diff --git a/ui/properties_yaf_AA_settings.py b/ui/properties_yaf_AA_settings.py index a82b4f49..0c59a36d 100644 --- a/ui/properties_yaf_AA_settings.py +++ b/ui/properties_yaf_AA_settings.py @@ -36,9 +36,9 @@ def draw(self, context): split = layout.split() col = split.column() - col.prop(scene, "AA_clamp_samples") + col.prop(scene.yafaray.noise_control, "clamp_samples") col = split.column() - col.prop(scene, "AA_clamp_indirect") + col.prop(scene.yafaray.noise_control, "clamp_indirect") split = layout.split() col = split.column() @@ -64,7 +64,7 @@ def draw(self, context): if scene.AA_passes > 1 and scene.intg_light_method != "SPPM": row.enabled = True - row.prop(scene, "AA_detect_color_noise") + row.prop(scene.yafaray.noise_control, "detect_color_noise") row = layout.row() row.enabled = False @@ -73,14 +73,14 @@ def draw(self, context): row.enabled = True col = row.column() - col.prop(scene, "AA_dark_threshold_factor") - col.prop(scene, "AA_sample_multiplier_factor") - col.prop(scene, "AA_light_sample_multiplier_factor") - col.prop(scene, "AA_indirect_sample_multiplier_factor") + col.prop(scene.yafaray.noise_control, "dark_threshold_factor") + col.prop(scene.yafaray.noise_control, "sample_multiplier_factor") + col.prop(scene.yafaray.noise_control, "light_sample_multiplier_factor") + col.prop(scene.yafaray.noise_control, "indirect_sample_multiplier_factor") col = row.column() - col.prop(scene, "AA_resampled_floor") - col.prop(scene, "AA_variance_edge_size") - col.prop(scene, "AA_variance_pixels") + col.prop(scene.yafaray.noise_control, "resampled_floor") + col.prop(scene.yafaray.noise_control, "variance_edge_size") + col.prop(scene.yafaray.noise_control, "variance_pixels") if __name__ == "__main__": # only for live edit. import bpy diff --git a/ui/properties_yaf_layer_passes.py b/ui/properties_yaf_layer_passes.py index 4c8cbb06..a8dedfec 100755 --- a/ui/properties_yaf_layer_passes.py +++ b/ui/properties_yaf_layer_passes.py @@ -123,7 +123,7 @@ class YAFRENDER_PT_layer_passes(RenderLayerButtonsPanel, Panel): def draw_header(self, context): scene = context.scene - self.layout.prop(scene, "pass_enable", text="") + self.layout.prop(scene.yafaray.passes, "pass_enable", text="") def draw(self, context): layout = self.layout @@ -135,76 +135,76 @@ def draw(self, context): #row = layout.row(align=True) #row.alignment = 'LEFT' - #row.prop(scene, "pass_enable", toggle=True) #, "optional extended description") - if scene.pass_enable: + #row.prop(scene.yafaray.passes, "pass_enable", toggle=True) #, "optional extended description") + if scene.yafaray.passes.pass_enable: row = layout.row() #(align=True) #row.alignment = 'LEFT' ##row.prop(rl, "use_pass_combined") ##if scene.render.layers[0].use_pass_combined: ## sub = row.column(align=True) - ## sub.prop(scene, "pass_combined", "") + ## sub.prop(scene.yafaray.passes, "pass_combined", "") row = layout.row() #(align=True) #row.alignment = 'LEFT' row.prop(rl, "use_pass_z") #, "Z-depth") if scene.render.layers[0].use_pass_z: sub = row.column(align=True) - sub.prop(scene, "pass_Depth", "") + sub.prop(scene.yafaray.passes, "pass_Depth", "") row = layout.row() row.prop(rl, "use_pass_vector") if scene.render.layers[0].use_pass_vector: sub = row.column(align=True) - sub.prop(scene, "pass_Vector", "") + sub.prop(scene.yafaray.passes, "pass_Vector", "") row = layout.row() row.prop(rl, "use_pass_normal") if scene.render.layers[0].use_pass_normal: sub = row.column(align=True) - sub.prop(scene, "pass_Normal", "") + sub.prop(scene.yafaray.passes, "pass_Normal", "") row = layout.row() row.prop(rl, "use_pass_uv") if scene.render.layers[0].use_pass_uv: sub = row.column(align=True) - sub.prop(scene, "pass_UV", "") + sub.prop(scene.yafaray.passes, "pass_UV", "") row = layout.row() row.prop(rl, "use_pass_color") if scene.render.layers[0].use_pass_color: sub = row.column(align=True) - sub.prop(scene, "pass_Color", "") + sub.prop(scene.yafaray.passes, "pass_Color", "") row = layout.row() row.prop(rl, "use_pass_emit") if scene.render.layers[0].use_pass_emit: sub = row.column(align=True) - sub.prop(scene, "pass_Emit", "") + sub.prop(scene.yafaray.passes, "pass_Emit", "") row = layout.row() row.prop(rl, "use_pass_mist") if scene.render.layers[0].use_pass_mist: sub = row.column(align=True) - sub.prop(scene, "pass_Mist", "") + sub.prop(scene.yafaray.passes, "pass_Mist", "") row = layout.row() row.prop(rl, "use_pass_diffuse") if scene.render.layers[0].use_pass_diffuse: sub = row.column(align=True) - sub.prop(scene, "pass_Diffuse", "") + sub.prop(scene.yafaray.passes, "pass_Diffuse", "") row = layout.row() row.prop(rl, "use_pass_specular") if scene.render.layers[0].use_pass_specular: sub = row.column(align=True) - sub.prop(scene, "pass_Spec", "") + sub.prop(scene.yafaray.passes, "pass_Spec", "") row = layout.row() row.prop(rl, "use_pass_ambient_occlusion") if scene.render.layers[0].use_pass_ambient_occlusion: sub = row.column(align=True) - sub.prop(scene, "pass_AO", "") + sub.prop(scene.yafaray.passes, "pass_AO", "") row = layout.row() col = row.column() col.prop(scene, "intg_AO_color") @@ -215,127 +215,127 @@ def draw(self, context): row.prop(rl, "use_pass_environment") if scene.render.layers[0].use_pass_environment: sub = row.column(align=True) - sub.prop(scene, "pass_Env", "") + sub.prop(scene.yafaray.passes, "pass_Env", "") row = layout.row() row.prop(rl, "use_pass_indirect") if scene.render.layers[0].use_pass_indirect: sub = row.column(align=True) - sub.prop(scene, "pass_Indirect", "") + sub.prop(scene.yafaray.passes, "pass_Indirect", "") row = layout.row() row.prop(rl, "use_pass_shadow") if scene.render.layers[0].use_pass_shadow: sub = row.column(align=True) - sub.prop(scene, "pass_Shadow", "") + sub.prop(scene.yafaray.passes, "pass_Shadow", "") row = layout.row() row.prop(rl, "use_pass_reflection") if scene.render.layers[0].use_pass_reflection: sub = row.column(align=True) - sub.prop(scene, "pass_Reflect", "") + sub.prop(scene.yafaray.passes, "pass_Reflect", "") row = layout.row() row.prop(rl, "use_pass_refraction") if scene.render.layers[0].use_pass_refraction: sub = row.column(align=True) - sub.prop(scene, "pass_Refract", "") + sub.prop(scene.yafaray.passes, "pass_Refract", "") row = layout.row() row.prop(rl, "use_pass_object_index") if scene.render.layers[0].use_pass_object_index: sub = row.column(align=True) - sub.prop(scene, "pass_IndexOB", "") + sub.prop(scene.yafaray.passes, "pass_IndexOB", "") row = layout.row() row.prop(rl, "use_pass_material_index") if scene.render.layers[0].use_pass_material_index: sub = row.column(align=True) - sub.prop(scene, "pass_IndexMA", "") + sub.prop(scene.yafaray.passes, "pass_IndexMA", "") row = layout.row() row.prop(rl, "use_pass_diffuse_direct") if scene.render.layers[0].use_pass_diffuse_direct: sub = row.column(align=True) - sub.prop(scene, "pass_DiffDir", "") + sub.prop(scene.yafaray.passes, "pass_DiffDir", "") row = layout.row() row.prop(rl, "use_pass_diffuse_indirect") if scene.render.layers[0].use_pass_diffuse_indirect: sub = row.column(align=True) - sub.prop(scene, "pass_DiffInd", "") + sub.prop(scene.yafaray.passes, "pass_DiffInd", "") row = layout.row() row.prop(rl, "use_pass_diffuse_color") if scene.render.layers[0].use_pass_diffuse_color: sub = row.column(align=True) - sub.prop(scene, "pass_DiffCol", "") + sub.prop(scene.yafaray.passes, "pass_DiffCol", "") row = layout.row() row.prop(rl, "use_pass_glossy_direct") if scene.render.layers[0].use_pass_glossy_direct: sub = row.column(align=True) - sub.prop(scene, "pass_GlossDir", "") + sub.prop(scene.yafaray.passes, "pass_GlossDir", "") row = layout.row() row.prop(rl, "use_pass_glossy_indirect") if scene.render.layers[0].use_pass_glossy_indirect: sub = row.column(align=True) - sub.prop(scene, "pass_GlossInd", "") + sub.prop(scene.yafaray.passes, "pass_GlossInd", "") row = layout.row() row.prop(rl, "use_pass_glossy_color") if scene.render.layers[0].use_pass_glossy_color: sub = row.column(align=True) - sub.prop(scene, "pass_GlossCol", "") + sub.prop(scene.yafaray.passes, "pass_GlossCol", "") row = layout.row() row.prop(rl, "use_pass_transmission_direct") if scene.render.layers[0].use_pass_transmission_direct: sub = row.column(align=True) - sub.prop(scene, "pass_TransDir", "") + sub.prop(scene.yafaray.passes, "pass_TransDir", "") row = layout.row() row.prop(rl, "use_pass_transmission_indirect") if scene.render.layers[0].use_pass_transmission_indirect: sub = row.column(align=True) - sub.prop(scene, "pass_TransInd", "") + sub.prop(scene.yafaray.passes, "pass_TransInd", "") row = layout.row() row.prop(rl, "use_pass_transmission_color") if scene.render.layers[0].use_pass_transmission_color: sub = row.column(align=True) - sub.prop(scene, "pass_TransCol", "") + sub.prop(scene.yafaray.passes, "pass_TransCol", "") row = layout.row() row.prop(rl, "use_pass_subsurface_direct") if scene.render.layers[0].use_pass_subsurface_direct: sub = row.column(align=True) - sub.prop(scene, "pass_SubsurfaceDir", "") + sub.prop(scene.yafaray.passes, "pass_SubsurfaceDir", "") row = layout.row() row.prop(rl, "use_pass_subsurface_indirect") if scene.render.layers[0].use_pass_subsurface_indirect: sub = row.column(align=True) - sub.prop(scene, "pass_SubsurfaceInd", "") + sub.prop(scene.yafaray.passes, "pass_SubsurfaceInd", "") row = layout.row() row.prop(rl, "use_pass_subsurface_color") if scene.render.layers[0].use_pass_subsurface_color: sub = row.column(align=True) - sub.prop(scene, "pass_SubsurfaceCol", "") + sub.prop(scene.yafaray.passes, "pass_SubsurfaceCol", "") row = layout.row() - row.prop(scene, "pass_mask_obj_index") + row.prop(scene.yafaray.passes, "pass_mask_obj_index") sub = row.column(align=True) - sub.prop(scene, "pass_mask_mat_index") + sub.prop(scene.yafaray.passes, "pass_mask_mat_index") row = layout.row() - row.prop(scene, "pass_mask_invert") + row.prop(scene.yafaray.passes, "pass_mask_invert") sub = row.column(align=True) - sub.prop(scene, "pass_mask_only") + sub.prop(scene.yafaray.passes, "pass_mask_only") class YAFRENDER_PT_views(RenderLayerButtonsPanel, Panel): From e11ee326505bdd6be4869c03db0a74d9e3dc1f9e Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 28 Nov 2015 10:34:22 +0000 Subject: [PATCH 43/81] Separate Views - Lightgroups to the new yafaray.passes grouped class --- io/yaf_object.py | 4 ++-- prop/yaf_scene.py | 4 ++-- ui/properties_yaf_layer_passes.py | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/io/yaf_object.py b/io/yaf_object.py index 5c62e9cb..ee598ab3 100644 --- a/io/yaf_object.py +++ b/io/yaf_object.py @@ -65,13 +65,13 @@ def __init__ (self, camera, view, light_group): else: camera_base_name = camera_scene.name.rsplit('_',1)[0] - if len(self.scene.views_lightgroup_list) == 0: + if len(self.scene.yafaray.passes.views_lightgroup_list) == 0: for view in render.views: if view.use: view_lightgroup_camera_data_list.append(viewLightGroupCameraData(self.scene.objects[camera_base_name+view.camera_suffix], view, 0)) else: - for view_lightgroup in self.scene.views_lightgroup_list: + for view_lightgroup in self.scene.yafaray.passes.views_lightgroup_list: if view_lightgroup.view_number < len(self.scene.render.views) and self.scene.render.views[view_lightgroup.view_number].use: view_lightgroup_camera_data_list.append(viewLightGroupCameraData(self.scene.objects[camera_base_name+self.scene.render.views[view_lightgroup.view_number].camera_suffix], self.scene.render.views[view_lightgroup.view_number], view_lightgroup.light_group)) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 2215e56f..e2027b26 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -851,8 +851,8 @@ def register(): bpy.utils.register_class(ViewsLightGroupList) - Scene.views_lightgroup_list = CollectionProperty(type = ViewsLightGroupList) - Scene.views_lightgroup_list_index = IntProperty(name = "Index for the Views Light Group List", default = -1) + YafaRayRenderPassesProperties.views_lightgroup_list = CollectionProperty(type = ViewsLightGroupList) + YafaRayRenderPassesProperties.views_lightgroup_list_index = IntProperty(name = "Index for the Views Light Group List", default = -1) def unregister(): diff --git a/ui/properties_yaf_layer_passes.py b/ui/properties_yaf_layer_passes.py index a8dedfec..46c629ce 100755 --- a/ui/properties_yaf_layer_passes.py +++ b/ui/properties_yaf_layer_passes.py @@ -52,7 +52,7 @@ class ViewsLightGroupList_OT_NewItem(bpy.types.Operator): COMPAT_ENGINES = {'YAFA_RENDER'} def execute(self, context): - context.scene.views_lightgroup_list.add() + context.scene.yafaray.passes.views_lightgroup_list.add() return{'FINISHED'} @@ -65,11 +65,11 @@ class ViewsLightGroupList_OT_DeleteItem(bpy.types.Operator): @classmethod def poll(self, context): - return len(context.scene.views_lightgroup_list) > 0 + return len(context.scene.yafaray.passes.views_lightgroup_list) > 0 def execute(self, context): - list = context.scene.views_lightgroup_list - index = context.scene.views_lightgroup_list_index + list = context.scene.yafaray.passes.views_lightgroup_list + index = context.scene.yafaray.passes.views_lightgroup_list_index list.remove(index) @@ -382,17 +382,17 @@ def draw(self, context): row = layout.row() row.label(text="Views - Light Group filters:") - if len(scene.views_lightgroup_list) == 0: + if len(scene.yafaray.passes.views_lightgroup_list) == 0: row = layout.row() row.label(icon="INFO", text="No views/light group filters defined.") row = layout.row() row.label(icon="INFO", text="By default all views will be rendered with all lights.") row = layout.row() - row.template_list("ViewsLightGroupList_UL_List", "ViewsLightGroupList", scene, "views_lightgroup_list", scene, "views_lightgroup_list_index", rows=2) + row.template_list("ViewsLightGroupList_UL_List", "ViewsLightGroupList", scene.yafaray.passes, "views_lightgroup_list", scene.yafaray.passes, "views_lightgroup_list_index", rows=2) col = row.column(align=True) col.operator('views_lightgroup_list.new_item', icon='ZOOMIN', text="") col.operator('views_lightgroup_list.delete_item', icon='ZOOMOUT', text="") - if len(scene.views_lightgroup_list) > 0: + if len(scene.yafaray.passes.views_lightgroup_list) > 0: row = layout.row() row.label(icon="INFO", text="Only the selected views with the assigned light groups will be rendered") row = layout.row() From 86f08e706cd35f9bf91dcb89573344142d2bf255 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sun, 29 Nov 2015 07:55:31 +0000 Subject: [PATCH 44/81] Allow to use almost any internal pass in any external pass Changes to be committed: modified: prop/yaf_scene.py --- prop/yaf_scene.py | 50 +++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index e2027b26..8084c161 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -241,56 +241,56 @@ class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): pass_Vector = EnumProperty( name="Vector", #RGBA (4 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO+renderPassItemsDepth+renderPassItemsAO ), default="obj-index-auto") pass_Normal = EnumProperty( name="Normal", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="debug-normal-smooth") pass_UV = EnumProperty( name="UV", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="debug-uv") pass_Color = EnumProperty( name="Color", #RGBA (4 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="mat-index-auto") pass_Emit = EnumProperty( name="Emit", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="emit") pass_Mist = EnumProperty( name="Mist", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="mist") pass_Diffuse = EnumProperty( name="Diffuse", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="diffuse") pass_Spec = EnumProperty( name="Spec", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-reflect") @@ -304,35 +304,35 @@ class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): pass_Env = EnumProperty( name="Env", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="env") pass_Indirect = EnumProperty( name="Indirect", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="indirect") pass_Shadow = EnumProperty( name="Shadow", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="shadow") pass_Reflect = EnumProperty( name="Reflect", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="reflect") pass_Refract = EnumProperty( name="Refract", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="refract") @@ -353,84 +353,84 @@ class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): pass_DiffDir = EnumProperty( name="Diff Dir", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="diffuse") pass_DiffInd = EnumProperty( name="Diff Ind", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-diffuse-indirect") pass_DiffCol = EnumProperty( name="Diff Col", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-diffuse-color") pass_GlossDir = EnumProperty( name="Gloss Dir", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-glossy") pass_GlossInd = EnumProperty( name="Gloss Ind", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-glossy-indirect") pass_GlossCol = EnumProperty( name="Gloss Col", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-glossy-color") pass_TransDir = EnumProperty( name="Trans Dir", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-trans") pass_TransInd = EnumProperty( name="Trans Ind", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-trans-indirect") pass_TransCol = EnumProperty( name="Trans Col", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-trans-color") pass_SubsurfaceDir = EnumProperty( name="SubSurface Dir", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-subsurface") pass_SubsurfaceInd = EnumProperty( name="SubSurface Ind", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-subsurface-indirect") pass_SubsurfaceCol = EnumProperty( name="SubSurface Col", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass.", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug + items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-subsurface-color") From 02a5b6e0c93251a609eec63610c1b02548335e8c Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sun, 6 Dec 2015 18:19:01 +0000 Subject: [PATCH 45/81] Added Exporter support for PNG optimized RAM usage, pending 16bit support and other formats --- io/yaf_texture.py | 1 + prop/yaf_texture.py | 7 ++++++- ui/properties_yaf_texture.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/io/yaf_texture.py b/io/yaf_texture.py index 6819318b..692464d0 100755 --- a/io/yaf_texture.py +++ b/io/yaf_texture.py @@ -336,6 +336,7 @@ def writeTexture(self, scene, tex): yi.printInfo("Exporter: Creating Texture: '{0}' type {1}: {2}. Texture Color Space: '{3}', gamma={4}".format(name, tex.yaf_tex_type, image_tex, texture_color_space, texture_gamma)) yi.paramsSetString("interpolate", tex.yaf_tex_interpolate) + yi.paramsSetBool("optimized_texture", tex.yaf_tex_optimize) # repeat repeat_x = 1 diff --git a/prop/yaf_texture.py b/prop/yaf_texture.py index 5922d80b..2d4fdc63 100755 --- a/prop/yaf_texture.py +++ b/prop/yaf_texture.py @@ -76,7 +76,11 @@ def register(): ('none', "No interpolation", "") ), default='bilinear') - + + Texture.yaf_tex_optimize = BoolProperty( + name="Optimize", + description="Optimize texture for reduced RAM usage at the cost of being slower", + default=False) def unregister(): Texture.yaf_tex_type @@ -84,3 +88,4 @@ def unregister(): Texture.yaf_use_alpha Texture.yaf_gamma_input Texture.yaf_tex_interpolate + Texture.yaf_optimize diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index 4af98007..d0871226 100755 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -303,10 +303,10 @@ def draw(self, context): row.prop(tex, "use_calculate_alpha", text="Calculate Alpha") layout.prop(tex, "use_flip_axis", text="Flip X/Y Axis") layout.prop(tex, "yaf_tex_interpolate") - else: row.prop(tex, "use_interpolation", text="Use image background interpolation") #row.prop(tex, "use_calculate_alpha", text="Calculate Alpha") + layout.prop(tex, "yaf_tex_optimize") class YAF_TEXTURE_PT_image_mapping(YAF_TextureTypePanel, Panel): From dab651f3e8dcd7b280a9e7f14e77cebd3d016d87 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Tue, 8 Dec 2015 21:57:03 +0000 Subject: [PATCH 46/81] Added options for texture optimization, crashing now and pending the other optimization implementations --- io/yaf_texture.py | 4 ++-- prop/yaf_texture.py | 16 +++++++++++----- ui/properties_yaf_texture.py | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/io/yaf_texture.py b/io/yaf_texture.py index 692464d0..3a7f61cf 100755 --- a/io/yaf_texture.py +++ b/io/yaf_texture.py @@ -333,10 +333,10 @@ def writeTexture(self, scene, tex): yi.paramsSetString("color_space", texture_color_space) yi.paramsSetFloat("gamma", texture_gamma) - yi.printInfo("Exporter: Creating Texture: '{0}' type {1}: {2}. Texture Color Space: '{3}', gamma={4}".format(name, tex.yaf_tex_type, image_tex, texture_color_space, texture_gamma)) + yi.printInfo("Exporter: Creating Texture: '{0}' type {1}: {2}. Texture Color Space: '{3}', gamma={4}. Texture optimization='{5}'".format(name, tex.yaf_tex_type, image_tex, texture_color_space, texture_gamma, tex.yaf_tex_optimization)) yi.paramsSetString("interpolate", tex.yaf_tex_interpolate) - yi.paramsSetBool("optimized_texture", tex.yaf_tex_optimize) + yi.paramsSetString("texture_optimization", tex.yaf_tex_optimization) # repeat repeat_x = 1 diff --git a/prop/yaf_texture.py b/prop/yaf_texture.py index 2d4fdc63..93156327 100755 --- a/prop/yaf_texture.py +++ b/prop/yaf_texture.py @@ -77,10 +77,16 @@ def register(): ), default='bilinear') - Texture.yaf_tex_optimize = BoolProperty( - name="Optimize", - description="Optimize texture for reduced RAM usage at the cost of being slower", - default=False) + Texture.yaf_tex_optimization = EnumProperty( + name="Optimization", + description="Texture optimization for reduced RAM usage at the cost of being slower/lossy", + items=( + ('compress-rgb565', "Compressed RGB565", "Lossy compression removing alpha, smaller RAM usage."), + ('basic-noalpha', "Basic/No Alpha", "Like Basic but removing the alpha channel, less RAM usage."), + ('basic', "Basic", "Basic optimization, lossless, a bit slower, moderate RAM usage."), + ('none', "None", "No optimization, lossless and faster but high RAM usage") + ), + default='basic') def unregister(): Texture.yaf_tex_type @@ -88,4 +94,4 @@ def unregister(): Texture.yaf_use_alpha Texture.yaf_gamma_input Texture.yaf_tex_interpolate - Texture.yaf_optimize + Texture.yaf_tex_optimization diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index d0871226..4b2d96d2 100755 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -306,7 +306,7 @@ def draw(self, context): else: row.prop(tex, "use_interpolation", text="Use image background interpolation") #row.prop(tex, "use_calculate_alpha", text="Calculate Alpha") - layout.prop(tex, "yaf_tex_optimize") + layout.prop(tex, "yaf_tex_optimization") class YAF_TEXTURE_PT_image_mapping(YAF_TextureTypePanel, Panel): From 33a855fb8e9be10d649fc3a381268c490fdb9b90 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 11 Dec 2015 04:13:15 +0000 Subject: [PATCH 47/81] fixing crashes, setting up renderPasses at environment level --- io/yaf_export.py | 12 ++++++++++-- io/yaf_scene.py | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/io/yaf_export.py b/io/yaf_export.py index e990e0a4..d4106ac3 100755 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -313,6 +313,9 @@ def update(self, data, scene): if scene.gs_type_render == "file": self.setInterface(yafrayinterface.yafrayInterface_t()) + self.yi.startScene() + yaf_scene.exportRenderPassesSettings(self.yi, self.scene) + self.yi.setupRenderPasses() self.yi.setInputColorSpace("LinearRGB", 1.0) #When rendering into Blender, color picker floating point data is already linear (linearized by Blender) self.outputFile, self.output, self.file_type = self.decideOutputFileName(fp, scene.img_output) self.yi.paramsClearAll() @@ -326,7 +329,10 @@ def update(self, data, scene): elif scene.gs_type_render == "xml": self.setInterface(yafrayinterface.xmlInterface_t()) - + self.yi.startScene() + yaf_scene.exportRenderPassesSettings(self.yi, self.scene) + self.yi.setupRenderPasses() + input_color_values_color_space = "sRGB" input_color_values_gamma = 1.0 @@ -350,9 +356,11 @@ def update(self, data, scene): else: self.setInterface(yafrayinterface.yafrayInterface_t()) + self.yi.startScene() + yaf_scene.exportRenderPassesSettings(self.yi, self.scene) + self.yi.setupRenderPasses() self.yi.setInputColorSpace("LinearRGB", 1.0) #When rendering into Blender, color picker floating point data is already linear (linearized by Blender) - self.yi.startScene() self.exportScene() self.yaf_integrator.exportIntegrator(self.scene) self.yaf_integrator.exportVolumeIntegrator(self.scene) diff --git a/io/yaf_scene.py b/io/yaf_scene.py index 6472dd8e..1ed134a6 100755 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -172,6 +172,10 @@ def exportRenderSettings(yi, scene): yi.paramsSetBool("adv_auto_min_raydist_enabled", scene.adv_auto_min_raydist_enabled) yi.paramsSetFloat("adv_min_raydist_value", scene.adv_min_raydist_value) + +def exportRenderPassesSettings(yi, scene): + yi.printInfo("Exporting Render Passes settings") + yi.paramsSetBool("pass_enable", scene.yafaray.passes.pass_enable) yi.paramsSetInt("pass_mask_obj_index", scene.yafaray.passes.pass_mask_obj_index) From f3177a9d4348bb55578ca4012081474e4d1504fd Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 11 Dec 2015 05:11:26 +0000 Subject: [PATCH 48/81] fixed xml filename export --- io/yaf_export.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io/yaf_export.py b/io/yaf_export.py index d4106ac3..eb6ab5c4 100755 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -329,6 +329,8 @@ def update(self, data, scene): elif scene.gs_type_render == "xml": self.setInterface(yafrayinterface.xmlInterface_t()) + self.outputFile, self.output, self.file_type = self.decideOutputFileName(fp, 'XML') + self.yi.setOutfile(self.outputFile) self.yi.startScene() yaf_scene.exportRenderPassesSettings(self.yi, self.scene) self.yi.setupRenderPasses() @@ -349,10 +351,8 @@ def update(self, data, scene): self.yi.setInputColorSpace("LinearRGB", 1.0) #Values from Blender, color picker floating point data are already linear (linearized by Blender) self.yi.setXMLColorSpace(input_color_values_color_space, input_color_values_gamma) #To set the XML interface to write the XML values with the correction included for the selected color space (and gamma if applicable) - self.outputFile, self.output, self.file_type = self.decideOutputFileName(fp, 'XML') self.yi.paramsClearAll() self.co = yafrayinterface.imageOutput_t() - self.yi.setOutfile(self.outputFile) else: self.setInterface(yafrayinterface.yafrayInterface_t()) From ba6ebfe9a00641a3c9199eef79dc8fc4f255e51c Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 12 Dec 2015 09:04:36 +0000 Subject: [PATCH 49/81] Added global texture optimization parameter that can be overriden by per-texture settings --- io/yaf_texture.py | 9 +++++++-- prop/yaf_scene.py | 12 ++++++++++++ prop/yaf_texture.py | 5 +++-- ui/properties_yaf_general_settings.py | 6 +++++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/io/yaf_texture.py b/io/yaf_texture.py index 3a7f61cf..b925eaa6 100755 --- a/io/yaf_texture.py +++ b/io/yaf_texture.py @@ -333,10 +333,15 @@ def writeTexture(self, scene, tex): yi.paramsSetString("color_space", texture_color_space) yi.paramsSetFloat("gamma", texture_gamma) - yi.printInfo("Exporter: Creating Texture: '{0}' type {1}: {2}. Texture Color Space: '{3}', gamma={4}. Texture optimization='{5}'".format(name, tex.yaf_tex_type, image_tex, texture_color_space, texture_gamma, tex.yaf_tex_optimization)) + if tex.yaf_tex_optimization == "default": + texture_optimization = scene.gs_tex_optimization + else: + texture_optimization = tex.yaf_tex_optimization + + yi.printInfo("Exporter: Creating Texture: '{0}' type {1}: {2}. Texture Color Space: '{3}', gamma={4}. Texture optimization='{5}'".format(name, tex.yaf_tex_type, image_tex, texture_color_space, texture_gamma, texture_optimization)) yi.paramsSetString("interpolate", tex.yaf_tex_interpolate) - yi.paramsSetString("texture_optimization", tex.yaf_tex_optimization) + yi.paramsSetString("texture_optimization", texture_optimization) # repeat repeat_x = 1 diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 8084c161..1848f4bb 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -610,6 +610,17 @@ def register(): ), default='into_blender') + Scene.gs_tex_optimization = EnumProperty( + name="Textures optimization", + description="Textures optimization for reduced RAM usage at the cost of being slower/lossy. Can be set per-texture as well.", + items=( + ('compress-rgb565', "Compressed RGB565", "Lossy compression removing alpha, smaller RAM usage."), + ('basic-noalpha', "Basic/No Alpha", "Like Basic but removing the alpha channel, less RAM usage."), + ('basic', "Basic", "Basic optimization, lossless, a bit slower, moderate RAM usage."), + ('none', "None", "No optimization, lossless and faster but high RAM usage") + ), + default='none') + ######### YafaRays own image output property ############ Scene.img_output = EnumProperty( name="Image File Type", @@ -884,6 +895,7 @@ def unregister(): Scene.gs_show_sam_pix Scene.gs_verbose Scene.gs_type_render + Scene.gs_tex_optimization Scene.img_output Scene.img_multilayer diff --git a/prop/yaf_texture.py b/prop/yaf_texture.py index 93156327..c4162003 100755 --- a/prop/yaf_texture.py +++ b/prop/yaf_texture.py @@ -84,9 +84,10 @@ def register(): ('compress-rgb565', "Compressed RGB565", "Lossy compression removing alpha, smaller RAM usage."), ('basic-noalpha', "Basic/No Alpha", "Like Basic but removing the alpha channel, less RAM usage."), ('basic', "Basic", "Basic optimization, lossless, a bit slower, moderate RAM usage."), - ('none', "None", "No optimization, lossless and faster but high RAM usage") + ('none', "None", "No optimization, lossless and faster but high RAM usage"), + ('default', "Default", "Use global texture optimization setting from the Render tab") ), - default='basic') + default='default') def unregister(): Texture.yaf_tex_type diff --git a/ui/properties_yaf_general_settings.py b/ui/properties_yaf_general_settings.py index 126bb5e4..8dd2785a 100755 --- a/ui/properties_yaf_general_settings.py +++ b/ui/properties_yaf_general_settings.py @@ -73,16 +73,20 @@ def draw(self, context): layout.separator() + split = layout.split() + col = split.column() + col.prop(scene, "gs_tex_optimization") + split = layout.split() col = split.column() col.prop(scene, "gs_transp_shad", toggle=True) col.prop(scene, "gs_draw_params", toggle=True) + col.prop(scene, "gs_verbose", toggle=True) col = split.column() col.prop(scene, "gs_auto_threads", toggle=True) col.prop(scene, "gs_show_sam_pix", toggle=True) col.prop(render, "use_instances", text="Use instances", toggle=True) - col.prop(scene, "gs_verbose", toggle=True) split = layout.split(percentage=0.5) col = split.column() From 9eb983765aefb7b99555b35592c68e353356bf7b Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 12 Dec 2015 19:59:39 +0000 Subject: [PATCH 50/81] Refactoring of texture optimization to make it more clear, simple and automated --- prop/yaf_scene.py | 11 +++++------ prop/yaf_texture.py | 7 +++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 1848f4bb..19463b4f 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -611,16 +611,15 @@ def register(): default='into_blender') Scene.gs_tex_optimization = EnumProperty( - name="Textures optimization", - description="Textures optimization for reduced RAM usage at the cost of being slower/lossy. Can be set per-texture as well.", + name="Optimization", + description="Texture optimization to reduce RAM usage", items=( - ('compress-rgb565', "Compressed RGB565", "Lossy compression removing alpha, smaller RAM usage."), - ('basic-noalpha', "Basic/No Alpha", "Like Basic but removing the alpha channel, less RAM usage."), - ('basic', "Basic", "Basic optimization, lossless, a bit slower, moderate RAM usage."), + ('compressed', "Compressed", "Lossy color compression, some color/transparency details will be lost, more RAM improvement"), + ('optimized', "Optimized", "Lossless optimization, good RAM improvement"), ('none', "None", "No optimization, lossless and faster but high RAM usage") ), default='none') - + ######### YafaRays own image output property ############ Scene.img_output = EnumProperty( name="Image File Type", diff --git a/prop/yaf_texture.py b/prop/yaf_texture.py index c4162003..e131388a 100755 --- a/prop/yaf_texture.py +++ b/prop/yaf_texture.py @@ -79,11 +79,10 @@ def register(): Texture.yaf_tex_optimization = EnumProperty( name="Optimization", - description="Texture optimization for reduced RAM usage at the cost of being slower/lossy", + description="Texture optimization to reduce RAM usage", items=( - ('compress-rgb565', "Compressed RGB565", "Lossy compression removing alpha, smaller RAM usage."), - ('basic-noalpha', "Basic/No Alpha", "Like Basic but removing the alpha channel, less RAM usage."), - ('basic', "Basic", "Basic optimization, lossless, a bit slower, moderate RAM usage."), + ('compressed', "Compressed", "Lossy color compression, some color/transparency details will be lost, more RAM improvement"), + ('optimized', "Optimized", "Lossless optimization, good RAM improvement"), ('none', "None", "No optimization, lossless and faster but high RAM usage"), ('default', "Default", "Use global texture optimization setting from the Render tab") ), From 718791c89ab97a3873a018c029b7159e4d2e4536 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 12 Dec 2015 21:40:45 +0000 Subject: [PATCH 51/81] Small text/description change in global texture optimization setting --- prop/yaf_scene.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 19463b4f..91c83fd9 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -611,8 +611,8 @@ def register(): default='into_blender') Scene.gs_tex_optimization = EnumProperty( - name="Optimization", - description="Texture optimization to reduce RAM usage", + name="Textures optimization", + description="Textures optimization to reduce RAM usage, can be overriden by per-texture setting", items=( ('compressed', "Compressed", "Lossy color compression, some color/transparency details will be lost, more RAM improvement"), ('optimized', "Optimized", "Lossless optimization, good RAM improvement"), From 71f2d24ab11c8ce104fb79a9ebf024ec6eb48c38 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Wed, 23 Dec 2015 10:06:36 +0100 Subject: [PATCH 52/81] tests light groups views ui --- prop/yaf_light.py | 7 +++++++ prop/yaf_object.py | 9 ++++++++- prop/yaf_scene.py | 5 +++++ ui/properties_yaf_layer_passes.py | 1 + ui/properties_yaf_light.py | 13 +++++++++++++ ui/properties_yaf_object.py | 1 + 6 files changed, 35 insertions(+), 1 deletion(-) diff --git a/prop/yaf_light.py b/prop/yaf_light.py index 4fff606b..f44a0b1b 100644 --- a/prop/yaf_light.py +++ b/prop/yaf_light.py @@ -151,6 +151,12 @@ def register(): min=1, max=100, default=1) + Lamp.light_group_name = StringProperty( #FIXME DAVID + name="Light Group Name", + description="Light Group name for Light Group render filtering", + default="") + + def unregister(): del Lamp.lamp_type del Lamp.yaf_energy @@ -169,3 +175,4 @@ def unregister(): del Lamp.light_enabled del Lamp.cast_shadows del Lamp.light_group + del Lamp.light_group_name diff --git a/prop/yaf_object.py b/prop/yaf_object.py index 006d8df7..badc75e1 100644 --- a/prop/yaf_object.py +++ b/prop/yaf_object.py @@ -23,7 +23,8 @@ FloatProperty, IntProperty, BoolProperty, - EnumProperty) + EnumProperty, + StringProperty) Object = bpy.types.Object @@ -66,6 +67,11 @@ def register(): min=1, max=100, default=1) + Object.ml_light_group_name = StringProperty( #FIXME DAVID + name="Light Group Name", + description="Light Group name for Light Group render filtering", + default="") + Object.bgp_enable = BoolProperty( name="Enable BG portal light", description="BG Portal Light Settings", @@ -169,6 +175,7 @@ def unregister(): del Object.ml_samples del Object.ml_double_sided del Object.ml_light_group + del Object.ml_light_group_name del Object.bgp_enable del Object.bgp_power del Object.bgp_samples diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 91c83fd9..97e3c72c 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -449,6 +449,11 @@ class ViewsLightGroupList(bpy.types.PropertyGroup): min=0, max=100) + light_group_name = StringProperty( #FIXME DAVID + name="Light Group Name", + description="Light Group name for Light Group render filtering", + default="") + def register(): ########### YafaRays general settings properties ############# diff --git a/ui/properties_yaf_layer_passes.py b/ui/properties_yaf_layer_passes.py index 46c629ce..10b61c83 100755 --- a/ui/properties_yaf_layer_passes.py +++ b/ui/properties_yaf_layer_passes.py @@ -36,6 +36,7 @@ def draw_item(self, context, layout, data, item, icon, active_data, active_propn layout.label(context.scene.render.views[item.view_number].name) layout.label("", icon = 'LAMP') layout.prop(item, "light_group") + layout.prop(item, "light_group_name") else: layout.label("", icon = 'ERROR') layout.label("View not defined, skipping.") diff --git a/ui/properties_yaf_light.py b/ui/properties_yaf_light.py index 743a3733..735fe882 100644 --- a/ui/properties_yaf_light.py +++ b/ui/properties_yaf_light.py @@ -18,6 +18,7 @@ # +import bpy from bpy.types import Panel from bl_ui.properties_data_lamp import DataButtonsPanel @@ -51,9 +52,21 @@ def draw(self, context): lamp = context.lamp + for la in bpy.data.lamps: + print(la.color) + + pepe = ["ajo", "agua", "zanahoria", "agua", "ajo"] + pepe = list(set(pepe)) + pepe.sort() + for p in pepe: + print(p) + pepe2 = "ajo2" + layout.prop(lamp, "lamp_type", expand=True) layout.prop(lamp, "light_enabled") layout.prop(lamp, "light_group") + layout.prop(lamp, "light_group_name") + layout.prop_search(lamp, "light_group_name", bpy.data, "groups") if lamp.lamp_type == "area": layout.prop(lamp, "color") diff --git a/ui/properties_yaf_object.py b/ui/properties_yaf_object.py index 0f7a2b6f..a892337d 100644 --- a/ui/properties_yaf_object.py +++ b/ui/properties_yaf_object.py @@ -43,6 +43,7 @@ def draw(self, context): if ob.ml_enable: col = layout.column(align=True) col.prop(ob, "ml_light_group") + col.prop(ob, "ml_light_group_name") col.prop(ob, "ml_color") col.prop(ob, "ml_power") layout.prop(ob, "ml_samples") From c1099cb6b2e3cfeafb321d2916a3067164d47682 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Thu, 24 Dec 2015 13:54:27 +0100 Subject: [PATCH 53/81] Light Groups more changes, still broken --- io/yaf_light.py | 2 ++ io/yaf_object.py | 18 +++++++++--------- ui/properties_yaf_light.py | 17 +++++++++-------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/io/yaf_light.py b/io/yaf_light.py index 9ff0648e..1c33e398 100644 --- a/io/yaf_light.py +++ b/io/yaf_light.py @@ -242,5 +242,7 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetBool("cast_shadows", lamp.cast_shadows) yi.paramsSetInt("light_group", lamp.light_group) yi.createLight(name) + yi.addLightGroup(name, lamp.light_group_name) #FIXME DAVID + yi.addLightGroup(name, "ajolioli") #FIXME DAVID return True diff --git a/io/yaf_object.py b/io/yaf_object.py index ee598ab3..e0e2548e 100644 --- a/io/yaf_object.py +++ b/io/yaf_object.py @@ -52,15 +52,15 @@ def createCameras(self): render = self.scene.render class viewLightGroupCameraData: - def __init__ (self, camera, view, light_group): + def __init__ (self, camera, view, light_group_name): self.camera = camera self.view = view - self.light_group = light_group + self.light_group_name = light_group_name view_lightgroup_camera_data_list = [] if bpy.types.YAFA_RENDER.useViewToRender or not render.use_multiview: - view_lightgroup_camera_data_list.append(viewLightGroupCameraData(camera_scene, None, 0)) + view_lightgroup_camera_data_list.append(viewLightGroupCameraData(camera_scene, None, "")) else: camera_base_name = camera_scene.name.rsplit('_',1)[0] @@ -68,12 +68,12 @@ def __init__ (self, camera, view, light_group): if len(self.scene.yafaray.passes.views_lightgroup_list) == 0: for view in render.views: if view.use: - view_lightgroup_camera_data_list.append(viewLightGroupCameraData(self.scene.objects[camera_base_name+view.camera_suffix], view, 0)) + view_lightgroup_camera_data_list.append(viewLightGroupCameraData(self.scene.objects[camera_base_name+view.camera_suffix], view, "")) else: for view_lightgroup in self.scene.yafaray.passes.views_lightgroup_list: if view_lightgroup.view_number < len(self.scene.render.views) and self.scene.render.views[view_lightgroup.view_number].use: - view_lightgroup_camera_data_list.append(viewLightGroupCameraData(self.scene.objects[camera_base_name+self.scene.render.views[view_lightgroup.view_number].camera_suffix], self.scene.render.views[view_lightgroup.view_number], view_lightgroup.light_group)) + view_lightgroup_camera_data_list.append(viewLightGroupCameraData(self.scene.objects[camera_base_name+self.scene.render.views[view_lightgroup.view_number].camera_suffix], self.scene.render.views[view_lightgroup.view_number], view_lightgroup.light_group_name)) for view_lightgroup_camera_data in view_lightgroup_camera_data_list: @@ -81,10 +81,10 @@ def __init__ (self, camera, view, light_group): camera_name = "3D viewport" elif view_lightgroup_camera_data.view == None: camera_name = view_lightgroup_camera_data.camera.name - elif view_lightgroup_camera_data.light_group == 0: + elif view_lightgroup_camera_data.light_group_name == "": camera_name = view_lightgroup_camera_data.camera.name+" ("+view_lightgroup_camera_data.view.name+")" else: - camera_name = view_lightgroup_camera_data.camera.name+" ("+view_lightgroup_camera_data.view.name+", LG "+str(view_lightgroup_camera_data.light_group)+")" + camera_name = view_lightgroup_camera_data.camera.name+" ("+view_lightgroup_camera_data.view.name+", LG "+str(view_lightgroup_camera_data.light_group_name)+")" #FIXME DAVID CHECK THE GROUP NAME DOES NOT CAUSE PROBLEMS, LIMIT CHARACTERS? if bpy.types.YAFA_RENDER.useViewToRender and bpy.types.YAFA_RENDER.viewMatrix: # use the view matrix to calculate the inverted transformed @@ -124,7 +124,7 @@ def __init__ (self, camera, view, light_group): yi.paramsSetString("view_name", view_lightgroup_camera_data.view.name) else: yi.paramsSetString("view_name", "") - yi.paramsSetInt("light_group_filter", view_lightgroup_camera_data.light_group) + yi.paramsSetString("light_group_filter_name", view_lightgroup_camera_data.light_group_name) if bpy.types.YAFA_RENDER.useViewToRender: yi.paramsSetString("type", "perspective") @@ -319,7 +319,7 @@ def writeMeshLight(self, obj, matrix): c = obj.ml_color self.yi.paramsSetColor("color", c[0], c[1], c[2]) self.yi.paramsSetFloat("power", obj.ml_power) - self.yi.paramsSetInt("light_group", obj.ml_light_group) + self.yi.paramsSetString("light_group_name", obj.ml_light_group_name) ml_mat = self.yi.createMaterial(ml_matname) self.materialMap[ml_matname] = ml_mat diff --git a/ui/properties_yaf_light.py b/ui/properties_yaf_light.py index 735fe882..1559df3b 100644 --- a/ui/properties_yaf_light.py +++ b/ui/properties_yaf_light.py @@ -52,15 +52,16 @@ def draw(self, context): lamp = context.lamp - for la in bpy.data.lamps: - print(la.color) + #FIXME DAVID + #for la in bpy.data.lamps: + # print(la.color) - pepe = ["ajo", "agua", "zanahoria", "agua", "ajo"] - pepe = list(set(pepe)) - pepe.sort() - for p in pepe: - print(p) - pepe2 = "ajo2" + #pepe = ["ajo", "agua", "zanahoria", "agua", "ajo"] + #pepe = list(set(pepe)) + #pepe.sort() + #for p in pepe: + # print(p) + #pepe2 = "ajo2" layout.prop(lamp, "lamp_type", expand=True) layout.prop(lamp, "light_enabled") From c7916d392df92532997e69e23baeef720b7a6d2c Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 25 Dec 2015 09:51:36 +0100 Subject: [PATCH 54/81] Removal of light groups I think light groups was an interesting idea, but my testing implementation is too clumsy and ugly. I'm deleting all my light groups code for now, pending a better future implementation (maybe dynamic updating of objects?) --- io/yaf_light.py | 10 -- io/yaf_object.py | 164 +++++++++++++++++++++--------- prop/yaf_light.py | 14 --- prop/yaf_object.py | 13 --- prop/yaf_scene.py | 45 +------- ui/properties_yaf_layer_passes.py | 86 ---------------- ui/properties_yaf_light.py | 15 --- ui/properties_yaf_object.py | 2 - 8 files changed, 117 insertions(+), 232 deletions(-) diff --git a/io/yaf_light.py b/io/yaf_light.py index 1c33e398..ff01add6 100644 --- a/io/yaf_light.py +++ b/io/yaf_light.py @@ -107,7 +107,6 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetString("type", "light_mat") power_sphere = power / lamp.yaf_sphere_radius yi.paramsSetFloat("power", power_sphere) - yi.paramsSetInt("light_group", lamp.light_group) self.lightMat = self.yi.createMaterial(name) self.yi.paramsClearAll() @@ -124,7 +123,6 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetFloat("radius", lamp.yaf_sphere_radius) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) - yi.paramsSetInt("light_group", lamp.light_group) elif lampType == "spot": if self.preview and name == "Lamp.002": @@ -145,7 +143,6 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetInt("samples", lamp.yaf_samples) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) - yi.paramsSetInt("light_group", lamp.light_group) elif lampType == "sun": yi.paramsSetString("type", "sunlight") @@ -154,7 +151,6 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetPoint("direction", direct[0], direct[1], direct[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) - yi.paramsSetInt("light_group", lamp.light_group) elif lampType == "directional": yi.paramsSetString("type", "directional") @@ -165,7 +161,6 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) - yi.paramsSetInt("light_group", lamp.light_group) elif lampType == "ies": yi.paramsSetString("type", "ieslight") @@ -179,7 +174,6 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetBool("soft_shadows", lamp.ies_soft_shadows) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) - yi.paramsSetInt("light_group", lamp.light_group) elif lampType == "area": sizeX = lamp.size @@ -225,7 +219,6 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetPoint("point2", corner3[0], corner3[1], corner3[2]) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) - yi.paramsSetInt("light_group", lamp.light_group) if lampType not in {"sun", "directional"}: # "from" is not used for sunlight and infinite directional light @@ -240,9 +233,6 @@ def createLight(self, yi, lamp_object, matrix=None): yi.paramsSetFloat("power", power) yi.paramsSetBool("light_enabled", lamp.light_enabled) yi.paramsSetBool("cast_shadows", lamp.cast_shadows) - yi.paramsSetInt("light_group", lamp.light_group) yi.createLight(name) - yi.addLightGroup(name, lamp.light_group_name) #FIXME DAVID - yi.addLightGroup(name, "ajolioli") #FIXME DAVID return True diff --git a/io/yaf_object.py b/io/yaf_object.py index e0e2548e..9e45b323 100644 --- a/io/yaf_object.py +++ b/io/yaf_object.py @@ -48,44 +48,11 @@ def createCameras(self): yi = self.yi yi.printInfo("Exporting Cameras") - camera_scene = self.scene.camera - render = self.scene.render - - class viewLightGroupCameraData: - def __init__ (self, camera, view, light_group_name): - self.camera = camera - self.view = view - self.light_group_name = light_group_name - - view_lightgroup_camera_data_list = [] + camera = self.scene.camera - if bpy.types.YAFA_RENDER.useViewToRender or not render.use_multiview: - view_lightgroup_camera_data_list.append(viewLightGroupCameraData(camera_scene, None, "")) - - else: - camera_base_name = camera_scene.name.rsplit('_',1)[0] - - if len(self.scene.yafaray.passes.views_lightgroup_list) == 0: - for view in render.views: - if view.use: - view_lightgroup_camera_data_list.append(viewLightGroupCameraData(self.scene.objects[camera_base_name+view.camera_suffix], view, "")) - - else: - for view_lightgroup in self.scene.yafaray.passes.views_lightgroup_list: - if view_lightgroup.view_number < len(self.scene.render.views) and self.scene.render.views[view_lightgroup.view_number].use: - view_lightgroup_camera_data_list.append(viewLightGroupCameraData(self.scene.objects[camera_base_name+self.scene.render.views[view_lightgroup.view_number].camera_suffix], self.scene.render.views[view_lightgroup.view_number], view_lightgroup.light_group_name)) - - for view_lightgroup_camera_data in view_lightgroup_camera_data_list: - - if bpy.types.YAFA_RENDER.useViewToRender: - camera_name = "3D viewport" - elif view_lightgroup_camera_data.view == None: - camera_name = view_lightgroup_camera_data.camera.name - elif view_lightgroup_camera_data.light_group_name == "": - camera_name = view_lightgroup_camera_data.camera.name+" ("+view_lightgroup_camera_data.view.name+")" - else: - camera_name = view_lightgroup_camera_data.camera.name+" ("+view_lightgroup_camera_data.view.name+", LG "+str(view_lightgroup_camera_data.light_group_name)+")" #FIXME DAVID CHECK THE GROUP NAME DOES NOT CAUSE PROBLEMS, LIMIT CHARACTERS? - + render = self.scene.render + if not render.use_multiview: + if bpy.types.YAFA_RENDER.useViewToRender and bpy.types.YAFA_RENDER.viewMatrix: # use the view matrix to calculate the inverted transformed # points cam pos (0,0,0), front (0,0,1) and up (0,1,0) @@ -106,7 +73,7 @@ def __init__ (self, camera, view, light_group_name): else: # get cam worldspace transformation matrix, e.g. if cam is parented matrix_local does not work - matrix = view_lightgroup_camera_data.camera.matrix_world.copy() + matrix = camera.matrix_world.copy() # matrix indexing (row, colums) changed in Blender rev.42816, for explanation see also: # http://wiki.blender.org/index.php/User:TrumanBlending/Matrix_Indexing pos = matrix.col[3] @@ -119,12 +86,6 @@ def __init__ (self, camera, view, light_group_name): y = int(render.resolution_y * render.resolution_percentage * 0.01) yi.paramsClearAll() - - if view_lightgroup_camera_data.view: - yi.paramsSetString("view_name", view_lightgroup_camera_data.view.name) - else: - yi.paramsSetString("view_name", "") - yi.paramsSetString("light_group_filter_name", view_lightgroup_camera_data.light_group_name) if bpy.types.YAFA_RENDER.useViewToRender: yi.paramsSetString("type", "perspective") @@ -132,7 +93,7 @@ def __init__ (self, camera, view, light_group_name): bpy.types.YAFA_RENDER.useViewToRender = False else: - camera = view_lightgroup_camera_data.camera.data + camera = camera.data camType = camera.camera_type yi.paramsSetString("type", camType) @@ -192,7 +153,116 @@ def __init__ (self, camera, view, light_group_name): yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) yi.paramsSetPoint("up", up[0], up[1], up[2]) yi.paramsSetPoint("to", to[0], to[1], to[2]) - yi.createCamera(camera_name) + yi.createCamera("cam") + + else: + camera_base_name = camera.name.rsplit('_',1)[0] + + for view in render.views: + camera = self.scene.objects[camera_base_name+view.camera_suffix] + + if bpy.types.YAFA_RENDER.useViewToRender and bpy.types.YAFA_RENDER.viewMatrix: + # use the view matrix to calculate the inverted transformed + # points cam pos (0,0,0), front (0,0,1) and up (0,1,0) + # view matrix works like the opengl view part of the + # projection matrix, i.e. transforms everything so camera is + # at 0,0,0 looking towards 0,0,1 (y axis being up) + + m = bpy.types.YAFA_RENDER.viewMatrix + # m.transpose() --> not needed anymore: matrix indexing changed with Blender rev.42816 + inv = m.inverted() + + pos = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 0, 0, 1))) + aboveCam = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 1, 0, 1))) + frontCam = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 0, 1, 1))) + + dir = frontCam - pos + up = aboveCam + + else: + # get cam worldspace transformation matrix, e.g. if cam is parented matrix_local does not work + matrix = camera.matrix_world.copy() + # matrix indexing (row, colums) changed in Blender rev.42816, for explanation see also: + # http://wiki.blender.org/index.php/User:TrumanBlending/Matrix_Indexing + pos = matrix.col[3] + dir = matrix.col[2] + up = pos + matrix.col[1] + + to = pos - dir + + x = int(render.resolution_x * render.resolution_percentage * 0.01) + y = int(render.resolution_y * render.resolution_percentage * 0.01) + + yi.paramsClearAll() + + if bpy.types.YAFA_RENDER.useViewToRender: + yi.paramsSetString("type", "perspective") + yi.paramsSetFloat("focal", 0.7) + bpy.types.YAFA_RENDER.useViewToRender = False + + else: + camera = camera.data + camType = camera.camera_type + + yi.paramsSetString("type", camType) + + if camera.use_clipping: + yi.paramsSetFloat("nearClip", camera.clip_start) + yi.paramsSetFloat("farClip", camera.clip_end) + + if camType == "orthographic": + yi.paramsSetFloat("scale", camera.ortho_scale) + + elif camType in {"perspective", "architect"}: + # Blenders GSOC 2011 project "tomato branch" merged into trunk. + # Check for sensor settings and use them in yafaray exporter also. + if camera.sensor_fit == 'AUTO': + horizontal_fit = (x > y) + sensor_size = camera.sensor_width + elif camera.sensor_fit == 'HORIZONTAL': + horizontal_fit = True + sensor_size = camera.sensor_width + else: + horizontal_fit = False + sensor_size = camera.sensor_height + + if horizontal_fit: + f_aspect = 1.0 + else: + f_aspect = x / y + + yi.paramsSetFloat("focal", camera.lens / (f_aspect * sensor_size)) + + # DOF params, only valid for real camera + # use DOF object distance if present or fixed DOF + if camera.dof_object is not None: + # use DOF object distance + dist = (pos.xyz - camera.dof_object.location.xyz).length + dof_distance = dist + else: + # use fixed DOF distance + dof_distance = camera.dof_distance + + yi.paramsSetFloat("dof_distance", dof_distance) + yi.paramsSetFloat("aperture", camera.aperture) + # bokeh params + yi.paramsSetString("bokeh_type", camera.bokeh_type) + yi.paramsSetFloat("bokeh_rotation", camera.bokeh_rotation) + + elif camType == "angular": + yi.paramsSetBool("circular", camera.circular) + yi.paramsSetBool("mirrored", camera.mirrored) + yi.paramsSetFloat("max_angle", camera.max_angle) + yi.paramsSetFloat("angle", camera.angular_angle) + + yi.paramsSetInt("resx", x) + yi.paramsSetInt("resy", y) + + yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) + yi.paramsSetPoint("up", up[0], up[1], up[2]) + yi.paramsSetPoint("to", to[0], to[1], to[2]) + yi.paramsSetString("view_name", view.name) + yi.createCamera(camera_base_name+view.camera_suffix) def getBBCorners(self, object): bb = object.bound_box # look bpy.types.Object if there is any problem @@ -319,7 +389,6 @@ def writeMeshLight(self, obj, matrix): c = obj.ml_color self.yi.paramsSetColor("color", c[0], c[1], c[2]) self.yi.paramsSetFloat("power", obj.ml_power) - self.yi.paramsSetString("light_group_name", obj.ml_light_group_name) ml_mat = self.yi.createMaterial(ml_matname) self.materialMap[ml_matname] = ml_mat @@ -333,7 +402,6 @@ def writeMeshLight(self, obj, matrix): self.yi.paramsSetColor("color", c[0], c[1], c[2]) self.yi.paramsSetFloat("power", obj.ml_power) self.yi.paramsSetInt("samples", obj.ml_samples) - self.yi.paramsSetInt("light_group", obj.ml_light_group) self.yi.paramsSetInt("object", ID) self.yi.createLight(obj.name) diff --git a/prop/yaf_light.py b/prop/yaf_light.py index f44a0b1b..de86b878 100644 --- a/prop/yaf_light.py +++ b/prop/yaf_light.py @@ -144,18 +144,6 @@ def register(): name="Cast shadows", description="Enable casting shadows. This is the normal and expected behavior. Disable it only for special cases!", default=True) - - Lamp.light_group = IntProperty( - name="Light Group", - description="Light Group number for Light Group render filtering", - min=1, max=100, - default=1) - - Lamp.light_group_name = StringProperty( #FIXME DAVID - name="Light Group Name", - description="Light Group name for Light Group render filtering", - default="") - def unregister(): del Lamp.lamp_type @@ -174,5 +162,3 @@ def unregister(): del Lamp.yaf_show_dist_clip del Lamp.light_enabled del Lamp.cast_shadows - del Lamp.light_group - del Lamp.light_group_name diff --git a/prop/yaf_object.py b/prop/yaf_object.py index badc75e1..8a859c78 100644 --- a/prop/yaf_object.py +++ b/prop/yaf_object.py @@ -60,17 +60,6 @@ def register(): name="Double sided", description="Emit light at both sides of every face", default=False) - - Object.ml_light_group = IntProperty( - name="Light Group", - description="Light Group number for Light Group render filtering", - min=1, max=100, - default=1) - - Object.ml_light_group_name = StringProperty( #FIXME DAVID - name="Light Group Name", - description="Light Group name for Light Group render filtering", - default="") Object.bgp_enable = BoolProperty( name="Enable BG portal light", @@ -174,8 +163,6 @@ def unregister(): del Object.ml_power del Object.ml_samples del Object.ml_double_sided - del Object.ml_light_group - del Object.ml_light_group_name del Object.bgp_enable del Object.bgp_power del Object.bgp_samples diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 97e3c72c..3504d80d 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -212,17 +212,6 @@ class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): ('ao-clay', "AO clay", "Ambient Occlusion (clay)", "", 502), ), key=lambda index: index[1]) - renderPassItemsLightGroup=sorted(( - ('light-group-0', "Light Group 0", "Pass illuminated by lights from the selected light group", "", 600), - ('light-group-1', "Light Group 1", "Pass illuminated by lights from the selected light group", "", 601), - ('light-group-2', "Light Group 2", "Pass illuminated by lights from the selected light group", "", 602), - ('light-group-3', "Light Group 3", "Pass illuminated by lights from the selected light group", "", 603), - ('light-group-4', "Light Group 4", "Pass illuminated by lights from the selected light group", "", 604), - ('light-group-5', "Light Group 5", "Pass illuminated by lights from the selected light group", "", 605), - ('light-group-6', "Light Group 6", "Pass illuminated by lights from the selected light group", "", 606), - ('light-group-7', "Light Group 7", "Pass illuminated by lights from the selected light group", "", 607), - ), key=lambda index: index[1]) - #This property is not currently used by YafaRay Core, as the combined external pass is always using the internal combined pass. pass_Combined = EnumProperty( name="Combined", #RGBA (4 x float) @@ -434,27 +423,6 @@ class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): ), default="adv-subsurface-color") - -class ViewsLightGroupList(bpy.types.PropertyGroup): - view_number = IntProperty( - name="View Number", - description="View Number to which we will assign a light group filter", - default=0, - min=0) - - light_group = IntProperty( - name="Light Group", - description="Light group filter [1..100]. Value 0 will render all light groups", - default=0, - min=0, - max=100) - - light_group_name = StringProperty( #FIXME DAVID - name="Light Group Name", - description="Light Group name for Light Group render filtering", - default="") - - def register(): ########### YafaRays general settings properties ############# Scene.gs_ray_depth = IntProperty( @@ -864,12 +832,6 @@ def register(): bpy.utils.register_class(YafaRayNoiseControlProperties) YafaRayProperties.noise_control = PointerProperty(type=YafaRayNoiseControlProperties) - bpy.utils.register_class(ViewsLightGroupList) - - YafaRayRenderPassesProperties.views_lightgroup_list = CollectionProperty(type = ViewsLightGroupList) - YafaRayRenderPassesProperties.views_lightgroup_list_index = IntProperty(name = "Index for the Views Light Group List", default = -1) - - def unregister(): Scene.gs_ray_depth Scene.gs_shadow_depth @@ -941,9 +903,4 @@ def unregister(): bpy.utils.unregister_class(YafaRayNoiseControlProperties) bpy.utils.unregister_class(YafaRayRenderPassesProperties) - bpy.utils.unregister_class(YafaRayProperties) - - Scene.views_lightgroup_list - Scene.views_lightgroup_list_index - bpy.utils.unregister_class(ViewsLightGroupList) - + bpy.utils.unregister_class(YafaRayProperties) \ No newline at end of file diff --git a/ui/properties_yaf_layer_passes.py b/ui/properties_yaf_layer_passes.py index 10b61c83..b1787b53 100755 --- a/ui/properties_yaf_layer_passes.py +++ b/ui/properties_yaf_layer_passes.py @@ -24,62 +24,6 @@ RenderLayerButtonsPanel.COMPAT_ENGINES = {'YAFA_RENDER'} -class ViewsLightGroupList_UL_List(bpy.types.UIList): - COMPAT_ENGINES = {'YAFA_RENDER'} - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): - - if self.layout_type in {'DEFAULT', 'COMPACT'}: - layout.prop(item, "view_number") - - if item.view_number < len(context.scene.render.views): - layout.label("", icon = 'SCENE') - layout.label(context.scene.render.views[item.view_number].name) - layout.label("", icon = 'LAMP') - layout.prop(item, "light_group") - layout.prop(item, "light_group_name") - else: - layout.label("", icon = 'ERROR') - layout.label("View not defined, skipping.") - - elif self.layout_type in {'GRID'}: - layout.alignment = 'CENTER' - layout.label("", icon = custom_icon) - -bpy.utils.register_class(ViewsLightGroupList_UL_List) # ( inside register() ) FIXME DAVID?? - -class ViewsLightGroupList_OT_NewItem(bpy.types.Operator): - bl_idname = "views_lightgroup_list.new_item" - bl_label = "Add a new View-Light Group Filter assignment" - COMPAT_ENGINES = {'YAFA_RENDER'} - - def execute(self, context): - context.scene.yafaray.passes.views_lightgroup_list.add() - - return{'FINISHED'} - -bpy.utils.register_class(ViewsLightGroupList_OT_NewItem) # ( inside register() ) FIXME DAVID?? - -class ViewsLightGroupList_OT_DeleteItem(bpy.types.Operator): - bl_idname = "views_lightgroup_list.delete_item" - bl_label = "Delete a View-Light Group Filter assignment" - COMPAT_ENGINES = {'YAFA_RENDER'} - - @classmethod - def poll(self, context): - return len(context.scene.yafaray.passes.views_lightgroup_list) > 0 - - def execute(self, context): - list = context.scene.yafaray.passes.views_lightgroup_list - index = context.scene.yafaray.passes.views_lightgroup_list_index - - list.remove(index) - - if index > 0: - index = index - 1 - - return{'FINISHED'} - -bpy.utils.register_class(ViewsLightGroupList_OT_DeleteItem) # ( inside register() ) FIXME DAVID?? class YAFRENDER_PT_layers(RenderLayerButtonsPanel, Panel): bl_label = "Layers" @@ -133,21 +77,10 @@ def draw(self, context): rd = scene.render rl = rd.layers.active - #row = layout.row(align=True) - #row.alignment = 'LEFT' - - #row.prop(scene.yafaray.passes, "pass_enable", toggle=True) #, "optional extended description") if scene.yafaray.passes.pass_enable: row = layout.row() #(align=True) - #row.alignment = 'LEFT' - ##row.prop(rl, "use_pass_combined") - ##if scene.render.layers[0].use_pass_combined: - ## sub = row.column(align=True) - ## sub.prop(scene.yafaray.passes, "pass_combined", "") - row = layout.row() #(align=True) - #row.alignment = 'LEFT' row.prop(rl, "use_pass_z") #, "Z-depth") if scene.render.layers[0].use_pass_z: sub = row.column(align=True) @@ -381,25 +314,6 @@ def draw(self, context): row.label(text="Camera Suffix:") row.prop(rv, "camera_suffix", text="") - row = layout.row() - row.label(text="Views - Light Group filters:") - if len(scene.yafaray.passes.views_lightgroup_list) == 0: - row = layout.row() - row.label(icon="INFO", text="No views/light group filters defined.") - row = layout.row() - row.label(icon="INFO", text="By default all views will be rendered with all lights.") - row = layout.row() - row.template_list("ViewsLightGroupList_UL_List", "ViewsLightGroupList", scene.yafaray.passes, "views_lightgroup_list", scene.yafaray.passes, "views_lightgroup_list_index", rows=2) - col = row.column(align=True) - col.operator('views_lightgroup_list.new_item', icon='ZOOMIN', text="") - col.operator('views_lightgroup_list.delete_item', icon='ZOOMOUT', text="") - if len(scene.yafaray.passes.views_lightgroup_list) > 0: - row = layout.row() - row.label(icon="INFO", text="Only the selected views with the assigned light groups will be rendered") - row = layout.row() - row.label(icon="INFO", text="If several light groups are assigned to the same view, ONLY THE LAST ONE will be imported into Blender.") - - if __name__ == "__main__": # only for live edit. import bpy bpy.utils.register_module(__name__) diff --git a/ui/properties_yaf_light.py b/ui/properties_yaf_light.py index 1559df3b..2d548bc0 100644 --- a/ui/properties_yaf_light.py +++ b/ui/properties_yaf_light.py @@ -18,7 +18,6 @@ # -import bpy from bpy.types import Panel from bl_ui.properties_data_lamp import DataButtonsPanel @@ -52,22 +51,8 @@ def draw(self, context): lamp = context.lamp - #FIXME DAVID - #for la in bpy.data.lamps: - # print(la.color) - - #pepe = ["ajo", "agua", "zanahoria", "agua", "ajo"] - #pepe = list(set(pepe)) - #pepe.sort() - #for p in pepe: - # print(p) - #pepe2 = "ajo2" - layout.prop(lamp, "lamp_type", expand=True) layout.prop(lamp, "light_enabled") - layout.prop(lamp, "light_group") - layout.prop(lamp, "light_group_name") - layout.prop_search(lamp, "light_group_name", bpy.data, "groups") if lamp.lamp_type == "area": layout.prop(lamp, "color") diff --git a/ui/properties_yaf_object.py b/ui/properties_yaf_object.py index a892337d..100c5f6d 100644 --- a/ui/properties_yaf_object.py +++ b/ui/properties_yaf_object.py @@ -42,8 +42,6 @@ def draw(self, context): if ob.ml_enable: col = layout.column(align=True) - col.prop(ob, "ml_light_group") - col.prop(ob, "ml_light_group_name") col.prop(ob, "ml_color") col.prop(ob, "ml_power") layout.prop(ob, "ml_samples") From d305b63fb669ede68ea1507e9c00c9520c5ee2db Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 25 Dec 2015 11:19:41 +0100 Subject: [PATCH 55/81] Render Views: simplification of code, fixes when views are disabled in Blender --- io/yaf_export.py | 39 +++++++------- io/yaf_object.py | 136 ++++++++--------------------------------------- 2 files changed, 43 insertions(+), 132 deletions(-) diff --git a/io/yaf_export.py b/io/yaf_export.py index eb6ab5c4..dd4b0c0c 100755 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -413,16 +413,17 @@ def drawAreaCallback(*args): if scene.render.use_multiview: #due to Blender limitations while drawing the tiles, I cannot use the view names properly and I have to repeat the currently drawing tile into all views so it shows correctly. Maybe there is a better way? for view_number,view in enumerate(scene.render.views): - view_suffix = '.'+scene.render.views[view_number].name - - for tile in tiles: - view_name, tile_name, tile_bitmap = tile - try: - l.passes[tile_name+view_suffix].rect = tile_bitmap - except: - print("Exporter: Exception while rendering in drawAreaCallback function:") - traceback.print_exc() - + if view.use: + view_suffix = '.'+scene.render.views[view_number].name + + for tile in tiles: + view_name, tile_name, tile_bitmap = tile + try: + l.passes[tile_name+view_suffix].rect = tile_bitmap + except: + print("Exporter: Exception while rendering in drawAreaCallback function:") + traceback.print_exc() + else: for tile in tiles: view_name, tile_name, tile_bitmap = tile @@ -452,19 +453,21 @@ def flushCallback(*args): if scene.render.use_multiview: if view_name == "": #In case we use Render 3D vierpowrt with Views enabled, it will copy the result to all views for view_number,view in enumerate(scene.render.views): - full_tile_name = tile_name + "." + view.name + if view.use: + full_tile_name = tile_name + "." + view.name + try: + l.passes[full_tile_name].rect = tile_bitmap + except: + print("Exporter: Exception while rendering in flushCallback function:") + traceback.print_exc() + else: + if scene.render.views[view_name].use: + full_tile_name = tile_name + "." + view_name try: l.passes[full_tile_name].rect = tile_bitmap except: print("Exporter: Exception while rendering in flushCallback function:") traceback.print_exc() - else: - full_tile_name = tile_name + "." + view_name - try: - l.passes[full_tile_name].rect = tile_bitmap - except: - print("Exporter: Exception while rendering in flushCallback function:") - traceback.print_exc() else: full_tile_name = tile_name try: diff --git a/io/yaf_object.py b/io/yaf_object.py index 9e45b323..a272a57f 100644 --- a/io/yaf_object.py +++ b/io/yaf_object.py @@ -47,12 +47,27 @@ def createCameras(self): yi = self.yi yi.printInfo("Exporting Cameras") - - camera = self.scene.camera render = self.scene.render - if not render.use_multiview: + + class CameraData: + def __init__ (self, camera, camera_name, view_name): + self.camera = camera + self.camera_name = camera_name + self.view_name = view_name + + cameras = [] + + if bpy.types.YAFA_RENDER.useViewToRender or not render.use_multiview: + cameras.append(CameraData(self.scene.camera, "cam", "")) + else: + camera_base_name = self.scene.camera.name.rsplit('_',1)[0] + + for view in render.views: + if view.use: + cameras.append(CameraData(self.scene.objects[camera_base_name+view.camera_suffix], camera_base_name+view.camera_suffix, view.name)) + for cam in cameras: if bpy.types.YAFA_RENDER.useViewToRender and bpy.types.YAFA_RENDER.viewMatrix: # use the view matrix to calculate the inverted transformed # points cam pos (0,0,0), front (0,0,1) and up (0,1,0) @@ -73,7 +88,7 @@ def createCameras(self): else: # get cam worldspace transformation matrix, e.g. if cam is parented matrix_local does not work - matrix = camera.matrix_world.copy() + matrix = cam.camera.matrix_world.copy() # matrix indexing (row, colums) changed in Blender rev.42816, for explanation see also: # http://wiki.blender.org/index.php/User:TrumanBlending/Matrix_Indexing pos = matrix.col[3] @@ -93,7 +108,7 @@ def createCameras(self): bpy.types.YAFA_RENDER.useViewToRender = False else: - camera = camera.data + camera = cam.camera.data camType = camera.camera_type yi.paramsSetString("type", camType) @@ -153,116 +168,9 @@ def createCameras(self): yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) yi.paramsSetPoint("up", up[0], up[1], up[2]) yi.paramsSetPoint("to", to[0], to[1], to[2]) - yi.createCamera("cam") - - else: - camera_base_name = camera.name.rsplit('_',1)[0] - - for view in render.views: - camera = self.scene.objects[camera_base_name+view.camera_suffix] - - if bpy.types.YAFA_RENDER.useViewToRender and bpy.types.YAFA_RENDER.viewMatrix: - # use the view matrix to calculate the inverted transformed - # points cam pos (0,0,0), front (0,0,1) and up (0,1,0) - # view matrix works like the opengl view part of the - # projection matrix, i.e. transforms everything so camera is - # at 0,0,0 looking towards 0,0,1 (y axis being up) - - m = bpy.types.YAFA_RENDER.viewMatrix - # m.transpose() --> not needed anymore: matrix indexing changed with Blender rev.42816 - inv = m.inverted() - - pos = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 0, 0, 1))) - aboveCam = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 1, 0, 1))) - frontCam = multiplyMatrix4x4Vector4(inv, mathutils.Vector((0, 0, 1, 1))) - - dir = frontCam - pos - up = aboveCam - - else: - # get cam worldspace transformation matrix, e.g. if cam is parented matrix_local does not work - matrix = camera.matrix_world.copy() - # matrix indexing (row, colums) changed in Blender rev.42816, for explanation see also: - # http://wiki.blender.org/index.php/User:TrumanBlending/Matrix_Indexing - pos = matrix.col[3] - dir = matrix.col[2] - up = pos + matrix.col[1] - - to = pos - dir - - x = int(render.resolution_x * render.resolution_percentage * 0.01) - y = int(render.resolution_y * render.resolution_percentage * 0.01) - - yi.paramsClearAll() - - if bpy.types.YAFA_RENDER.useViewToRender: - yi.paramsSetString("type", "perspective") - yi.paramsSetFloat("focal", 0.7) - bpy.types.YAFA_RENDER.useViewToRender = False - - else: - camera = camera.data - camType = camera.camera_type - - yi.paramsSetString("type", camType) - - if camera.use_clipping: - yi.paramsSetFloat("nearClip", camera.clip_start) - yi.paramsSetFloat("farClip", camera.clip_end) - - if camType == "orthographic": - yi.paramsSetFloat("scale", camera.ortho_scale) - - elif camType in {"perspective", "architect"}: - # Blenders GSOC 2011 project "tomato branch" merged into trunk. - # Check for sensor settings and use them in yafaray exporter also. - if camera.sensor_fit == 'AUTO': - horizontal_fit = (x > y) - sensor_size = camera.sensor_width - elif camera.sensor_fit == 'HORIZONTAL': - horizontal_fit = True - sensor_size = camera.sensor_width - else: - horizontal_fit = False - sensor_size = camera.sensor_height - - if horizontal_fit: - f_aspect = 1.0 - else: - f_aspect = x / y - - yi.paramsSetFloat("focal", camera.lens / (f_aspect * sensor_size)) + yi.paramsSetString("view_name", cam.view_name) + yi.createCamera(cam.camera_name) - # DOF params, only valid for real camera - # use DOF object distance if present or fixed DOF - if camera.dof_object is not None: - # use DOF object distance - dist = (pos.xyz - camera.dof_object.location.xyz).length - dof_distance = dist - else: - # use fixed DOF distance - dof_distance = camera.dof_distance - - yi.paramsSetFloat("dof_distance", dof_distance) - yi.paramsSetFloat("aperture", camera.aperture) - # bokeh params - yi.paramsSetString("bokeh_type", camera.bokeh_type) - yi.paramsSetFloat("bokeh_rotation", camera.bokeh_rotation) - - elif camType == "angular": - yi.paramsSetBool("circular", camera.circular) - yi.paramsSetBool("mirrored", camera.mirrored) - yi.paramsSetFloat("max_angle", camera.max_angle) - yi.paramsSetFloat("angle", camera.angular_angle) - - yi.paramsSetInt("resx", x) - yi.paramsSetInt("resy", y) - - yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) - yi.paramsSetPoint("up", up[0], up[1], up[2]) - yi.paramsSetPoint("to", to[0], to[1], to[2]) - yi.paramsSetString("view_name", view.name) - yi.createCamera(camera_base_name+view.camera_suffix) def getBBCorners(self, object): bb = object.bound_box # look bpy.types.Object if there is any problem From 6c3cc5fa9d45f2048cf590fc199778813a0c64ed Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 25 Dec 2015 13:30:30 +0100 Subject: [PATCH 56/81] Removing dot at end of descriptions to avoid warnings from blender debug mode --- prop/yaf_scene.py | 80 +++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 3504d80d..04ac66ad 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -52,19 +52,19 @@ class YafaRayNoiseControlProperties(bpy.types.PropertyGroup): sample_multiplier_factor = FloatProperty( name="AA sample multiplier factor", - description="Factor to increase the AA samples multiplier for next AA pass.", + description="Factor to increase the AA samples multiplier for next AA pass", min=1.0, max=2.0, precision=2, default=1.0) light_sample_multiplier_factor = FloatProperty( name="Light sample multiplier factor", - description="Factor to increase the light samples multiplier for next AA pass.", + description="Factor to increase the light samples multiplier for next AA pass", min=1.0, max=2.0, precision=2, default=1.0) indirect_sample_multiplier_factor = FloatProperty( name="Indirect sample multiplier factor", - description="Factor to increase the indirect samples (FG for example) multiplier for next AA pass.", + description="Factor to increase the indirect samples (FG for example) multiplier for next AA pass", min=1.0, max=2.0, precision=2, default=1.0) @@ -76,13 +76,13 @@ class YafaRayNoiseControlProperties(bpy.types.PropertyGroup): dark_threshold_factor = FloatProperty( name="Dark areas noise detection factor", description=("Factor used to reduce the AA threshold in dark areas." - " It will reduce noise in dark areas, but noise in bright areas will take longer."), + " It will reduce noise in dark areas, but noise in bright areas will take longer"), min=0.0, max=0.8, precision=2, default=0.0) variance_edge_size = IntProperty( name="Variance window", - description="Window edge size for variance noise detection.", + description="Window edge size for variance noise detection", min=4, max=20, default=10) @@ -94,13 +94,13 @@ class YafaRayNoiseControlProperties(bpy.types.PropertyGroup): clamp_samples = FloatProperty( name="Clamp samples", - description="Clamp RGB values in all samples, less noise but less realism. 0.0 disables clamping.", + description="Clamp RGB values in all samples, less noise but less realism. 0.0 disables clamping", min=0.0, precision=1, default=0.0) clamp_indirect = FloatProperty( name="Clamp indirect", - description="Clamp RGB values in the indirect light, less noise but less realism. 0.0 disables clamping.", + description="Clamp RGB values in the indirect light, less noise but less realism. 0.0 disables clamping", min=0.0, precision=1, default=0.0) @@ -215,210 +215,210 @@ class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): #This property is not currently used by YafaRay Core, as the combined external pass is always using the internal combined pass. pass_Combined = EnumProperty( name="Combined", #RGBA (4 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsDisabled ), default="disabled") pass_Depth = EnumProperty( name="Depth", #Gray (1 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsDepth ), default="z-depth-norm") pass_Vector = EnumProperty( name="Vector", #RGBA (4 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO+renderPassItemsDepth+renderPassItemsAO ), default="obj-index-auto") pass_Normal = EnumProperty( name="Normal", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="debug-normal-smooth") pass_UV = EnumProperty( name="UV", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="debug-uv") pass_Color = EnumProperty( name="Color", #RGBA (4 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="mat-index-auto") pass_Emit = EnumProperty( name="Emit", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="emit") pass_Mist = EnumProperty( name="Mist", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="mist") pass_Diffuse = EnumProperty( name="Diffuse", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="diffuse") pass_Spec = EnumProperty( name="Spec", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-reflect") pass_AO = EnumProperty( name="AO", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsAO ), default="ao") pass_Env = EnumProperty( name="Env", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="env") pass_Indirect = EnumProperty( name="Indirect", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="indirect") pass_Shadow = EnumProperty( name="Shadow", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="shadow") pass_Reflect = EnumProperty( name="Reflect", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="reflect") pass_Refract = EnumProperty( name="Refract", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="refract") pass_IndexOB = EnumProperty( name="Object Index", #Gray (1 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsIndex ), default="obj-index-norm") pass_IndexMA = EnumProperty( name="Material Index", #Gray (1 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsIndex ), default="mat-index-norm") pass_DiffDir = EnumProperty( name="Diff Dir", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="diffuse") pass_DiffInd = EnumProperty( name="Diff Ind", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-diffuse-indirect") pass_DiffCol = EnumProperty( name="Diff Col", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-diffuse-color") pass_GlossDir = EnumProperty( name="Gloss Dir", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-glossy") pass_GlossInd = EnumProperty( name="Gloss Ind", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-glossy-indirect") pass_GlossCol = EnumProperty( name="Gloss Col", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-glossy-color") pass_TransDir = EnumProperty( name="Trans Dir", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-trans") pass_TransInd = EnumProperty( name="Trans Ind", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-trans-indirect") pass_TransCol = EnumProperty( name="Trans Col", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-trans-color") pass_SubsurfaceDir = EnumProperty( name="SubSurface Dir", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-subsurface") pass_SubsurfaceInd = EnumProperty( name="SubSurface Ind", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-subsurface-indirect") pass_SubsurfaceCol = EnumProperty( name="SubSurface Col", #RGB (3 x float) - description="Select the type of image you want to be displayed in this pass.", + description="Select the type of image you want to be displayed in this pass", items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO ), default="adv-subsurface-color") @@ -534,7 +534,7 @@ def register(): Scene.adv_shadow_bias_value = FloatProperty( name="Shadow Bias Factor", - description="Shadow Bias (default 0.0005). Change ONLY if artifacts or black dots due to bad self-shadowing. Increasing this value can led to artifacts and incorrect renders.", + description="Shadow Bias (default 0.0005). Change ONLY if artifacts or black dots due to bad self-shadowing. Increasing this value can led to artifacts and incorrect renders", min=0.00000001, max=10000, default=0.0005) Scene.adv_auto_min_raydist_enabled = BoolProperty( @@ -544,7 +544,7 @@ def register(): Scene.adv_min_raydist_value = FloatProperty( name="Min Ray Dist Factor", - description="Min Ray Dist (default 0.00005). Change ONLY if artifacts or light leaks due to bad ray intersections. Increasing this value can led to artifacts and incorrect renders.", + description="Min Ray Dist (default 0.00005). Change ONLY if artifacts or light leaks due to bad ray intersections. Increasing this value can led to artifacts and incorrect renders", min=0.00000001, max=10000, default=0.00005) Scene.gs_custom_string = StringProperty( @@ -903,4 +903,4 @@ def unregister(): bpy.utils.unregister_class(YafaRayNoiseControlProperties) bpy.utils.unregister_class(YafaRayRenderPassesProperties) - bpy.utils.unregister_class(YafaRayProperties) \ No newline at end of file + bpy.utils.unregister_class(YafaRayProperties) From 6e031398d3cdaed7ca945df3751e9608c34fa198 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 25 Dec 2015 13:54:17 +0100 Subject: [PATCH 57/81] Render Passes: fixed order and avoiding the existing settings to change if new passes are added in the future --- prop/yaf_scene.py | 162 +++++++++++++++++++++++----------------------- 1 file changed, 82 insertions(+), 80 deletions(-) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 04ac66ad..8d2d3f8e 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -137,81 +137,83 @@ class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): #The matching between these properties and the YafaRay Core internal passes is done via the first string, for example 'z-depth-abs'. They must match the list of strings for internal passes in the Core: include/core_api/color.h renderPassItemsDisabled=sorted(( - ('disabled', "Disabled", "Disable this pass", "", 999999), + ('disabled', "Disabled", "Disable this pass", 999999), ), key=lambda index: index[1]) renderPassItemsBasic=sorted(( - ('combined', "Basic: Combined image", "Basic: Combined standard image", "", 0), - ('diffuse', "Basic: Diffuse", "Basic: Diffuse materials", "", 1), - ('diffuse-noshadow', "Basic: Diffuse (no shadows)", "Basic: Diffuse materials (without shadows)", "", 2), - ('shadow', "Basic: Shadow", "Basic: Shadows", "", 3), - ('env', "Basic: Environment", "Basic: Environmental light", "", 4), - ('indirect', "Basic: Indirect", "Basic: Indirect light (all, including caustics and diffuse)", "", 5), - ('emit', "Basic: Emit", "Basic: Objects emitting light", "", 6), - ('reflect', "Basic: Reflection", "Basic: Reflections (all, including perfect and glossy)", "", 7), - ('refract', "Basic: Refraction", "Basic: Refractions (all, including perfect and sampled)", "", 8), - ('mist', "Basic: Mist", "Basic: Mist", "", 9), + ('combined', "Basic: Combined image", "Basic: Combined standard image", 0), + ('diffuse', "Basic: Diffuse", "Basic: Diffuse materials", 1), + ('diffuse-noshadow', "Basic: Diffuse (no shadows)", "Basic: Diffuse materials (without shadows)", 2), + ('shadow', "Basic: Shadow", "Basic: Shadows", 3), + ('env', "Basic: Environment", "Basic: Environmental light", 4), + ('indirect', "Basic: Indirect", "Basic: Indirect light (all, including caustics and diffuse)", 5), + ('emit', "Basic: Emit", "Basic: Objects emitting light", 6), + ('reflect', "Basic: Reflection", "Basic: Reflections (all, including perfect and glossy)", 7), + ('refract', "Basic: Refraction", "Basic: Refractions (all, including perfect and sampled)", 8), + ('mist', "Basic: Mist", "Basic: Mist", 9), ), key=lambda index: index[1]) renderPassItemsDepth=sorted(( - ('z-depth-abs', "Z-Depth (absolute)", "Z-Depth (absolute values)", "", 101), - ('z-depth-norm', "Z-Depth (normalized)", "Z-Depth (normalized values)", "", 102), + ('z-depth-abs', "Z-Depth (absolute)", "Z-Depth (absolute values)", 101), + ('z-depth-norm', "Z-Depth (normalized)", "Z-Depth (normalized values)", 102), ), key=lambda index: index[1]) renderPassItemsIndex=sorted(( - ('obj-index-abs', "Index-Object (absolute)", "Index-Object: Grayscale value = obj.index in the object properties (absolute values)", "", 201), - ('obj-index-norm', "Index-Object (normalized)", "Index-Object: Grayscale value = obj.index in the object properties (normalized values)", "", 202), - ('obj-index-auto', "Index-Object (auto)", "Index-Object: A color automatically generated for each object", "", 203), - ('obj-index-mask', "Index-Object Mask", "", "Index-Object: Masking object based on obj.index.mask setting", 204), - ('obj-index-mask-shadow', "Index-Object Mask Shadow", "", "Index-Object: Masking object shadow based on obj.index.mask setting", 205), - ('obj-index-mask-all', "Index-Object Mask All (Object+Shadow)", "", "Index-Object: Masking object+shadow based on obj.index.mask setting", 206), - ('mat-index-abs', "Index-Material (absolute)", "Index-Material: Grayscale value = mat.index in the material properties (absolute values)", "", 207), - ('mat-index-norm', "Index-Material (normalized)", "Index-Material: Grayscale value = mat.index in the material properties (normalized values)", "", 208), - ('mat-index-auto', "Index-Material (auto)", "Index-Material: A color automatically generated for each material", "", 209), - ('mat-index-mask', "Index-Material Mask", "", "Index-Material: Masking material based on mat.index.mask setting", 210), - ('mat-index-mask-shadow', "Index-Material Mask Shadow", "", "Index-Material: Masking material shadow based on mat.index.mask setting", 211), - ('mat-index-mask-all', "Index-Material Mask All (Object+Shadow)", "", "Index-Material: Masking material+shadow based on mat.index.mask setting", 212) + ('obj-index-abs', "Index-Object (absolute)", "Index-Object: Grayscale value = obj.index in the object properties (absolute values)", 201), + ('obj-index-norm', "Index-Object (normalized)", "Index-Object: Grayscale value = obj.index in the object properties (normalized values)", 202), + ('obj-index-auto', "Index-Object (auto)", "Index-Object: A color automatically generated for each object", 203), + ('obj-index-mask', "Index-Object Mask", "Index-Object: Masking object based on obj.index.mask setting", 204), + ('obj-index-mask-shadow', "Index-Object Mask Shadow", "Index-Object: Masking object shadow based on obj.index.mask setting", 205), + ('obj-index-mask-all', "Index-Object Mask All (Object+Shadow)", "Index-Object: Masking object+shadow based on obj.index.mask setting", 206), + ('mat-index-abs', "Index-Material (absolute)", "Index-Material: Grayscale value = mat.index in the material properties (absolute values)", 207), + ('mat-index-norm', "Index-Material (normalized)", "Index-Material: Grayscale value = mat.index in the material properties (normalized values)", 208), + ('mat-index-auto', "Index-Material (auto)", "Index-Material: A color automatically generated for each material", 209), + ('mat-index-mask', "Index-Material Mask", "Index-Material: Masking material based on mat.index.mask setting", 210), + ('mat-index-mask-shadow', "Index-Material Mask Shadow", "Index-Material: Masking material shadow based on mat.index.mask setting", 211), + ('mat-index-mask-all', "Index-Material Mask All (Object+Shadow)", "Index-Material: Masking material+shadow based on mat.index.mask setting", 212) ), key=lambda index: index[1]) renderPassItemsDebug=sorted(( - ('debug-aa-samples', "Debug: AA sample count", "Debug: Adaptative AA sample count (estimation), normalized", "", 301), - ('debug-uv', "Debug: UV", "Debug: UV coordinates (black for objects with no UV mapping)", "", 302), - ('debug-dsdv', "Debug: dSdV", "Debug: shading dSdV", "", 303), - ('debug-dsdu', "Debug: dSdU", "Debug: shading dSdU", "", 304), - ('debug-dpdv', "Debug: dPdV", "Debug: surface dPdV", "", 305), - ('debug-dpdu', "Debug: dPdU", "Debug: surface dPdU", "", 306), - ('debug-nv', "Debug: NV", "Debug - surface NV", "", 307), - ('debug-nu', "Debug: NU", "Debug - surface NU", "", 308), - ('debug-normal-geom', "Debug: Normals (geometric)", "Normals (geometric, no smoothness)", "", 309), - ('debug-normal-smooth', "Debug: Normals (smooth)", "Normals (including smoothness)", "", 310), + ('debug-aa-samples', "Debug: AA sample count", "Debug: Adaptative AA sample count (estimation), normalized", 301), + ('debug-uv', "Debug: UV", "Debug: UV coordinates (black for objects with no UV mapping)", 302), + ('debug-dsdv', "Debug: dSdV", "Debug: shading dSdV", 303), + ('debug-dsdu', "Debug: dSdU", "Debug: shading dSdU", 304), + ('debug-dpdv', "Debug: dPdV", "Debug: surface dPdV", 305), + ('debug-dpdu', "Debug: dPdU", "Debug: surface dPdU", 306), + ('debug-nv', "Debug: NV", "Debug - surface NV", 307), + ('debug-nu', "Debug: NU", "Debug - surface NU", 308), + ('debug-normal-geom', "Debug: Normals (geometric)", "Normals (geometric, no smoothness)", 309), + ('debug-normal-smooth', "Debug: Normals (smooth)", "Normals (including smoothness)", 310), ), key=lambda index: index[1]) renderInternalPassAdvanced=sorted(( - ('adv-reflect', "Adv: Reflection ", "Reflections (perfect only)", "", 401), - ('adv-refract', "Adv: Refraction", "Refractions (perfect only)", "", 402), - ('adv-radiance', "Adv: Photon Radiance map", "Advanced: Radiance map (only for photon mapping)", "", 403), - ('adv-volume-transmittance', "Adv: Volume Transmittance", "Advanced: Volume Transmittance", "", 404), - ('adv-volume-integration', "Adv: Volume integration", "Advanced: Volume integration", "", 405), - ('adv-diffuse-indirect', "Adv: Diffuse Indirect", "Advanced: Diffuse Indirect light", "", 406), - ('adv-diffuse-color', "Adv: Diffuse color", "Advanced: Diffuse color", "", 407), - ('adv-glossy', "Adv: Glossy", "Advanced: Glossy materials", "", 408), - ('adv-glossy-indirect', "Adv: Glossy Indirect", "Advanced: Glossy Indirect light", "", 409), - ('adv-glossy-color', "Adv: Glossy color", "Advanced: Glossy color", "", 410), - ('adv-trans', "Adv: Transmissive", "Advanced: Transmissive materials", "", 411), - ('adv-trans-indirect', "Adv: Trans.Indirect", "Advanced: Transmissive Indirect light", "", 412), - ('adv-trans-color', "Adv: Trans.color", "Advanced: Transmissive color", "", 413), - ('adv-subsurface', "Adv: SubSurface", "Advanced: SubSurface materials", "", 414), - ('adv-subsurface-indirect', "Adv: SubSurf.Indirect", "Advanced: SubSurface Indirect light", "", 415), - ('adv-subsurface-color', "Adv: SubSurf.color", "Advanced: SubSurface color", "", 416), - ('adv-indirect', "Adv: Indirect", "Adv: Indirect light (depends on the integrator but usually caustics only)", "", 417), - ('adv-surface-integration', "Adv: Surface Integration", "Advanced: Surface Integration", "", 418), + ('adv-reflect', "Adv: Reflection ", "Advanced: Reflections (perfect only)", 401), + ('adv-refract', "Adv: Refraction", "Advanced: Refractions (perfect only)", 402), + ('adv-radiance', "Adv: Photon Radiance map", "Advanced: Radiance map (only for photon mapping)", 403), + ('adv-volume-transmittance', "Adv: Volume Transmittance", "Advanced: Volume Transmittance", 404), + ('adv-volume-integration', "Adv: Volume integration", "Advanced: Volume integration", 405), + ('adv-diffuse-indirect', "Adv: Diffuse Indirect", "Advanced: Diffuse Indirect light", 406), + ('adv-diffuse-color', "Adv: Diffuse color", "Advanced: Diffuse color", 407), + ('adv-glossy', "Adv: Glossy", "Advanced: Glossy materials", 408), + ('adv-glossy-indirect', "Adv: Glossy Indirect", "Advanced: Glossy Indirect light", 409), + ('adv-glossy-color', "Adv: Glossy color", "Advanced: Glossy color", 410), + ('adv-trans', "Adv: Transmissive", "Advanced: Transmissive materials", 411), + ('adv-trans-indirect', "Adv: Trans.Indirect", "Advanced: Transmissive Indirect light", 412), + ('adv-trans-color', "Adv: Trans.color", "Advanced: Transmissive color", 413), + ('adv-subsurface', "Adv: SubSurface", "Advanced: SubSurface materials", 414), + ('adv-subsurface-indirect', "Adv: SubSurf.Indirect", "Advanced: SubSurface Indirect light", 415), + ('adv-subsurface-color', "Adv: SubSurf.color", "Advanced: SubSurface color", 416), + ('adv-indirect', "Adv: Indirect", "Adv: Indirect light (depends on the integrator but usually caustics only)", 417), + ('adv-surface-integration', "Adv: Surface Integration", "Advanced: Surface Integration", 418), ), key=lambda index: index[1]) renderPassItemsAO=sorted(( - ('ao', "AO", "Ambient Occlusion", "", 501), - ('ao-clay', "AO clay", "Ambient Occlusion (clay)", "", 502), + ('ao', "AO", "Ambient Occlusion", 501), + ('ao-clay', "AO clay", "Ambient Occlusion (clay)", 502), ), key=lambda index: index[1]) + renderPassAllItems = sorted(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO, key=lambda index: index[1]) + #This property is not currently used by YafaRay Core, as the combined external pass is always using the internal combined pass. pass_Combined = EnumProperty( name="Combined", #RGBA (4 x float) @@ -230,56 +232,56 @@ class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): pass_Vector = EnumProperty( name="Vector", #RGBA (4 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="obj-index-auto") pass_Normal = EnumProperty( name="Normal", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="debug-normal-smooth") pass_UV = EnumProperty( name="UV", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="debug-uv") pass_Color = EnumProperty( name="Color", #RGBA (4 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="mat-index-auto") pass_Emit = EnumProperty( name="Emit", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="emit") pass_Mist = EnumProperty( name="Mist", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="mist") pass_Diffuse = EnumProperty( name="Diffuse", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="diffuse") pass_Spec = EnumProperty( name="Spec", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-reflect") @@ -293,35 +295,35 @@ class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): pass_Env = EnumProperty( name="Env", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="env") pass_Indirect = EnumProperty( name="Indirect", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="indirect") pass_Shadow = EnumProperty( name="Shadow", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="shadow") pass_Reflect = EnumProperty( name="Reflect", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="reflect") pass_Refract = EnumProperty( name="Refract", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="refract") @@ -342,84 +344,84 @@ class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): pass_DiffDir = EnumProperty( name="Diff Dir", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="diffuse") pass_DiffInd = EnumProperty( name="Diff Ind", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-diffuse-indirect") pass_DiffCol = EnumProperty( name="Diff Col", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-diffuse-color") pass_GlossDir = EnumProperty( name="Gloss Dir", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-glossy") pass_GlossInd = EnumProperty( name="Gloss Ind", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-glossy-indirect") pass_GlossCol = EnumProperty( name="Gloss Col", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-glossy-color") pass_TransDir = EnumProperty( name="Trans Dir", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-trans") pass_TransInd = EnumProperty( name="Trans Ind", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-trans-indirect") pass_TransCol = EnumProperty( name="Trans Col", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-trans-color") pass_SubsurfaceDir = EnumProperty( name="SubSurface Dir", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-subsurface") pass_SubsurfaceInd = EnumProperty( name="SubSurface Ind", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-subsurface-indirect") pass_SubsurfaceCol = EnumProperty( name="SubSurface Col", #RGB (3 x float) description="Select the type of image you want to be displayed in this pass", - items=(renderPassItemsBasic+renderInternalPassAdvanced+renderPassItemsIndex+renderPassItemsDebug+renderPassItemsDepth+renderPassItemsAO + items=(renderPassAllItems ), default="adv-subsurface-color") From eb912fcef70bd4c1632431acb7b14681206f7978 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 25 Dec 2015 14:28:16 +0100 Subject: [PATCH 58/81] Render Views: avoid exceptions when switching from Stereo to Multiview --- io/yaf_export.py | 6 +++--- io/yaf_object.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/io/yaf_export.py b/io/yaf_export.py index dd4b0c0c..95b2225f 100755 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -413,7 +413,7 @@ def drawAreaCallback(*args): if scene.render.use_multiview: #due to Blender limitations while drawing the tiles, I cannot use the view names properly and I have to repeat the currently drawing tile into all views so it shows correctly. Maybe there is a better way? for view_number,view in enumerate(scene.render.views): - if view.use: + if view.use and not (scene.render.views_format == "STEREO_3D" and view.name != "left" and view.name != "right"): view_suffix = '.'+scene.render.views[view_number].name for tile in tiles: @@ -453,7 +453,7 @@ def flushCallback(*args): if scene.render.use_multiview: if view_name == "": #In case we use Render 3D vierpowrt with Views enabled, it will copy the result to all views for view_number,view in enumerate(scene.render.views): - if view.use: + if view.use and not (scene.render.views_format == "STEREO_3D" and view.name != "left" and view.name != "right"): full_tile_name = tile_name + "." + view.name try: l.passes[full_tile_name].rect = tile_bitmap @@ -461,7 +461,7 @@ def flushCallback(*args): print("Exporter: Exception while rendering in flushCallback function:") traceback.print_exc() else: - if scene.render.views[view_name].use: + if scene.render.views[view_name].use and not (scene.render.views_format == "STEREO_3D" and view_name != "left" and view_name != "right"): full_tile_name = tile_name + "." + view_name try: l.passes[full_tile_name].rect = tile_bitmap diff --git a/io/yaf_object.py b/io/yaf_object.py index a272a57f..12a6f629 100644 --- a/io/yaf_object.py +++ b/io/yaf_object.py @@ -64,7 +64,7 @@ def __init__ (self, camera, camera_name, view_name): camera_base_name = self.scene.camera.name.rsplit('_',1)[0] for view in render.views: - if view.use: + if view.use and not (render.views_format == "STEREO_3D" and view.name != "left" and view.name != "right"): cameras.append(CameraData(self.scene.objects[camera_base_name+view.camera_suffix], camera_base_name+view.camera_suffix, view.name)) for cam in cameras: From 059c0de14b16c16e773936ad900912ea729d0c92 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 25 Dec 2015 14:32:17 +0100 Subject: [PATCH 59/81] Material preview refresh problems - small improvement to the previous fix --- prop/yaf_material.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prop/yaf_material.py b/prop/yaf_material.py index ec2d3907..b9e13be4 100644 --- a/prop/yaf_material.py +++ b/prop/yaf_material.py @@ -42,7 +42,7 @@ def items_mat2(self, context): return(a) def update_preview(self, context): - bpy.data.materials[0].preview_render_type = bpy.data.materials[0].preview_render_type + context.material.preview_render_type = context.material.preview_render_type def register(): From 5de4dff9179b8c02099f062a95e379837a0c7678 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 25 Dec 2015 19:23:45 +0100 Subject: [PATCH 60/81] Textures optimized by default --- prop/yaf_scene.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 8d2d3f8e..cc88cad3 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -593,7 +593,7 @@ def register(): ('optimized', "Optimized", "Lossless optimization, good RAM improvement"), ('none', "None", "No optimization, lossless and faster but high RAM usage") ), - default='none') + default='optimized') ######### YafaRays own image output property ############ Scene.img_output = EnumProperty( From 0715d224d4958d59bf6cb9468991a2c43604b100 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Thu, 31 Dec 2015 08:29:17 +0100 Subject: [PATCH 61/81] Updating CHANGELOG for new release --- CHANGELOG | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 0912d969..960ee72b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,27 @@ Note: this CHANGELOG file only shows the YafaRay-E releases and changes, not the For more information about releases and changes see: https://github.com/DavidBluecame/Blender-Exporter/releases +Yafaray-E v2.0.0 (2015-12-31) for Blender 2.76b: +------------------------------------------------ +- STRUCTURAL CHANGES to implement Render Passes. The Passes are especially intended for Direct Light and Photon Mapping integrators. Some passes may not work (or work incorrectly) in other integrators. +- STRUCTURAL CHANGES to implement Render Views (Stereo3D / MultiView) +- STRUCTURAL CHANGES to implement a (hopefully) improved more automatic and reliable Shadow Bias and Intersection Bias, based on triangle size and coordinates positions. +- New Noise Control parameters, including a new clamping function to reduce noise at the cost of reducing physical accuracy and realism. +- RAM optimization options for JPG,PNG,TGA and TIFF textures. Using "optimized" (by default now) will reduce RAM usage for those textures in approx. 70%. The "optimized" option is lossless (except in TIFF 16bit). There is a "compressed" option that is lossy but allows an extra reduction of approx. 20% in RAM usage. +- Support for exporting in MultiLayer EXR files, that can be opened in Blender as well. +- XML rendering now supports an option to save partially rendered images every "x" seconds, probably useful when creaiting external GUIs to the XML interface. +- Ability to select what "internal" YafaRay Render Pass has to be mapped to an "external" Render Pass. This provides a lot of power and flexibility when generating Render Passes. +- Object ID/Material ID passes, with option of automatic ID color pass. +- Object ID Masking and Material ID masking (objects only, objects+shadows, shadows only) +- Debug passes and UV debug pass available to be able to find mesh/mapping/texturing problems at the same time as rendering the scene. +- Samplerate pass, to apply post-processing filters to the noisier parts of the render. +- Added dispersive caustics to SPPM. +- Changes to dispersion in rough glass. +- Removal of entire Qt interface. As far as we know it was old, unmaintained and probably useless anyway. +- A few speed improvements, I don't expect a significant change but I hope they help a bit, especially in 64bit systems. +- Fixes to the material preview to be correctly refreshed after any changes to the material properties. + + Yafaray-E v1.1.0 (2015-11-06) for Blender 2.76: ----------------------------------------------- From 2c0429b213c4f51855580d7f491e6b17e3e1cfbd Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 1 Jan 2016 11:22:21 +0100 Subject: [PATCH 62/81] Updating CHANGELOG for new release --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 960ee72b..27273a4d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,7 +4,7 @@ Note: this CHANGELOG file only shows the YafaRay-E releases and changes, not the For more information about releases and changes see: https://github.com/DavidBluecame/Blender-Exporter/releases -Yafaray-E v2.0.0 (2015-12-31) for Blender 2.76b: +Yafaray-E v2.0.0 (2016-01-01) for Blender 2.76b: ------------------------------------------------ - STRUCTURAL CHANGES to implement Render Passes. The Passes are especially intended for Direct Light and Photon Mapping integrators. Some passes may not work (or work incorrectly) in other integrators. - STRUCTURAL CHANGES to implement Render Views (Stereo3D / MultiView) From 2df009ad42665ac0f259118cdeddd58b0a1964e1 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 1 Jan 2016 15:00:28 +0100 Subject: [PATCH 63/81] Updating CHANGELOG for new release --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 27273a4d..cfe6725b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -21,6 +21,7 @@ Yafaray-E v2.0.0 (2016-01-01) for Blender 2.76b: - Added dispersive caustics to SPPM. - Changes to dispersion in rough glass. - Removal of entire Qt interface. As far as we know it was old, unmaintained and probably useless anyway. +- Fix (although horrible) for the Bidirectional integrator generating black renders with some types of lights. - A few speed improvements, I don't expect a significant change but I hope they help a bit, especially in 64bit systems. - Fixes to the material preview to be correctly refreshed after any changes to the material properties. From d9d5e1407c6217f7f5b80c5f2d495a5509abce57 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Tue, 5 Jan 2016 19:31:40 +0100 Subject: [PATCH 64/81] Version and changelog changes for Release --- CHANGELOG | 5 +++++ __init__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index cfe6725b..11e193be 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,11 @@ Note: this CHANGELOG file only shows the YafaRay-E releases and changes, not the For more information about releases and changes see: https://github.com/DavidBluecame/Blender-Exporter/releases +Yafaray-E v2.0.1 (2016-01-05) for Blender 2.76b: +------------------------------------------------ +- Fixed Instances not working in v2.0.0 (regression) + + Yafaray-E v2.0.0 (2016-01-01) for Blender 2.76b: ------------------------------------------------ - STRUCTURAL CHANGES to implement Render Passes. The Passes are especially intended for Direct Light and Photon Mapping integrators. Some passes may not work (or work incorrectly) in other integrators. diff --git a/__init__.py b/__init__.py index 572f36e6..dc8b87e2 100644 --- a/__init__.py +++ b/__init__.py @@ -35,7 +35,7 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": ('Experimental', 2, 0, 0), + "version": ('Experimental', 2, 0, 1), "blender": (2, 7, 6), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", From bf11649885decf0f18adae386b536b6c997a37c6 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sun, 24 Jan 2016 21:40:06 +0100 Subject: [PATCH 65/81] Increase range for dark areas AA detection parameter --- prop/yaf_scene.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index cc88cad3..ce1783c5 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -77,7 +77,7 @@ class YafaRayNoiseControlProperties(bpy.types.PropertyGroup): name="Dark areas noise detection factor", description=("Factor used to reduce the AA threshold in dark areas." " It will reduce noise in dark areas, but noise in bright areas will take longer"), - min=0.0, max=0.8, precision=2, + min=0.0, max=0.999, precision=3, default=0.0) variance_edge_size = IntProperty( From f0e4093a1dbad16a5c6dc1328ca56e937be4f290 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Tue, 26 Jan 2016 17:22:59 +0100 Subject: [PATCH 66/81] Fix crash with blend materials using blend materials as components whose components are missing If a blend material has, as components, other blend materials and those blend materials have component materials missing, there is a crash. Reported in: http://www.yafaray.org/node/708 Fixed by forcing the blend material not to be created when any of the component/subcomponent blend materials have any issues --- io/yaf_export.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/io/yaf_export.py b/io/yaf_export.py index 95b2225f..7d6a263b 100755 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -201,18 +201,24 @@ def handleBlendMat(self, mat): self.yi.printWarning("Exporter: Problem with blend material:\"{0}\". Could not find the second material:\"{1}\"".format(mat.name,mat.material2name)) blendmat_error = True if blendmat_error: - return + return blendmat_error if mat1.name == mat2.name: self.yi.printWarning("Exporter: Problem with blend material \"{0}\". \"{1}\" and \"{2}\" to blend are the same materials".format(mat.name, mat1.name, mat2.name)) if mat1.mat_type == 'blend': - self.handleBlendMat(mat1) + blendmat_error = self.handleBlendMat(mat1) + if blendmat_error: + return + elif mat1 not in self.materials: self.materials.add(mat1) self.yaf_material.writeMaterial(mat1, self.scene) if mat2.mat_type == 'blend': - self.handleBlendMat(mat2) + blendmat_error = self.handleBlendMat(mat2) + if blendmat_error: + return + elif mat2 not in self.materials: self.materials.add(mat2) self.yaf_material.writeMaterial(mat2, self.scene) From 810e0288aa988e9e69724b235f39b3c62c6f0a39 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Tue, 26 Jan 2016 19:30:39 +0100 Subject: [PATCH 67/81] Increase limit for dark threshold factor up to 1.0 --- prop/yaf_scene.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index ce1783c5..a0968c9d 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -77,7 +77,7 @@ class YafaRayNoiseControlProperties(bpy.types.PropertyGroup): name="Dark areas noise detection factor", description=("Factor used to reduce the AA threshold in dark areas." " It will reduce noise in dark areas, but noise in bright areas will take longer"), - min=0.0, max=0.999, precision=3, + min=0.0, max=1.0, precision=3, default=0.0) variance_edge_size = IntProperty( From 8ed101f0676531730eb9e296d91f08370b8eefac Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Tue, 26 Jan 2016 22:49:23 +0100 Subject: [PATCH 68/81] Version and Changelog changes before release --- CHANGELOG | 9 +++++++++ __init__.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 11e193be..1ee4b80b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,15 @@ Note: this CHANGELOG file only shows the YafaRay-E releases and changes, not the For more information about releases and changes see: https://github.com/DavidBluecame/Blender-Exporter/releases + +Yafaray-E v2.0.2 (2016-01-26) for Blender 2.76b: +------------------------------------------------ +- Fixed crash when Blend materials were used and their components were also blend, which had some component materials missing +- Max value for the dark noise factor parameter expanded to 1.0 to allow even darker areas to have better AA sampling +- Fix for Oren Nayar to avoid generating white/black dots when used together with bump mapping +- Fix for black dots using HDRI spherical and Coated Glossy + + Yafaray-E v2.0.1 (2016-01-05) for Blender 2.76b: ------------------------------------------------ - Fixed Instances not working in v2.0.0 (regression) diff --git a/__init__.py b/__init__.py index dc8b87e2..4452d266 100644 --- a/__init__.py +++ b/__init__.py @@ -35,7 +35,7 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": ('Experimental', 2, 0, 1), + "version": ('Experimental', 2, 0, 2), "blender": (2, 7, 6), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", From 4334b1ee558b855a0581219e58b9f13d161c824c Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Wed, 27 Jan 2016 23:01:53 +0100 Subject: [PATCH 69/81] Increase max value for the sample multiplier factors from 2.0 to 4.0 As requested by samo in: http://www.yafaray.org/node/690#comment-1364 --- prop/yaf_scene.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index a0968c9d..46d4aa9d 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -53,19 +53,19 @@ class YafaRayNoiseControlProperties(bpy.types.PropertyGroup): sample_multiplier_factor = FloatProperty( name="AA sample multiplier factor", description="Factor to increase the AA samples multiplier for next AA pass", - min=1.0, max=2.0, precision=2, + min=1.0, max=4.0, precision=2, default=1.0) light_sample_multiplier_factor = FloatProperty( name="Light sample multiplier factor", description="Factor to increase the light samples multiplier for next AA pass", - min=1.0, max=2.0, precision=2, + min=1.0, max=4.0, precision=2, default=1.0) indirect_sample_multiplier_factor = FloatProperty( name="Indirect sample multiplier factor", description="Factor to increase the indirect samples (FG for example) multiplier for next AA pass", - min=1.0, max=2.0, precision=2, + min=1.0, max=4.0, precision=2, default=1.0) detect_color_noise = BoolProperty( From ea98a022b431bb0a0e55527957daa4b981c8b747 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sun, 31 Jan 2016 10:31:06 +0100 Subject: [PATCH 70/81] Advanced Controls for Material/Texture Preview As requested in http://yafaray.org/node/699 I've made some changes to allow fine-grained control of the Material and Texture Preview window. The new features are: * Ability to change key light incident angle, so we can place the terminator area on the preview object.: new parameter added to rotate the lights in the Preview window around the preview object. That should allow to set the lights in different angles to look the material under different light conditions * Ability to focus in the observer's terminator area: added parameters to displace the preview object up/down, left/right as well as to scale the preview object. This way, the terminator area can be better explored in detail * Ability to change light power in the material previsualisation window: added a power factor parameter for the lights and another parameter to set the color of the lights themselves to experiment with different lighting conditions on the material * Ability to change previsualisation object size: with the parameter to scale the object plus added parameters to scale/displace the texture as well in the preview * Rendering an object from the scene as a previsualisation object: added a parameter to select an arbitrary object from the blend scene as preview object. * Background selection: added a parameter to select the desired background: "checker" is the default, "none" is a white background and "world" would be the blend scene world definition. Selecting "world" would allow a more realistic and customized material preview, but it will probably be noisier and slower (depending on the samples selected in the World definition) Changes to be committed: modified: io/yaf_export.py modified: io/yaf_integrator.py modified: io/yaf_light.py modified: io/yaf_material.py modified: io/yaf_object.py modified: prop/yaf_scene.py modified: ui/properties_yaf_material.py modified: ui/properties_yaf_texture.py --- io/yaf_export.py | 8 ++- io/yaf_integrator.py | 3 + io/yaf_light.py | 16 ++++- io/yaf_material.py | 9 ++- io/yaf_object.py | 27 +++++++- prop/yaf_scene.py | 124 ++++++++++++++++++++++++++++++++++ ui/properties_yaf_material.py | 42 ++++++++++++ ui/properties_yaf_texture.py | 43 ++++++++++++ 8 files changed, 262 insertions(+), 10 deletions(-) diff --git a/io/yaf_export.py b/io/yaf_export.py index 7d6a263b..5b301945 100755 --- a/io/yaf_export.py +++ b/io/yaf_export.py @@ -75,7 +75,11 @@ def exportScene(self): self.yaf_object.setScene(self.scene) self.exportObjects() self.yaf_object.createCameras() - self.yaf_world.exportWorld(self.scene) + + if self.is_preview and bpy.data.scenes[0].yafaray.preview.enable and bpy.data.scenes[0].yafaray.preview.previewBackground == "world": + self.yaf_world.exportWorld(bpy.data.scenes[0]) + else: + self.yaf_world.exportWorld(self.scene) def exportTexture(self, obj): # First export the textures of the materials type 'blend' @@ -201,7 +205,7 @@ def handleBlendMat(self, mat): self.yi.printWarning("Exporter: Problem with blend material:\"{0}\". Could not find the second material:\"{1}\"".format(mat.name,mat.material2name)) blendmat_error = True if blendmat_error: - return blendmat_error + return blendmat_error if mat1.name == mat2.name: self.yi.printWarning("Exporter: Problem with blend material \"{0}\". \"{1}\" and \"{2}\" to blend are the same materials".format(mat.name, mat1.name, mat2.name)) diff --git a/io/yaf_integrator.py b/io/yaf_integrator.py index edf1dbea..16e89853 100644 --- a/io/yaf_integrator.py +++ b/io/yaf_integrator.py @@ -18,6 +18,7 @@ # +import bpy class yafIntegrator: def __init__(self, interface): @@ -35,6 +36,8 @@ def exportIntegrator(self, scene): yi.paramsSetBool("bg_transp_refract", False) yi.paramsSetInt("raydepth", scene.gs_ray_depth) + if scene.name == "preview" and bpy.data.scenes[0].yafaray.preview.enable: + yi.paramsSetInt("raydepth", bpy.data.scenes[0].yafaray.preview.previewRayDepth) yi.paramsSetInt("shadowDepth", scene.gs_shadow_depth) yi.paramsSetBool("transpShad", scene.gs_transp_shad) diff --git a/io/yaf_light.py b/io/yaf_light.py index ff01add6..29d6dbc3 100644 --- a/io/yaf_light.py +++ b/io/yaf_light.py @@ -19,10 +19,18 @@ # import os -from mathutils import Vector +import mathutils +import bpy from math import degrees, pi, sin, cos from bpy.path import abspath +def multiplyMatrix4x4Vector4(matrix, vector): + result = mathutils.Vector((0.0, 0.0, 0.0, 0.0)) + for i in range(4): + result[i] = vector * matrix[i] # use reverse vector multiply order, API changed with rev. 38674 + + return result + class yafLight: def __init__(self, interface, preview): self.yi = interface @@ -96,6 +104,12 @@ def createLight(self, yi, lamp_object, matrix=None): elif name == "Lamp.008": lampType = "sun" power = 0.8 + + if bpy.data.scenes[0].yafaray.preview.enable: + matrix2 = mathutils.Matrix.Rotation(bpy.data.scenes[0].yafaray.preview.lightRotZ, 4, 'Z') + pos = multiplyMatrix4x4Vector4(matrix2, mathutils.Vector((pos[0], pos[1], pos[2], pos[3]))) + color = bpy.data.scenes[0].yafaray.preview.lightColor + power *= bpy.data.scenes[0].yafaray.preview.lightPowerFactor yi.paramsClearAll() diff --git a/io/yaf_material.py b/io/yaf_material.py index 10a645bc..c2229147 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -191,13 +191,12 @@ def writeMappingNode(self, name, texname, mtex): mappingCoords = switchMappingCoords.get(mtex.mapping, 'plain') yi.paramsSetString("mapping", mappingCoords) - yi.paramsSetPoint("offset", mtex.offset[0], mtex.offset[1], mtex.offset[2]) - if self.preview: # check if it is a texture preview render - mtex_X = mtex.scale[0] * 8.998 # tex preview fix: scale X value of tex size for the stretched Plane Mesh in preview scene - mtex_Z = mtex.scale[2] * 0.00001 # and for Z value of texture size also... - yi.paramsSetPoint("scale", mtex_X, mtex.scale[1], mtex_Z) + if self.preview and bpy.data.scenes[0].yafaray.preview.enable: + yi.paramsSetPoint("scale", mtex.scale[0]*bpy.data.scenes[0].yafaray.preview.textureScale[0], mtex.scale[1]*bpy.data.scenes[0].yafaray.preview.textureScale[1], mtex.scale[2]) + yi.paramsSetPoint("offset", mtex.offset[0]+bpy.data.scenes[0].yafaray.preview.textureOffset[0], mtex.offset[1]+bpy.data.scenes[0].yafaray.preview.textureOffset[1], mtex.offset[2]) else: yi.paramsSetPoint("scale", mtex.scale[0], mtex.scale[1], mtex.scale[2]) + yi.paramsSetPoint("offset", mtex.offset[0], mtex.offset[1], mtex.offset[2]) if mtex.use_map_normal: # || mtex->maptoneg & MAP_NORM ) # scale up the normal factor, it resembles diff --git a/io/yaf_object.py b/io/yaf_object.py index 12a6f629..7405b67a 100644 --- a/io/yaf_object.py +++ b/io/yaf_object.py @@ -215,7 +215,13 @@ def writeObject(self, obj, matrix=None): self.writeParticleStrands(obj, matrix) else: # The rest of the object types - self.writeMesh(obj, matrix) + if self.is_preview and bpy.data.scenes[0].yafaray.preview.enable: + if "checkers" in obj.name and bpy.data.scenes[0].yafaray.preview.previewBackground == "checker": + self.writeMesh(obj, matrix) + elif "checkers" not in obj.name: + self.writeMesh(obj, matrix) + else: + self.writeMesh(obj, matrix) def writeInstanceBase(self, obj): @@ -256,7 +262,11 @@ def writeMesh(self, obj, matrix): self.yi.paramsClearAll() self.yi.paramsSetInt("obj_pass_index", obj.pass_index) - self.writeGeometry(ID, obj, matrix, obj.pass_index) # obType in 0, default, the object is rendered + if self.is_preview and bpy.data.scenes[0].yafaray.preview.enable and bpy.data.scenes[0].yafaray.preview.previewObject != "" and "preview" in obj.name and bpy.data.scenes[0].objects[bpy.data.scenes[0].yafaray.preview.previewObject].type=="MESH": + ymat = self.materialMap[obj.active_material] + self.writeGeometry(ID, bpy.data.scenes[0].objects[bpy.data.scenes[0].yafaray.preview.previewObject], matrix, obj.pass_index, 0, ymat) + else: + self.writeGeometry(ID, obj, matrix, obj.pass_index) # obType in 0, default, the object is rendered def writeBGPortal(self, obj, matrix): @@ -435,6 +445,19 @@ def writeGeometry(self, ID, obj, matrix, pass_index, obType=0, oMat=None): # Transform the mesh after orcos have been stored and only if matrix exists if matrix is not None: mesh.transform(matrix) + + if self.is_preview: + if("checker" in obj.name): + matrix2 = mathutils.Matrix.Scale(4, 4) + mesh.transform(matrix2) + elif bpy.data.scenes[0].yafaray.preview.enable: + matrix2 = mathutils.Matrix.Scale(bpy.data.scenes[0].yafaray.preview.objScale, 4) + mesh.transform(matrix2) + matrix2 = mathutils.Matrix.Rotation(bpy.data.scenes[0].yafaray.preview.rotZ, 4, 'Z') + mesh.transform(matrix2) + matrix2 = matrix2 = mathutils.Matrix.Translation(mathutils.Vector((bpy.data.scenes[0].yafaray.preview.posX, bpy.data.scenes[0].yafaray.preview.posY, bpy.data.scenes[0].yafaray.preview.posZ))) + mesh.transform(matrix2) + pass self.yi.paramsClearAll() self.yi.startGeometry() diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 46d4aa9d..64141623 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -18,6 +18,7 @@ # +import math import bpy from sys import platform from bpy.props import (IntProperty, @@ -31,6 +32,8 @@ Scene = bpy.types.Scene +def update_preview(self, context): + context.material.preview_render_type = context.material.preview_render_type # set fileformat for image saving on same format as in YafaRay, both have default PNG def call_update_fileformat(self, context): @@ -425,6 +428,123 @@ class YafaRayRenderPassesProperties(bpy.types.PropertyGroup): ), default="adv-subsurface-color") +class YafaRayMaterialPreviewControlProperties(bpy.types.PropertyGroup): + + enable = BoolProperty( + update=update_preview, + name="Material Preview Controls enabled", + description="Enable/Disable material preview controls", + default=False) + + objScale = FloatProperty( + update=update_preview, + name="objScale", + description=("Material Preview object scaling factor"), + min=0.1, max=10.0, precision=2, step=10, + default=1.0) + + rotZ = FloatProperty( + update=update_preview, + name="rotZ", + description=("Material Preview object rotation Z axis"), + precision=1, step=1000, + #min=math.radians(-360), max=math.radians(360), + subtype="ANGLE", unit="ROTATION", + default=0.0) + + lightRotZ = FloatProperty( + update=update_preview, + name="lightRotZ", + description=("Material Preview light rotation Z axis"), + precision=1, step=1000, + #min=math.radians(-360), max=math.radians(360), + subtype="ANGLE", unit="ROTATION", + default=0.0) + + posX = FloatProperty( + update=update_preview, + name="posX", + description=("Material Preview object position X"), + min=-10.0, max=10.0, precision=2, step=50, + default=0.0) + + posY = FloatProperty( + update=update_preview, + name="posY", + description=("Material Preview object position Y"), + min=-10.0, max=10.0, precision=2, step=50, + default=0.0) + + posZ = FloatProperty( + update=update_preview, + name="posZ", + description=("Material Preview object position Z"), + min=-10.0, max=10.0, precision=2, step=50, + default=0.0) + + lightPowerFactor = FloatProperty( + update=update_preview, + name="lightPowerFactor", + description=("Material Preview power factor for lights"), + min=0.0, max=10.0, precision=2, step=10, + default=1.0) + + lightColor = FloatVectorProperty( + update=update_preview, + name="lightColor", + description=("Material Preview color for lights"), + subtype='COLOR', + step=1, precision=2, + min=0.0, max=1.0, + soft_min=0.0, soft_max=1.0, + default=(1.0, 1.0, 1.0)) + + textureScale = FloatVectorProperty( + update=update_preview, + name="textureScale", + description=("Material Preview texture scaling factors"), + subtype='XYZ', + size=2, + step=1, precision=2, + #min=0.0, max=1.0, + #soft_min=0.0, soft_max=1.0, + default=(1.0, 1.0)) + + textureOffset = FloatVectorProperty( + update=update_preview, + name="textureOffset", + description=("Material Preview texture offset values"), + subtype='XYZ', + size=2, + step=1, precision=2, + #min=0.0, max=1.0, + #soft_min=0.0, soft_max=1.0, + default=(0.0, 0.0)) + + previewRayDepth = IntProperty( + update=update_preview, + name="previewRayDepth", + description=("Material Preview max ray depth, set higher for better (slower) glass preview"), + min=0, max=64, default=2) + + previewBackground = EnumProperty( + update=update_preview, + name="previewBackground", + description=("Material Preview background type"), + items=( + ('none', "None", "No background", 0), + ('checker', "Checker", "Checker background (default)", 1), + ('world', "Scene World", "Scene world background (can be slow!)", 2) + ), + default="checker") + + previewObject = StringProperty( + update=update_preview, + name="previewObject", + description=("Material Preview custom object to be shown, if empty will use default preview objects"), + default="") + + def register(): ########### YafaRays general settings properties ############# Scene.gs_ray_depth = IntProperty( @@ -834,6 +954,9 @@ def register(): bpy.utils.register_class(YafaRayNoiseControlProperties) YafaRayProperties.noise_control = PointerProperty(type=YafaRayNoiseControlProperties) + bpy.utils.register_class(YafaRayMaterialPreviewControlProperties) + YafaRayProperties.preview = PointerProperty(type=YafaRayMaterialPreviewControlProperties) + def unregister(): Scene.gs_ray_depth Scene.gs_shadow_depth @@ -905,4 +1028,5 @@ def unregister(): bpy.utils.unregister_class(YafaRayNoiseControlProperties) bpy.utils.unregister_class(YafaRayRenderPassesProperties) + bpy.utils.unregister_class(YafaRayMaterialPreviewControlProperties) bpy.utils.unregister_class(YafaRayProperties) diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index a61c00a2..6b22e9ff 100755 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -121,6 +121,48 @@ class YAF_MATERIAL_PT_preview(MaterialButtonsPanel, Panel): def draw(self, context): self.layout.template_preview(context.material) +class YAF_PT_preview_controls(MaterialButtonsPanel, Panel): + bl_label = "Preview Controls" + COMPAT_ENGINES = {'YAFA_RENDER'} + #bl_options = {'DEFAULT_CLOSED'} + + def draw_header(self, context): + scene = context.scene + self.layout.prop(context.scene.yafaray.preview, "enable", text="") + + def draw(self, context): + if context.scene.yafaray.preview.enable: + layout = self.layout + yaf_mat = active_node_mat(context.material) + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "objScale") + col = split.column() + col.prop(context.scene.yafaray.preview, "rotZ") + col = split.column() + col.prop(context.scene.yafaray.preview, "lightRotZ") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "posX") + col = split.column() + col.prop(context.scene.yafaray.preview, "posZ") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "textureScale") + col = split.column() + col.prop(context.scene.yafaray.preview, "textureOffset") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "lightPowerFactor") + col = split.column() + col.prop(context.scene.yafaray.preview, "lightColor", text="") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "previewRayDepth") + col = split.column() + col.prop(context.scene.yafaray.preview, "previewBackground", text="") + col = split.column() + col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") def draw_generator(ior_n): def draw(self, context): diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index 4b2d96d2..ace291a8 100755 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -135,6 +135,49 @@ def draw(self, context): if context.space_data.texture_context == 'BRUSH': layout.prop(tex, "use_preview_alpha") +class YAF_PT_preview_texture_controls(YAF_TextureButtonsPanel, Panel): + bl_label = "Preview Controls" + COMPAT_ENGINES = {'YAFA_RENDER'} + #bl_options = {'DEFAULT_CLOSED'} + + def draw_header(self, context): + scene = context.scene + self.layout.prop(context.scene.yafaray.preview, "enable", text="") + + def draw(self, context): + if context.scene.yafaray.preview.enable: + layout = self.layout + yaf_mat = active_node_mat(context.material) + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "objScale") + col = split.column() + col.prop(context.scene.yafaray.preview, "rotZ") + col = split.column() + col.prop(context.scene.yafaray.preview, "lightRotZ") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "posX") + col = split.column() + col.prop(context.scene.yafaray.preview, "posZ") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "textureScale") + col = split.column() + col.prop(context.scene.yafaray.preview, "textureOffset") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "lightPowerFactor") + col = split.column() + col.prop(context.scene.yafaray.preview, "lightColor", text="") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "previewRayDepth") + col = split.column() + col.prop(context.scene.yafaray.preview, "previewBackground") + col = split.column() + col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") + class YAF_TextureSlotPanel(YAF_TextureButtonsPanel): COMPAT_ENGINES = {'YAFA_RENDER'} From 90e7d315f9ef83f015f7a319502679d5630b9172 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sun, 31 Jan 2016 15:45:00 +0100 Subject: [PATCH 71/81] Version and Changelog changes before Release --- CHANGELOG | 25 +++++++++++++++++++++++++ __init__.py | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 1ee4b80b..089e95d4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,31 @@ Note: this CHANGELOG file only shows the YafaRay-E releases and changes, not the For more information about releases and changes see: https://github.com/DavidBluecame/Blender-Exporter/releases +Yafaray-E v2.1.0 (2016-01-31) for Blender 2.76b: +------------------------------------------------ + +- Added Normal Coordinates for textures, so you can use a gradient texture mapped to normal coordinates to simulate, for example, some cloth materials (see http://yafaray.org/node/188 ) +- Fixed some crashes when changing Material/Texture settings +- Increased max limit for Sample Multiplier Factor from 2.0 to 4.0 so more steep exponential increase of samples can be done for every pass. Be aware that the number of samples will grow very fast in every pass if the factor is above 1.5. + +- Advanced Controls for Material/Texture Preview + As requested in http://yafaray.org/node/699 I've made some changes to allow fine-grained control of the Material and Texture Preview window. + + Some videos explaining the new feature: + + * First tests (outdated): https://www.youtube.com/watch?v=AFWcHgufkBw + * Latest video with all features: https://www.youtube.com/watch?v=jBgzqZFQ3Y8 + + The new features are: + + * Ability to change key light incident angle, so we can place the terminator area on the preview object.: new parameter added to rotate the lights in the Preview window around the preview object. That should allow to set the lights in different angles to look the material under different light conditions + * Ability to focus in the observer's terminator area: added parameters to displace the preview object up/down, left/right as well as to scale the preview object. This way, the terminator area can be better explored in detail + * Ability to change light power in the material previsualisation window: added a power factor parameter for the lights and another parameter to set the color of the lights themselves to experiment with different lighting conditions on the material + * Ability to change previsualisation object size: with the parameter to scale the object plus added parameters to scale/displace the texture as well in the preview + * Rendering an object from the scene as a previsualisation object: added a parameter to select an arbitrary object from the blend scene as preview object. + * Background selection: added a parameter to select the desired background: "checker" is the default, "none" is a white background and "world" would be the blend scene world definition. Selecting "world" would allow a more realistic and customized material preview, but it will probably be noisier and slower (depending on the samples selected in the World definition) + + Yafaray-E v2.0.2 (2016-01-26) for Blender 2.76b: ------------------------------------------------ - Fixed crash when Blend materials were used and their components were also blend, which had some component materials missing diff --git a/__init__.py b/__init__.py index 4452d266..330607bc 100644 --- a/__init__.py +++ b/__init__.py @@ -35,7 +35,7 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": ('Experimental', 2, 0, 2), + "version": ('Experimental', 2, 1, 0), "blender": (2, 7, 6), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", From 3515ee77f972aee04cae29b5b8423afc6df212f1 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Mon, 1 Feb 2016 20:47:59 +0100 Subject: [PATCH 72/81] Changes to the new Material Preview Controls: * Removed PosX,PosZ controls * Removed Texture scale/offset controls * Added AA Passes control for progressively refining the material rendering * Splitted the Light power control in two: Key Light power control and Fill Lights power control --- io/yaf_light.py | 6 +++- io/yaf_material.py | 8 ++--- io/yaf_object.py | 2 -- io/yaf_scene.py | 8 +++++ prop/yaf_scene.py | 60 +++++++++-------------------------- ui/properties_yaf_material.py | 14 +++----- ui/properties_yaf_texture.py | 14 +++----- 7 files changed, 38 insertions(+), 74 deletions(-) diff --git a/io/yaf_light.py b/io/yaf_light.py index 29d6dbc3..343c220c 100644 --- a/io/yaf_light.py +++ b/io/yaf_light.py @@ -94,22 +94,26 @@ def createLight(self, yi, lamp_object, matrix=None): if name == "Lamp": pos = (-6, -4, 8, 1.0) power = 5 + power *= bpy.data.scenes[0].yafaray.preview.fillLightPowerFactor + elif name == "Lamp.001": pos = (6, -6, -2, 1.0) power = 6 + power *= bpy.data.scenes[0].yafaray.preview.fillLightPowerFactor elif name == "Lamp.002": pos = (-2.9123109, -7.270790733, 4.439187765, 1.0) to = (-0.0062182024121284485, 0.6771485209465027, 1.8015732765197754, 1.0) power = 5 + power *= bpy.data.scenes[0].yafaray.preview.keyLightPowerFactor elif name == "Lamp.008": lampType = "sun" power = 0.8 + power *= bpy.data.scenes[0].yafaray.preview.keyLightPowerFactor if bpy.data.scenes[0].yafaray.preview.enable: matrix2 = mathutils.Matrix.Rotation(bpy.data.scenes[0].yafaray.preview.lightRotZ, 4, 'Z') pos = multiplyMatrix4x4Vector4(matrix2, mathutils.Vector((pos[0], pos[1], pos[2], pos[3]))) color = bpy.data.scenes[0].yafaray.preview.lightColor - power *= bpy.data.scenes[0].yafaray.preview.lightPowerFactor yi.paramsClearAll() diff --git a/io/yaf_material.py b/io/yaf_material.py index c2229147..2d474505 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -191,12 +191,8 @@ def writeMappingNode(self, name, texname, mtex): mappingCoords = switchMappingCoords.get(mtex.mapping, 'plain') yi.paramsSetString("mapping", mappingCoords) - if self.preview and bpy.data.scenes[0].yafaray.preview.enable: - yi.paramsSetPoint("scale", mtex.scale[0]*bpy.data.scenes[0].yafaray.preview.textureScale[0], mtex.scale[1]*bpy.data.scenes[0].yafaray.preview.textureScale[1], mtex.scale[2]) - yi.paramsSetPoint("offset", mtex.offset[0]+bpy.data.scenes[0].yafaray.preview.textureOffset[0], mtex.offset[1]+bpy.data.scenes[0].yafaray.preview.textureOffset[1], mtex.offset[2]) - else: - yi.paramsSetPoint("scale", mtex.scale[0], mtex.scale[1], mtex.scale[2]) - yi.paramsSetPoint("offset", mtex.offset[0], mtex.offset[1], mtex.offset[2]) + yi.paramsSetPoint("scale", mtex.scale[0], mtex.scale[1], mtex.scale[2]) + yi.paramsSetPoint("offset", mtex.offset[0], mtex.offset[1], mtex.offset[2]) if mtex.use_map_normal: # || mtex->maptoneg & MAP_NORM ) # scale up the normal factor, it resembles diff --git a/io/yaf_object.py b/io/yaf_object.py index 7405b67a..86e8ffc6 100644 --- a/io/yaf_object.py +++ b/io/yaf_object.py @@ -455,8 +455,6 @@ def writeGeometry(self, ID, obj, matrix, pass_index, obType=0, oMat=None): mesh.transform(matrix2) matrix2 = mathutils.Matrix.Rotation(bpy.data.scenes[0].yafaray.preview.rotZ, 4, 'Z') mesh.transform(matrix2) - matrix2 = matrix2 = mathutils.Matrix.Translation(mathutils.Vector((bpy.data.scenes[0].yafaray.preview.posX, bpy.data.scenes[0].yafaray.preview.posY, bpy.data.scenes[0].yafaray.preview.posZ))) - mesh.transform(matrix2) pass self.yi.paramsClearAll() diff --git a/io/yaf_scene.py b/io/yaf_scene.py index 1ed134a6..26edff1a 100755 --- a/io/yaf_scene.py +++ b/io/yaf_scene.py @@ -18,6 +18,7 @@ # +import bpy def computeSceneSize(render): sizeX = int(render.resolution_x * render.resolution_percentage * 0.01) @@ -90,6 +91,10 @@ def exportAA(yi, scene): yi.paramsSetFloat("AA_clamp_samples", scene.yafaray.noise_control.clamp_samples) yi.paramsSetFloat("AA_clamp_indirect", scene.yafaray.noise_control.clamp_indirect) + if scene.name == "preview" and bpy.data.scenes[0].yafaray.preview.enable: + yi.paramsSetInt("AA_passes", bpy.data.scenes[0].yafaray.preview.previewAApasses) + yi.paramsSetFloat("AA_threshold", 0.01) + def exportRenderSettings(yi, scene): yi.printInfo("Exporting Render Settings") @@ -149,6 +154,9 @@ def exportRenderSettings(yi, scene): yi.paramsSetBool("show_sam_pix", scene.gs_show_sam_pix) + if scene.name == "preview" and bpy.data.scenes[0].yafaray.preview.enable: + yi.paramsSetBool("show_sam_pix", False) + if scene.gs_type_render == "file" or scene.gs_type_render == "xml": yi.paramsSetBool("premult", scene.gs_premult) else: diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 64141623..2be1c56b 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -461,33 +461,19 @@ class YafaRayMaterialPreviewControlProperties(bpy.types.PropertyGroup): subtype="ANGLE", unit="ROTATION", default=0.0) - posX = FloatProperty( + keyLightPowerFactor = FloatProperty( update=update_preview, - name="posX", - description=("Material Preview object position X"), - min=-10.0, max=10.0, precision=2, step=50, - default=0.0) - - posY = FloatProperty( - update=update_preview, - name="posY", - description=("Material Preview object position Y"), - min=-10.0, max=10.0, precision=2, step=50, - default=0.0) - - posZ = FloatProperty( - update=update_preview, - name="posZ", - description=("Material Preview object position Z"), - min=-10.0, max=10.0, precision=2, step=50, - default=0.0) + name="keyLightPowerFactor", + description=("Material Preview power factor for the key light"), + min=0.0, max=10.0, precision=2, step=10, + default=1.0) - lightPowerFactor = FloatProperty( + fillLightPowerFactor = FloatProperty( update=update_preview, name="lightPowerFactor", - description=("Material Preview power factor for lights"), + description=("Material Preview power factor for the fill lights"), min=0.0, max=10.0, precision=2, step=10, - default=1.0) + default=0.5) lightColor = FloatVectorProperty( update=update_preview, @@ -499,33 +485,17 @@ class YafaRayMaterialPreviewControlProperties(bpy.types.PropertyGroup): soft_min=0.0, soft_max=1.0, default=(1.0, 1.0, 1.0)) - textureScale = FloatVectorProperty( - update=update_preview, - name="textureScale", - description=("Material Preview texture scaling factors"), - subtype='XYZ', - size=2, - step=1, precision=2, - #min=0.0, max=1.0, - #soft_min=0.0, soft_max=1.0, - default=(1.0, 1.0)) - - textureOffset = FloatVectorProperty( - update=update_preview, - name="textureOffset", - description=("Material Preview texture offset values"), - subtype='XYZ', - size=2, - step=1, precision=2, - #min=0.0, max=1.0, - #soft_min=0.0, soft_max=1.0, - default=(0.0, 0.0)) - previewRayDepth = IntProperty( update=update_preview, name="previewRayDepth", description=("Material Preview max ray depth, set higher for better (slower) glass preview"), - min=0, max=64, default=2) + min=0, max=20, default=2) + + previewAApasses = IntProperty( + update=update_preview, + name="previewAApasses", + description=("Material Preview AA passes, set higher for better (slower) preview"), + min=1, max=20, default=1) previewBackground = EnumProperty( update=update_preview, diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index 6b22e9ff..46115521 100755 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -143,23 +143,17 @@ def draw(self, context): col.prop(context.scene.yafaray.preview, "lightRotZ") split = layout.split() col = split.column() - col.prop(context.scene.yafaray.preview, "posX") + col.prop(context.scene.yafaray.preview, "keyLightPowerFactor") col = split.column() - col.prop(context.scene.yafaray.preview, "posZ") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "textureScale") - col = split.column() - col.prop(context.scene.yafaray.preview, "textureOffset") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "lightPowerFactor") + col.prop(context.scene.yafaray.preview, "fillLightPowerFactor") col = split.column() col.prop(context.scene.yafaray.preview, "lightColor", text="") split = layout.split() col = split.column() col.prop(context.scene.yafaray.preview, "previewRayDepth") col = split.column() + col.prop(context.scene.yafaray.preview, "previewAApasses") + col = split.column() col.prop(context.scene.yafaray.preview, "previewBackground", text="") col = split.column() col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index ace291a8..97ba1570 100755 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -157,23 +157,17 @@ def draw(self, context): col.prop(context.scene.yafaray.preview, "lightRotZ") split = layout.split() col = split.column() - col.prop(context.scene.yafaray.preview, "posX") + col.prop(context.scene.yafaray.preview, "keyLightPowerFactor") col = split.column() - col.prop(context.scene.yafaray.preview, "posZ") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "textureScale") - col = split.column() - col.prop(context.scene.yafaray.preview, "textureOffset") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "lightPowerFactor") + col.prop(context.scene.yafaray.preview, "fillLightPowerFactor") col = split.column() col.prop(context.scene.yafaray.preview, "lightColor", text="") split = layout.split() col = split.column() col.prop(context.scene.yafaray.preview, "previewRayDepth") col = split.column() + col.prop(context.scene.yafaray.preview, "previewAApasses") + col = split.column() col.prop(context.scene.yafaray.preview, "previewBackground") col = split.column() col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") From 0de6894a378b11f6a257f8886ca7b852d1e5abf8 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Wed, 3 Feb 2016 20:48:50 +0100 Subject: [PATCH 73/81] Added Preview Dynamic camera rotation. Fixed object centering and custom object center+scale I've added code to add Dynamic camera rotation using the mouse. * It requires to click a button "start dynamic camera rotation". After clicking that button, if you drag with the mouse (holding pressed the left mouse key), the preview window will rotate around the object. * If holding CTRL while dragging up and down, it will change the distance of the camera respect to the object (to get a zoom effect). * During this "dynamic rotation" mode the mouse will not interact with buttons in the screen. * To exit this "dynamic rotation" mode, press "ESC" or click the right mouse button. Also, added extra code so the object being displayed is centered so any rotation keeps it in the center. Also fixed a problem that caused the custom objects to have different scaling respect to the modeled object. --- io/yaf_object.py | 29 +++++++++- prop/yaf_scene.py | 103 +++++++++++++++++++++++++++++++++- ui/properties_yaf_material.py | 15 +++++ ui/properties_yaf_texture.py | 16 +++++- 4 files changed, 158 insertions(+), 5 deletions(-) diff --git a/io/yaf_object.py b/io/yaf_object.py index 86e8ffc6..2157b21a 100644 --- a/io/yaf_object.py +++ b/io/yaf_object.py @@ -165,6 +165,17 @@ def __init__ (self, camera, camera_name, view_name): yi.paramsSetInt("resx", x) yi.paramsSetInt("resy", y) + if self.is_preview and bpy.data.scenes[0].yafaray.preview.enable: + + incl = bpy.data.scenes[0].yafaray.preview.camRotIncl + azi = bpy.data.scenes[0].yafaray.preview.camRotAzi + rotZ = bpy.data.scenes[0].yafaray.preview.camRotZ + dist = bpy.data.scenes[0].yafaray.preview.camDist + + pos = (dist*math.sin(incl)*math.cos(azi), dist*math.sin(incl)*math.sin(azi), dist*math.cos(incl)) + up = (math.sin(rotZ), 0, math.cos(rotZ)) + to = (0,0,0) + yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) yi.paramsSetPoint("up", up[0], up[1], up[2]) yi.paramsSetPoint("to", to[0], to[1], to[2]) @@ -262,9 +273,23 @@ def writeMesh(self, obj, matrix): self.yi.paramsClearAll() self.yi.paramsSetInt("obj_pass_index", obj.pass_index) - if self.is_preview and bpy.data.scenes[0].yafaray.preview.enable and bpy.data.scenes[0].yafaray.preview.previewObject != "" and "preview" in obj.name and bpy.data.scenes[0].objects[bpy.data.scenes[0].yafaray.preview.previewObject].type=="MESH": + if self.is_preview and bpy.data.scenes[0].yafaray.preview.enable and "preview" in obj.name: ymat = self.materialMap[obj.active_material] - self.writeGeometry(ID, bpy.data.scenes[0].objects[bpy.data.scenes[0].yafaray.preview.previewObject], matrix, obj.pass_index, 0, ymat) + + if bpy.data.scenes[0].yafaray.preview.previewObject != "" and bpy.data.scenes[0].objects[bpy.data.scenes[0].yafaray.preview.previewObject].type=="MESH": + customObj = bpy.data.scenes[0].objects[bpy.data.scenes[0].yafaray.preview.previewObject] + previewMatrix = customObj.matrix_world.copy() + previewMatrix[0][3]=0 + previewMatrix[1][3]=0 + previewMatrix[2][3]=0 + self.writeGeometry(ID, customObj, previewMatrix, obj.pass_index, 0, ymat) + else: + previewMatrix = obj.matrix_world.copy() + previewMatrix[0][3]=0 + previewMatrix[1][3]=0 + previewMatrix[2][3]=0 + + self.writeGeometry(ID, obj, previewMatrix, obj.pass_index) else: self.writeGeometry(ID, obj, matrix, obj.pass_index) # obType in 0, default, the object is rendered diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 2be1c56b..9468b72e 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -33,7 +33,10 @@ Scene = bpy.types.Scene def update_preview(self, context): - context.material.preview_render_type = context.material.preview_render_type + if hasattr(context, "material"): + context.material.preview_render_type = context.material.preview_render_type + elif len(bpy.data.materials) > 0: + bpy.data.materials[0].preview_render_type = bpy.data.materials[0].preview_render_type # set fileformat for image saving on same format as in YafaRay, both have default PNG def call_update_fileformat(self, context): @@ -440,7 +443,8 @@ class YafaRayMaterialPreviewControlProperties(bpy.types.PropertyGroup): update=update_preview, name="objScale", description=("Material Preview object scaling factor"), - min=0.1, max=10.0, precision=2, step=10, + min=0.0, #max=10.0, + precision=2, step=10, default=1.0) rotZ = FloatProperty( @@ -514,6 +518,101 @@ class YafaRayMaterialPreviewControlProperties(bpy.types.PropertyGroup): description=("Material Preview custom object to be shown, if empty will use default preview objects"), default="") + camRotIncl = FloatProperty( + update=update_preview, + name="camRotIncl", #Theta angle + description=("Material Preview camera Inclination"), + precision=1, step=1000, + min=math.radians(10), max=math.radians(120), + subtype="ANGLE", unit="ROTATION", + default=1.4904173325) + + camRotAzi = FloatProperty( + update=update_preview, + name="camRotAzi", #Phi angle + description=("Material Preview camera rotation Azimuth"), + precision=1, step=1000, + #min=math.radians(-360), max=math.radians(360), + subtype="ANGLE", unit="ROTATION", + default=-1.5718435101) + + camRotZ = FloatProperty( + update=update_preview, + name="camRotZ", + description=("Material Preview camera rotation Z axis"), + precision=1, step=1000, + #min=math.radians(-360), max=math.radians(360), + subtype="ANGLE", unit="ROTATION", + default=0.0) + + camDist = FloatProperty( + update=update_preview, + name="camDist", + description=("Material Preview Camera distance to object"), + min=0.1, max=22.0, precision=2, step=100, + default=12.0) + + class OBJECT_OT_CamRotReset(bpy.types.Operator): + """ Reset camera rotation/zoom to initial values. """ + bl_idname = "preview.camrotreset" + bl_label = "reset camera rotation" + country = bpy.props.StringProperty() + + def execute(self, context): + bpy.data.scenes[0].yafaray.preview.camRotIncl = 1.4904173325 + bpy.data.scenes[0].yafaray.preview.camRotAzi = -1.5718435101 + bpy.data.scenes[0].yafaray.preview.camDist = 12 + return{'FINISHED'} + + class OBJECT_OT_DynamicCamRot(bpy.types.Operator): + """ Start dynamic camera rotation. Once started, hold left mouse button and drag to rotate preview. Also hold CTRL to zoom. Press ESC or right click to cancel. """ + bl_idname = "preview.dynamiccamrot" + bl_label = "dynamic camera rotation" + + def __init__(self): + #print("Start moving") + pass + + def __del__(self): + #print("Moved from (%d %d) to (%d %d)" % + # (self.init_x, self.init_y, self.x, self.y)) + pass + + def execute(self, context): + #context.object.location.x = self.x / 100.0 + #context.object.location.y = self.y / 100.0 + pass + + def modal(self, context, event): + if event.type == 'MOUSEMOVE': # Apply + self.x = event.mouse_x + self.y = event.mouse_y + if event.value == "PRESS": + if event.ctrl: + bpy.data.scenes[0].yafaray.preview.camDist -= (self.y - event.mouse_prev_y)/10 + else: + bpy.data.scenes[0].yafaray.preview.camRotIncl += (self.y - event.mouse_prev_y)/100 + bpy.data.scenes[0].yafaray.preview.camRotAzi -= (self.x - event.mouse_prev_x)/100 + + self.execute(context) + + #elif event.type == 'LEFTMOUSE': # Confirm + #return {'FINISHED'} + elif event.type in ('RIGHTMOUSE', 'ESC'): # Cancel + return {'CANCELLED'} + + return {'RUNNING_MODAL'} + + def invoke(self, context, event): + self.x = event.mouse_x + self.y = event.mouse_y + self.init_x = self.x + self.init_y = self.y + self.execute(context) + + print(context.window_manager.modal_handler_add(self)) + return {'RUNNING_MODAL'} + def register(): ########### YafaRays general settings properties ############# diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index 46115521..d1723252 100755 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -157,6 +157,21 @@ def draw(self, context): col.prop(context.scene.yafaray.preview, "previewBackground", text="") col = split.column() col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") + #split = layout.split() + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camDist") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotIncl") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotAzi") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotZ") + split = layout.split() + col = split.column() + col.operator("preview.dynamiccamrot", text='start dynamic camRot (ESC to exit)') + col = split.column() + col.operator("preview.camrotreset", text='reset camRot') + def draw_generator(ior_n): def draw(self, context): diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index 97ba1570..41c11e90 100755 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -168,9 +168,23 @@ def draw(self, context): col = split.column() col.prop(context.scene.yafaray.preview, "previewAApasses") col = split.column() - col.prop(context.scene.yafaray.preview, "previewBackground") + col.prop(context.scene.yafaray.preview, "previewBackground", text="") col = split.column() col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") + #split = layout.split() + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camDist") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotIncl") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotAzi") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotZ") + split = layout.split() + col = split.column() + col.operator("preview.dynamiccamrot", text='start dynamic camRot (ESC to exit)') + col = split.column() + col.operator("preview.camrotreset", text='reset camRot') class YAF_TextureSlotPanel(YAF_TextureButtonsPanel): From 7605f8cda0b6784969a14caa738dd5de33f4c06a Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Thu, 4 Feb 2016 22:52:20 +0100 Subject: [PATCH 74/81] Camera Dynamic Rotation - more intuitive controls --- prop/yaf_scene.py | 16 +++++--- ui/properties_yaf_material.py | 73 ++++++++++++++++++----------------- ui/properties_yaf_texture.py | 73 ++++++++++++++++++----------------- 3 files changed, 86 insertions(+), 76 deletions(-) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 9468b72e..209723a6 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -551,6 +551,13 @@ class YafaRayMaterialPreviewControlProperties(bpy.types.PropertyGroup): description=("Material Preview Camera distance to object"), min=0.1, max=22.0, precision=2, step=100, default=12.0) + + camDynRotRunning = BoolProperty( + #update=update_preview, + name="camDynRotRunning", + description="Shows when the Dynamic Camera Rotation is running", + default=False) + class OBJECT_OT_CamRotReset(bpy.types.Operator): """ Reset camera rotation/zoom to initial values. """ @@ -570,14 +577,11 @@ class OBJECT_OT_DynamicCamRot(bpy.types.Operator): bl_label = "dynamic camera rotation" def __init__(self): - #print("Start moving") - pass + bpy.data.scenes[0].yafaray.preview.camDynRotRunning = True def __del__(self): - #print("Moved from (%d %d) to (%d %d)" % - # (self.init_x, self.init_y, self.x, self.y)) - pass - + bpy.data.scenes[0].yafaray.preview.camDynRotRunning = False + def execute(self, context): #context.object.location.x = self.x / 100.0 #context.object.location.y = self.y / 100.0 diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index d1723252..8b61306a 100755 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -134,43 +134,46 @@ def draw(self, context): if context.scene.yafaray.preview.enable: layout = self.layout yaf_mat = active_node_mat(context.material) - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "objScale") - col = split.column() - col.prop(context.scene.yafaray.preview, "rotZ") - col = split.column() - col.prop(context.scene.yafaray.preview, "lightRotZ") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "keyLightPowerFactor") - col = split.column() - col.prop(context.scene.yafaray.preview, "fillLightPowerFactor") - col = split.column() - col.prop(context.scene.yafaray.preview, "lightColor", text="") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "previewRayDepth") - col = split.column() - col.prop(context.scene.yafaray.preview, "previewAApasses") - col = split.column() - col.prop(context.scene.yafaray.preview, "previewBackground", text="") - col = split.column() - col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") - #split = layout.split() - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camDist") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotIncl") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotAzi") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotZ") split = layout.split() col = split.column() - col.operator("preview.dynamiccamrot", text='start dynamic camRot (ESC to exit)') - col = split.column() - col.operator("preview.camrotreset", text='reset camRot') + if context.scene.yafaray.preview.camDynRotRunning: + col.operator("preview.dynamiccamrot", text='Dynamic camRot running - press ESC or Right click to exit', icon="MANIPUL") + else: + col.operator("preview.dynamiccamrot", text='Start Dynamic camRot') + col = split.column() + col.operator("preview.camrotreset", text='reset camRot') + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "objScale") + col = split.column() + col.prop(context.scene.yafaray.preview, "rotZ") + col = split.column() + col.prop(context.scene.yafaray.preview, "lightRotZ") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "keyLightPowerFactor") + col = split.column() + col.prop(context.scene.yafaray.preview, "fillLightPowerFactor") + col = split.column() + col.prop(context.scene.yafaray.preview, "lightColor", text="") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "previewRayDepth") + col = split.column() + col.prop(context.scene.yafaray.preview, "previewAApasses") + col = split.column() + col.prop(context.scene.yafaray.preview, "previewBackground", text="") + col = split.column() + col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") + #split = layout.split() + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camDist") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotIncl") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotAzi") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotZ") def draw_generator(ior_n): diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index 41c11e90..529a2d8c 100755 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -148,43 +148,46 @@ def draw(self, context): if context.scene.yafaray.preview.enable: layout = self.layout yaf_mat = active_node_mat(context.material) - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "objScale") - col = split.column() - col.prop(context.scene.yafaray.preview, "rotZ") - col = split.column() - col.prop(context.scene.yafaray.preview, "lightRotZ") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "keyLightPowerFactor") - col = split.column() - col.prop(context.scene.yafaray.preview, "fillLightPowerFactor") - col = split.column() - col.prop(context.scene.yafaray.preview, "lightColor", text="") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "previewRayDepth") - col = split.column() - col.prop(context.scene.yafaray.preview, "previewAApasses") - col = split.column() - col.prop(context.scene.yafaray.preview, "previewBackground", text="") - col = split.column() - col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") - #split = layout.split() - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camDist") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotIncl") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotAzi") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotZ") split = layout.split() col = split.column() - col.operator("preview.dynamiccamrot", text='start dynamic camRot (ESC to exit)') - col = split.column() - col.operator("preview.camrotreset", text='reset camRot') + if context.scene.yafaray.preview.camDynRotRunning: + col.operator("preview.dynamiccamrot", text='Dynamic camRot running - press ESC or Right click to exit', icon="MANIPUL") + else: + col.operator("preview.dynamiccamrot", text='Start Dynamic camRot') + col = split.column() + col.operator("preview.camrotreset", text='reset camRot') + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "objScale") + col = split.column() + col.prop(context.scene.yafaray.preview, "rotZ") + col = split.column() + col.prop(context.scene.yafaray.preview, "lightRotZ") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "keyLightPowerFactor") + col = split.column() + col.prop(context.scene.yafaray.preview, "fillLightPowerFactor") + col = split.column() + col.prop(context.scene.yafaray.preview, "lightColor", text="") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "previewRayDepth") + col = split.column() + col.prop(context.scene.yafaray.preview, "previewAApasses") + col = split.column() + col.prop(context.scene.yafaray.preview, "previewBackground", text="") + col = split.column() + col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") + #split = layout.split() + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camDist") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotIncl") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotAzi") + #col = split.column() + #col.prop(context.scene.yafaray.preview, "camRotZ") class YAF_TextureSlotPanel(YAF_TextureButtonsPanel): From ef6a02440690400348d75bf1ed0b80f6240e209d Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 5 Feb 2016 14:03:33 +0100 Subject: [PATCH 75/81] Fix World preview not updating correctly Again, problems in the Preview updaring, probably caused by Blender itself which is only updating the preview when Blender-only parameters are changed, but changing 3rd party renderer parameters do not update. I've used a dirty trick to make this work, but I think it should work fine. --- prop/yaf_world.py | 83 ++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/prop/yaf_world.py b/prop/yaf_world.py index 2cc73fa8..a5211725 100644 --- a/prop/yaf_world.py +++ b/prop/yaf_world.py @@ -27,11 +27,14 @@ World = bpy.types.World +def update_preview(self, context): + context.world.use_sky_paper = context.world.use_sky_paper + def register(): ########### YafaRays world background properties ############# World.bg_type = EnumProperty( - name="Background", + update=update_preview, name="Background", items=( ('Gradient', "Gradient", "Gradient background"), ('Texture', "Texture", "Textured background"), @@ -42,7 +45,7 @@ def register(): default="Single Color") World.bg_color_space = EnumProperty( - name="Color space", + update=update_preview, name="Color space", items=( ('CIE (E)', "CIE (E)", "Select color space model"), ('CIE (D50)', "CIE (D50)", "Select color space model"), @@ -54,7 +57,7 @@ def register(): ## povman test: create a list of YafaRay mapping modes ########## # World.yaf_mapworld_type = EnumProperty( - name="Mapping Type", + update=update_preview, name="Mapping Type", items=( ('SPHERE', "Spherical", "Spherical mapping"), ('ANGMAP', "Angular", "Angular mapping") @@ -63,111 +66,111 @@ def register(): ########## end test ######################## World.bg_zenith_color = FloatVectorProperty( - name="Zenith color", + update=update_preview, name="Zenith color", description="Zenith color", subtype='COLOR', min=0.0, max=1.0, default=(0.57, 0.65, 1.0)) World.bg_horizon_color = FloatVectorProperty( - name="Horizon color", + update=update_preview, name="Horizon color", description="Horizon color", subtype='COLOR', min=0.0, max=1.0, default=(1.0, 1.0, 0.5)) World.bg_zenith_ground_color = FloatVectorProperty( - name="Zenith ground color", + update=update_preview, name="Zenith ground color", description="Zenith ground color", subtype='COLOR', min=0.0, max=1.0, default=(1.0, 0.9, 0.8)) World.bg_horizon_ground_color = FloatVectorProperty( - name="Horizon ground color", + update=update_preview, name="Horizon ground color", description="Horizon ground color", subtype='COLOR', min=0.0, max=1.0, default=(0.8, 0.6, 0.3)) World.bg_single_color = FloatVectorProperty( - name="Background color", + update=update_preview, name="Background color", description="Background color", subtype='COLOR', min=0.0, max=1.0, default=(0.7, 0.7, 0.7)) World.bg_use_ibl = BoolProperty( - name="Use IBL", + update=update_preview, name="Use IBL", description="Use the background as the light source for your image", default=False) World.bg_with_caustic = BoolProperty( - name="Caustic photons", + update=update_preview, name="Caustic photons", description="Allow background light to shoot caustic photons", default=True) World.bg_with_diffuse = BoolProperty( - name="Diffuse photons", + update=update_preview, name="Diffuse photons", description="Allow background light to shoot diffuse photons", default=True) World.bg_ibl_samples = IntProperty( - name="IBL Samples", + update=update_preview, name="IBL Samples", description="Number of samples for direct lighting from background", min=1, max=512, default=16) World.bg_rotation = FloatProperty( - name="Rotation", + update=update_preview, name="Rotation", description="Rotation offset of background texture", min=0.0, max=360.0, default=0.0) World.bg_turbidity = FloatProperty( - name="Turbidity", + update=update_preview, name="Turbidity", description="Turbidity of the atmosphere", min=1.0, max=20.0, default=2.0) World.bg_ds_turbidity = FloatProperty( # Darktides turbidity has different values - name="Turbidity", + update=update_preview, name="Turbidity", description="Turbidity of the atmosphere", min=2.0, max=12.0, default=2.0) World.bg_a_var = FloatProperty( - name="Brightness of horizon gradient", + update=update_preview, name="Brightness of horizon gradient", description="Darkening or brightening towards horizon", min=0.0, max=10.0, default=1.0) World.bg_b_var = FloatProperty( - name="Luminance of horizon", + update=update_preview, name="Luminance of horizon", description="Luminance gradient near the horizon", min=0.0, max=10.0, default=1.0) World.bg_c_var = FloatProperty( - name="Solar region intensity", + update=update_preview, name="Solar region intensity", description="Relative intensity of circumsolar region", min=0.0, max=10.0, default=1.0) World.bg_d_var = FloatProperty( - name="Width of circumsolor region", + update=update_preview, name="Width of circumsolor region", description="Width of circumsolar region", min=0.0, max=10.0, default=1.0) World.bg_e_var = FloatProperty( - name="Backscattered light", + update=update_preview, name="Backscattered light", description="Relative backscattered light", min=0.0, max=10.0, default=1.0) World.bg_from = FloatVectorProperty( - name="Set sun position", + update=update_preview, name="Set sun position", description="Set the position of the sun", subtype='DIRECTION', step=10, precision=3, @@ -175,69 +178,69 @@ def register(): default=(1.0, 1.0, 1.0)) World.bg_add_sun = BoolProperty( - name="Add sun", + update=update_preview, name="Add sun", description="Add a real sun light", default=False) World.bg_sun_power = FloatProperty( - name="Sunlight power", + update=update_preview, name="Sunlight power", description="Sunlight power", min=0.0, max=10.0, default=1.0) World.bg_background_light = BoolProperty( - name="Add skylight", + update=update_preview, name="Add skylight", description="Add skylight", default=False) World.bg_light_samples = IntProperty( - name="Samples", + update=update_preview, name="Samples", description="Set skylight and sunlight samples", min=1, max=512, default=16) World.bg_dsaltitude = FloatProperty( - name="Altitude", + update=update_preview, name="Altitude", description="Moves the sky dome above or below the camera position", min=-1.0, max=2.0, default=0.0) World.bg_dsnight = BoolProperty( - name="Night", + update=update_preview, name="Night", description="Activate experimental night mode", default=False) World.bg_dsbright = FloatProperty( - name="Sky brightness", + update=update_preview, name="Sky brightness", description="Brightness of the sky", min=0.0, max=10.0, default=1.0) World.bg_power = FloatProperty( - name="Skylight power", + update=update_preview, name="Skylight power", description="Multiplier for background color", min=0.0, default=1.0) World.bg_exposure = FloatProperty( - name="Exposure", + update=update_preview, name="Exposure", description="Exposure correction for the sky (0 = no correction)", min=0.0, max=10.0, default=1.0) World.bg_clamp_rgb = BoolProperty( - name="Clamp RGB", + update=update_preview, name="Clamp RGB", description="Clamp RGB values", default=False) World.bg_gamma_enc = BoolProperty( - name="Gamma encoding", + update=update_preview, name="Gamma encoding", description="Apply gamma encoding to the sky", default=True) ########### YafaRays volume integrator properties ############# World.v_int_type = EnumProperty( - name="Volume integrator", + update=update_preview, name="Volume integrator", description="Set the volume integrator", items=( ('None', "None", ""), @@ -247,43 +250,43 @@ def register(): default='None') World.v_int_step_size = FloatProperty( - name="Step size", + update=update_preview, name="Step size", description="Precision of volumetric rendering (in Blender units)", min=0.0, max=100.0, precision=3, default=1.000) World.v_int_adaptive = BoolProperty( - name="Adaptive", + update=update_preview, name="Adaptive", description="Optimizes stepping calculations for NoiseVolumes", default=False) World.v_int_optimize = BoolProperty( - name="Optimize", + update=update_preview, name="Optimize", description="Precomputing attenuation in the entire volume at a 3d grid of points", default=False) World.v_int_attgridres = IntProperty( - name="Att. grid resolution", + update=update_preview, name="Att. grid resolution", description="Optimization attenuation grid resolution", min=1, max=50, default=1) # ??? not sure about the following properties ??? World.v_int_scale = FloatProperty( - name="Sigma T", + update=update_preview, name="Sigma T", min=0.0, precision=3, description="", default=0.100) World.v_int_alpha = FloatProperty( - name="Alpha", + update=update_preview, name="Alpha", min=0.0, precision=3, description="", default=0.500) World.v_int_dsturbidity = FloatProperty( - name="Turbidity", + update=update_preview, name="Turbidity", description="", default=3.0) From dea29d4f47971439d3276a619799a025703d2b1d Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 5 Feb 2016 23:03:11 +0100 Subject: [PATCH 76/81] Fix regression error when using Area lights Stupid mistake in a previous commit, sorry :-( Corrected now. --- io/yaf_light.py | 1 + 1 file changed, 1 insertion(+) diff --git a/io/yaf_light.py b/io/yaf_light.py index 343c220c..41e9d090 100644 --- a/io/yaf_light.py +++ b/io/yaf_light.py @@ -19,6 +19,7 @@ # import os +from mathutils import Vector import mathutils import bpy from math import degrees, pi, sin, cos From d49d5afde6a92b74774e8d01164a2e55c3e8be5e Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 6 Feb 2016 15:26:59 +0100 Subject: [PATCH 77/81] Material Preview - Final changes to the Dynamic Camera Rotation and rest of properties Changes: * Final version of the Dynamic Camera Rotation and Zoom, using easier widgets * Separated color for key and fill lights * Final arrangement of controls/texts in the Material Preview Controls --- io/yaf_light.py | 19 ++++-- io/yaf_object.py | 12 ++-- prop/yaf_scene.py | 121 +++++++++++----------------------- ui/properties_yaf_material.py | 90 ++++++++++++++----------- ui/properties_yaf_texture.py | 90 ++++++++++++++----------- 5 files changed, 165 insertions(+), 167 deletions(-) diff --git a/io/yaf_light.py b/io/yaf_light.py index 41e9d090..1384bcfe 100644 --- a/io/yaf_light.py +++ b/io/yaf_light.py @@ -95,26 +95,35 @@ def createLight(self, yi, lamp_object, matrix=None): if name == "Lamp": pos = (-6, -4, 8, 1.0) power = 5 - power *= bpy.data.scenes[0].yafaray.preview.fillLightPowerFactor + if bpy.data.scenes[0].yafaray.preview.enable: + power *= bpy.data.scenes[0].yafaray.preview.fillLightPowerFactor + color = bpy.data.scenes[0].yafaray.preview.fillLightColor elif name == "Lamp.001": pos = (6, -6, -2, 1.0) power = 6 - power *= bpy.data.scenes[0].yafaray.preview.fillLightPowerFactor + if bpy.data.scenes[0].yafaray.preview.enable: + power *= bpy.data.scenes[0].yafaray.preview.fillLightPowerFactor + color = bpy.data.scenes[0].yafaray.preview.fillLightColor + elif name == "Lamp.002": pos = (-2.9123109, -7.270790733, 4.439187765, 1.0) to = (-0.0062182024121284485, 0.6771485209465027, 1.8015732765197754, 1.0) power = 5 - power *= bpy.data.scenes[0].yafaray.preview.keyLightPowerFactor + if bpy.data.scenes[0].yafaray.preview.enable: + power *= bpy.data.scenes[0].yafaray.preview.keyLightPowerFactor + color = bpy.data.scenes[0].yafaray.preview.keyLightColor + elif name == "Lamp.008": lampType = "sun" power = 0.8 - power *= bpy.data.scenes[0].yafaray.preview.keyLightPowerFactor + if bpy.data.scenes[0].yafaray.preview.enable: + power *= bpy.data.scenes[0].yafaray.preview.keyLightPowerFactor + color = bpy.data.scenes[0].yafaray.preview.keyLightColor if bpy.data.scenes[0].yafaray.preview.enable: matrix2 = mathutils.Matrix.Rotation(bpy.data.scenes[0].yafaray.preview.lightRotZ, 4, 'Z') pos = multiplyMatrix4x4Vector4(matrix2, mathutils.Vector((pos[0], pos[1], pos[2], pos[3]))) - color = bpy.data.scenes[0].yafaray.preview.lightColor yi.paramsClearAll() diff --git a/io/yaf_object.py b/io/yaf_object.py index 2157b21a..358af818 100644 --- a/io/yaf_object.py +++ b/io/yaf_object.py @@ -167,13 +167,15 @@ def __init__ (self, camera, camera_name, view_name): if self.is_preview and bpy.data.scenes[0].yafaray.preview.enable: - incl = bpy.data.scenes[0].yafaray.preview.camRotIncl - azi = bpy.data.scenes[0].yafaray.preview.camRotAzi - rotZ = bpy.data.scenes[0].yafaray.preview.camRotZ + #incl = bpy.data.scenes[0].yafaray.preview.camRotIncl + #azi = bpy.data.scenes[0].yafaray.preview.camRotAzi + rot = bpy.data.scenes[0].yafaray.preview.camRot dist = bpy.data.scenes[0].yafaray.preview.camDist - pos = (dist*math.sin(incl)*math.cos(azi), dist*math.sin(incl)*math.sin(azi), dist*math.cos(incl)) - up = (math.sin(rotZ), 0, math.cos(rotZ)) + #pos = (dist*math.sin(incl)*math.cos(azi), dist*math.sin(incl)*math.sin(azi), dist*math.cos(incl)) + #up = (math.sin(rotZ), 0, math.cos(rotZ)) + pos = (-dist*rot[0], -dist*rot[2], -dist*rot[1]) + up = (0,0,1) to = (0,0,0) yi.paramsSetPoint("from", pos[0], pos[1], pos[2]) diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py index 209723a6..77a96d44 100644 --- a/prop/yaf_scene.py +++ b/prop/yaf_scene.py @@ -479,10 +479,20 @@ class YafaRayMaterialPreviewControlProperties(bpy.types.PropertyGroup): min=0.0, max=10.0, precision=2, step=10, default=0.5) - lightColor = FloatVectorProperty( + keyLightColor = FloatVectorProperty( update=update_preview, - name="lightColor", - description=("Material Preview color for lights"), + name="keyLightColor", + description=("Material Preview color for key light"), + subtype='COLOR', + step=1, precision=2, + min=0.0, max=1.0, + soft_min=0.0, soft_max=1.0, + default=(1.0, 1.0, 1.0)) + + fillLightColor = FloatVectorProperty( + update=update_preview, + name="fillLightColor", + description=("Material Preview color for fill lights"), subtype='COLOR', step=1, precision=2, min=0.0, max=1.0, @@ -518,33 +528,6 @@ class YafaRayMaterialPreviewControlProperties(bpy.types.PropertyGroup): description=("Material Preview custom object to be shown, if empty will use default preview objects"), default="") - camRotIncl = FloatProperty( - update=update_preview, - name="camRotIncl", #Theta angle - description=("Material Preview camera Inclination"), - precision=1, step=1000, - min=math.radians(10), max=math.radians(120), - subtype="ANGLE", unit="ROTATION", - default=1.4904173325) - - camRotAzi = FloatProperty( - update=update_preview, - name="camRotAzi", #Phi angle - description=("Material Preview camera rotation Azimuth"), - precision=1, step=1000, - #min=math.radians(-360), max=math.radians(360), - subtype="ANGLE", unit="ROTATION", - default=-1.5718435101) - - camRotZ = FloatProperty( - update=update_preview, - name="camRotZ", - description=("Material Preview camera rotation Z axis"), - precision=1, step=1000, - #min=math.radians(-360), max=math.radians(360), - subtype="ANGLE", unit="ROTATION", - default=0.0) - camDist = FloatProperty( update=update_preview, name="camDist", @@ -552,70 +535,46 @@ class YafaRayMaterialPreviewControlProperties(bpy.types.PropertyGroup): min=0.1, max=22.0, precision=2, step=100, default=12.0) - camDynRotRunning = BoolProperty( - #update=update_preview, - name="camDynRotRunning", - description="Shows when the Dynamic Camera Rotation is running", - default=False) - + camRot = FloatVectorProperty( + update=update_preview, + name="camRot", + description=("Material Preview camera rotation"), + subtype='DIRECTION', + #step=10, precision=3, + #min=-1.0, max=1.0, + default=(0.0, 0.0, 1.0) + ) class OBJECT_OT_CamRotReset(bpy.types.Operator): """ Reset camera rotation/zoom to initial values. """ bl_idname = "preview.camrotreset" - bl_label = "reset camera rotation" + bl_label = "reset camera rotation/distance values to defaults" country = bpy.props.StringProperty() def execute(self, context): - bpy.data.scenes[0].yafaray.preview.camRotIncl = 1.4904173325 - bpy.data.scenes[0].yafaray.preview.camRotAzi = -1.5718435101 + bpy.data.scenes[0].yafaray.preview.camRot = (0,0,1) bpy.data.scenes[0].yafaray.preview.camDist = 12 return{'FINISHED'} - class OBJECT_OT_DynamicCamRot(bpy.types.Operator): - """ Start dynamic camera rotation. Once started, hold left mouse button and drag to rotate preview. Also hold CTRL to zoom. Press ESC or right click to cancel. """ - bl_idname = "preview.dynamiccamrot" - bl_label = "dynamic camera rotation" - - def __init__(self): - bpy.data.scenes[0].yafaray.preview.camDynRotRunning = True + class OBJECT_OT_CamZoomIn(bpy.types.Operator): + """ Camera zoom in (reduces distance between camera and object) """ + bl_idname = "preview.camzoomin" + bl_label = "reset camera rotation/distance values to defaults" + country = bpy.props.StringProperty() - def __del__(self): - bpy.data.scenes[0].yafaray.preview.camDynRotRunning = False - def execute(self, context): - #context.object.location.x = self.x / 100.0 - #context.object.location.y = self.y / 100.0 - pass - - def modal(self, context, event): - if event.type == 'MOUSEMOVE': # Apply - self.x = event.mouse_x - self.y = event.mouse_y - if event.value == "PRESS": - if event.ctrl: - bpy.data.scenes[0].yafaray.preview.camDist -= (self.y - event.mouse_prev_y)/10 - else: - bpy.data.scenes[0].yafaray.preview.camRotIncl += (self.y - event.mouse_prev_y)/100 - bpy.data.scenes[0].yafaray.preview.camRotAzi -= (self.x - event.mouse_prev_x)/100 - - self.execute(context) - - #elif event.type == 'LEFTMOUSE': # Confirm - #return {'FINISHED'} - elif event.type in ('RIGHTMOUSE', 'ESC'): # Cancel - return {'CANCELLED'} - - return {'RUNNING_MODAL'} - - def invoke(self, context, event): - self.x = event.mouse_x - self.y = event.mouse_y - self.init_x = self.x - self.init_y = self.y - self.execute(context) + bpy.data.scenes[0].yafaray.preview.camDist -= 0.5; + return{'FINISHED'} + + class OBJECT_OT_CamZoomOut(bpy.types.Operator): + """ Camera zoom out (increases distance between camera and object) """ + bl_idname = "preview.camzoomout" + bl_label = "reset camera rotation/distance values to defaults" + country = bpy.props.StringProperty() - print(context.window_manager.modal_handler_add(self)) - return {'RUNNING_MODAL'} + def execute(self, context): + bpy.data.scenes[0].yafaray.preview.camDist += 0.5; + return{'FINISHED'} def register(): diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index 8b61306a..911f881d 100755 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -136,44 +136,58 @@ def draw(self, context): yaf_mat = active_node_mat(context.material) split = layout.split() col = split.column() - if context.scene.yafaray.preview.camDynRotRunning: - col.operator("preview.dynamiccamrot", text='Dynamic camRot running - press ESC or Right click to exit', icon="MANIPUL") - else: - col.operator("preview.dynamiccamrot", text='Start Dynamic camRot') - col = split.column() - col.operator("preview.camrotreset", text='reset camRot') - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "objScale") - col = split.column() - col.prop(context.scene.yafaray.preview, "rotZ") - col = split.column() - col.prop(context.scene.yafaray.preview, "lightRotZ") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "keyLightPowerFactor") - col = split.column() - col.prop(context.scene.yafaray.preview, "fillLightPowerFactor") - col = split.column() - col.prop(context.scene.yafaray.preview, "lightColor", text="") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "previewRayDepth") - col = split.column() - col.prop(context.scene.yafaray.preview, "previewAApasses") - col = split.column() - col.prop(context.scene.yafaray.preview, "previewBackground", text="") - col = split.column() - col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") - #split = layout.split() - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camDist") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotIncl") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotAzi") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotZ") + col.label("Preview dynamic rotation/zoom") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "camRot", text="") + col = split.column() + row = col.row() + row.operator("preview.camzoomout", text='Zoom Out', icon='ZOOM_OUT') + col2 = row.column() + col2.operator("preview.camzoomin", text='Zoom In', icon='ZOOM_IN') + row = col.row() + row.label("") + row = col.row() + row.operator("preview.camrotreset", text='Reset dynamic rotation/zoom') + split = layout.split() + col = split.column() + col.label("Preview object control") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "objScale", text="Scale") + col = split.column() + col.prop(context.scene.yafaray.preview, "rotZ", text="Z Rotation") + col = split.column() + col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") + split = layout.split() + col = split.column() + col.label("Preview lights control") + col = split.column() + col.prop(context.scene.yafaray.preview, "lightRotZ", text="lights Z Rotation") + split = layout.split() + col = split.column() + col.label("Key light:") + col = split.column() + col.prop(context.scene.yafaray.preview, "keyLightPowerFactor", text="Power factor") + col = split.column() + col.prop(context.scene.yafaray.preview, "keyLightColor", text="") + split = layout.split() + col = split.column() + col.label("Fill lights:") + col = split.column() + col.prop(context.scene.yafaray.preview, "fillLightPowerFactor", text="Power factor") + col = split.column() + col.prop(context.scene.yafaray.preview, "fillLightColor", text="") + split = layout.split() + col = split.column() + col.label("Preview scene control") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "previewRayDepth", text="Ray Depth") + col = split.column() + col.prop(context.scene.yafaray.preview, "previewAApasses", text="AA samples") + col = split.column() + col.prop(context.scene.yafaray.preview, "previewBackground", text="") def draw_generator(ior_n): diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index 529a2d8c..f825069e 100755 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -150,44 +150,58 @@ def draw(self, context): yaf_mat = active_node_mat(context.material) split = layout.split() col = split.column() - if context.scene.yafaray.preview.camDynRotRunning: - col.operator("preview.dynamiccamrot", text='Dynamic camRot running - press ESC or Right click to exit', icon="MANIPUL") - else: - col.operator("preview.dynamiccamrot", text='Start Dynamic camRot') - col = split.column() - col.operator("preview.camrotreset", text='reset camRot') - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "objScale") - col = split.column() - col.prop(context.scene.yafaray.preview, "rotZ") - col = split.column() - col.prop(context.scene.yafaray.preview, "lightRotZ") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "keyLightPowerFactor") - col = split.column() - col.prop(context.scene.yafaray.preview, "fillLightPowerFactor") - col = split.column() - col.prop(context.scene.yafaray.preview, "lightColor", text="") - split = layout.split() - col = split.column() - col.prop(context.scene.yafaray.preview, "previewRayDepth") - col = split.column() - col.prop(context.scene.yafaray.preview, "previewAApasses") - col = split.column() - col.prop(context.scene.yafaray.preview, "previewBackground", text="") - col = split.column() - col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") - #split = layout.split() - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camDist") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotIncl") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotAzi") - #col = split.column() - #col.prop(context.scene.yafaray.preview, "camRotZ") + col.label("Preview dynamic rotation/zoom") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "camRot", text="") + col = split.column() + row = col.row() + row.operator("preview.camzoomout", text='Zoom Out', icon='ZOOM_OUT') + col2 = row.column() + col2.operator("preview.camzoomin", text='Zoom In', icon='ZOOM_IN') + row = col.row() + row.label("") + row = col.row() + row.operator("preview.camrotreset", text='Reset dynamic rotation/zoom') + split = layout.split() + col = split.column() + col.label("Preview object control") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "objScale", text="Scale") + col = split.column() + col.prop(context.scene.yafaray.preview, "rotZ", text="Z Rotation") + col = split.column() + col.prop_search(context.scene.yafaray.preview, "previewObject", bpy.data, "objects", text="") + split = layout.split() + col = split.column() + col.label("Preview lights control") + col = split.column() + col.prop(context.scene.yafaray.preview, "lightRotZ", text="lights Z Rotation") + split = layout.split() + col = split.column() + col.label("Key light:") + col = split.column() + col.prop(context.scene.yafaray.preview, "keyLightPowerFactor", text="Power factor") + col = split.column() + col.prop(context.scene.yafaray.preview, "keyLightColor", text="") + split = layout.split() + col = split.column() + col.label("Fill lights:") + col = split.column() + col.prop(context.scene.yafaray.preview, "fillLightPowerFactor", text="Power factor") + col = split.column() + col.prop(context.scene.yafaray.preview, "fillLightColor", text="") + split = layout.split() + col = split.column() + col.label("Preview scene control") + split = layout.split() + col = split.column() + col.prop(context.scene.yafaray.preview, "previewRayDepth", text="Ray Depth") + col = split.column() + col.prop(context.scene.yafaray.preview, "previewAApasses", text="AA samples") + col = split.column() + col.prop(context.scene.yafaray.preview, "previewBackground", text="") class YAF_TextureSlotPanel(YAF_TextureButtonsPanel): From eb3f5ef58c2c4fc8991bb48be42eee6d278ecfa5 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 6 Feb 2016 15:32:16 +0100 Subject: [PATCH 78/81] Fix for python error message when texture image not yet selected --- ui/properties_yaf_texture.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py index f825069e..d6080219 100755 --- a/ui/properties_yaf_texture.py +++ b/ui/properties_yaf_texture.py @@ -327,24 +327,25 @@ def draw(self, context): tex = context.texture layout.template_image(tex, "image", tex.image_user) - if tex.image.colorspace_settings.name == "sRGB" or tex.image.colorspace_settings.name == "Linear" or tex.image.colorspace_settings.name == "Non-Color": - pass - - elif tex.image.colorspace_settings.name == "XYZ": - row = layout.row(align=True) - row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") - - elif tex.image.colorspace_settings.name == "Linear ACES": - row = layout.row(align=True) - row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming linear RGB", icon="ERROR") - - elif tex.image.colorspace_settings.name == "Raw": - row = layout.row(align=True) - row.prop(tex, "yaf_gamma_input", text="Texture gamma input correction") + if hasattr(tex.image,"colorspace_settings"): + if tex.image.colorspace_settings.name == "sRGB" or tex.image.colorspace_settings.name == "Linear" or tex.image.colorspace_settings.name == "Non-Color": + pass + + elif tex.image.colorspace_settings.name == "XYZ": + row = layout.row(align=True) + row.label(text="YafaRay 'XYZ' support is experimental and may not give the expected results", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Linear ACES": + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming linear RGB", icon="ERROR") + + elif tex.image.colorspace_settings.name == "Raw": + row = layout.row(align=True) + row.prop(tex, "yaf_gamma_input", text="Texture gamma input correction") - else: - row = layout.row(align=True) - row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming sRGB", icon="ERROR") + else: + row = layout.row(align=True) + row.label(text="YafaRay doesn't support '" + tex.image.colorspace_settings.name + "', assuming sRGB", icon="ERROR") row = layout.row(align=True) row.label(text="Note: for bump/normal maps, textures are always considered Linear", icon="INFO") From 95221d680822b0bea16c7aa02156a7f3cb55f292 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 6 Feb 2016 15:50:18 +0100 Subject: [PATCH 79/81] Version/ChangeLog changes for v2.1.1 --- CHANGELOG | 27 +++++++++++++++++++++++++++ __init__.py | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 089e95d4..c896f089 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,33 @@ Note: this CHANGELOG file only shows the YafaRay-E releases and changes, not the For more information about releases and changes see: https://github.com/DavidBluecame/Blender-Exporter/releases +Yafaray-E v2.1.1 (2016-02-06) for Blender 2.76b: +------------------------------------------------ +Note: there has been important changes and bug fixes in this version. They have solved some long-standing issues but perhaps they could cause new issues and unexpected results, so we have to keep an eye on them. + +* IMPORTANT: Fix for incorrect IBL lighting in World Background Texture when set to Angular. See: http://www.yafaray.org/node/714 + +* IMPORTANT: Adjustment to the automatic intersection/shadow bias calculation formula to avoid black artifacts in the scenes with fine details. However, now we can get again some black dots in some scenes again. For now, no good solution at hand (any good solution would require fundamental changes to the engine and probably slow down the renders in a significant amount). However, I hope to have found a better balance now. See: http://blenderartists.org/forum/showthread.php?389385-YafaRay-E-(Experimental)-v2-0-2-builds-Windows-Linux-and-Mac-OSX-for-Blender-2-76b&p=3004974&viewfull=1#post3004974 + +* IMPORTANT: Fix for black dots (alpha=0) sometimes when using Mitchell/Lanzcos filters. It's not clear what is the best way of solving this problem. This fix is the one that makes more sense but could cause new issues, we have to keep an eye on this. See: http://www.yafaray.org/node/712 + +* Fixed Black artifacts in World Background Textures. See: http://www.yafaray.org/node/714 + +* Fixed regression error in v2.1.0 when using Area Lights. See: http://www.yafaray.org/node/713 + +* Fixed World Preview not updating correctly. This is probably caused by Blender itself, I had to use the same workaround I used in the past to fix the material preview updating problem + +* Fixed python error when selecting an image texture before with no image opened yet. + +* "Final" changes to the Material Preview Advanced Controls: + - Added Dynamic Camera Rotation & Zoom. + - Changes to ensure the preview object is centered and rotation keeps it always in the centre. + - Changes to keep the scale/proportions of custom preview objects + - Added AA Passes control for progressively refining the material rendering + - Splitted the Light power and Light Color controls in two: Key Light power control and Fill Lights power control + - Removed PosX,PosZ controls as considered unnecessary and complicating the interface. + - Removed Texture scale/offset controls as they could cause confusion with the actual texture scale/offset parameters + Yafaray-E v2.1.0 (2016-01-31) for Blender 2.76b: ------------------------------------------------ diff --git a/__init__.py b/__init__.py index 330607bc..09eb8fa8 100644 --- a/__init__.py +++ b/__init__.py @@ -35,7 +35,7 @@ "Paulo Gomes (tuga3d), Michele Castigliego (subcomandante)," "Bert Buchholz, Rodrigo Placencia (DarkTide)," "Alexander Smirnov (Exvion), Olaf Arnold (olaf), David Bluecame", - "version": ('Experimental', 2, 1, 0), + "version": ('Experimental', 2, 1, 1), "blender": (2, 7, 6), "location": "Info Header > Engine dropdown menu", "wiki_url": "http://www.yafaray.org/community/forum", From 6ea8959972c1a8cdc17c2e8b61397d128c62f4ed Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 6 Feb 2016 16:38:40 +0100 Subject: [PATCH 80/81] Last minute changes to ChangeLog for v2.1.1 --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index c896f089..68420587 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,8 @@ Note: there has been important changes and bug fixes in this version. They have * Fixed World Preview not updating correctly. This is probably caused by Blender itself, I had to use the same workaround I used in the past to fix the material preview updating problem +* Fixed crash when using textures with Normal or Window coordinates (which are view dependent) along with Caustic Photons. However, we have to consider that Photons are supposed to be view-independent, but when using textures with Window or Normal coordinates (which are view dependant), then the Photons WILL also be view dependant as well! So, using textures with "tricks" like Normal or Windows coordinates can cause low frequency noise in animations with Photons. This would not be a problem, but the price for using such "tricks" in renders. + * Fixed python error when selecting an image texture before with no image opened yet. * "Final" changes to the Material Preview Advanced Controls: From 53eb6b120830597bfbc1404347262a6035329a5e Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Sat, 6 Feb 2016 17:02:57 +0100 Subject: [PATCH 81/81] Additional changes to README and ChangeLog for v2.1.1 --- CHANGELOG | 5 +++++ README | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 68420587..8980b8c4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,9 @@ Note: this CHANGELOG file only shows the YafaRay-E releases and changes, not the For more information about releases and changes see: https://github.com/DavidBluecame/Blender-Exporter/releases +Important: read the README file for installation instructions and important information about YafaRay + + Yafaray-E v2.1.1 (2016-02-06) for Blender 2.76b: ------------------------------------------------ Note: there has been important changes and bug fixes in this version. They have solved some long-standing issues but perhaps they could cause new issues and unexpected results, so we have to keep an eye on them. @@ -33,6 +36,8 @@ Note: there has been important changes and bug fixes in this version. They have - Removed PosX,PosZ controls as considered unnecessary and complicating the interface. - Removed Texture scale/offset controls as they could cause confusion with the actual texture scale/offset parameters +Important note: YafaRay only supports *one* scene in the .blend file. If you have more than one scene, it could cause unexpected results and problems in the new Material Preview Controls. + Yafaray-E v2.1.0 (2016-01-31) for Blender 2.76b: ------------------------------------------------ diff --git a/README b/README index ec263232..cffdbb3b 100644 --- a/README +++ b/README @@ -9,6 +9,14 @@ YafaRay-E (Experimental) is an unofficial testing/unstable branch for fixes and *WARNING*: YafaRay-E contains EXPERIMENTAL CHANGES AND FEATURES, so it's recommended not to use it for production scenes. This application is provided as is, and no guarantee is given that this code will preform in the desired way. +IMPORTANT: current LIMITATIONS of YafaRay: +* YafaRay only supports *one* version of YafaRay installed in the system. This limitation also affects installations of multiple "forks" of YafaRay, even if they have different names. +If you have a black window when rendering: + - Make sure that YafaRay is correctly installed in the appropiate place + - Make sure there are no other YafaRay versions/forks installed. + +* YafaRay only supports *one* scene in the .blend file. If you have more than one scene, it could cause unexpected results and problems in the new Material Preview Controls. + Please post bugreports and feature requests here: http://www.yafaray.org/development/bugtracker/yafaray