From 2fe75fbb5a88cd19795c1c31f255c2d83e49b158 Mon Sep 17 00:00:00 2001 From: DavidBluecame Date: Fri, 19 May 2017 18:56:48 +0200 Subject: [PATCH] "Flat Material" option added to Shiny Diffuse Requested by a certain user. Flat Material is a special non-photorealistic material that does not multiply the surface color by the cosine of the angle with the light, as happens in real life. Also, if receive_shadows is disabled, this flat material does no longer self-shadow. For special applications only. --- CHANGELOG | 2 +- io/yaf_material.py | 4 ++++ prop/yaf_material.py | 6 ++++++ ui/properties_yaf_material.py | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index a3851b17..94cdff25 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -12,7 +12,7 @@ YafaRay development version (work in progress, not yet released) Feature changes/additions: -------------------------- -* None yet +* "Flat Material" option added to Shiny Diffuse, requested by a certain user. Flat Material is a special non-photorealistic material that does not multiply the surface color by the cosine of the angle with the light, as happens in real life. Also, if receive_shadows is disabled, this flat material does no longer self-shadow. For special applications only. `[Blender Exporter + Core]` Bug fixes: ---------- diff --git a/io/yaf_material.py b/io/yaf_material.py index 406baece..bcdcacce 100644 --- a/io/yaf_material.py +++ b/io/yaf_material.py @@ -234,6 +234,7 @@ def writeGlassShader(self, mat, scene, rough): yi.paramsSetBool("fake_shadows", mat.fake_shadows) yi.paramsSetString("visibility", mat.visibility) yi.paramsSetBool("receive_shadows", mat.receive_shadows) + yi.paramsSetBool("flat_material", False) yi.paramsSetInt("additionaldepth", mat.additionaldepth) yi.paramsSetFloat("samplingfactor", mat.samplingfactor) @@ -331,6 +332,7 @@ def writeGlossyShader(self, mat, scene, coated): # mat : instance of material c yi.paramsSetFloat("specular_reflect", bSpecr) yi.paramsSetString("visibility", mat.visibility) yi.paramsSetBool("receive_shadows", mat.receive_shadows) + yi.paramsSetBool("flat_material", False) yi.paramsSetInt("additionaldepth", mat.additionaldepth) yi.paramsSetFloat("samplingfactor", mat.samplingfactor) @@ -589,6 +591,7 @@ def writeShinyDiffuseShader(self, mat, scene): yi.paramsSetFloat("IOR", mat.IOR_reflection) # added IOR for reflection yi.paramsSetString("visibility", mat.visibility) yi.paramsSetBool("receive_shadows", mat.receive_shadows) + yi.paramsSetBool("flat_material", mat.flat_material) yi.paramsSetInt("additionaldepth", mat.additionaldepth) yi.paramsSetFloat("samplingfactor", mat.samplingfactor) @@ -664,6 +667,7 @@ def writeBlendShader(self, mat, scene): yi.paramsSetString("visibility", mat.visibility) yi.paramsSetBool("receive_shadows", mat.receive_shadows) + yi.paramsSetBool("flat_material", False) yi.paramsSetInt("additionaldepth", mat.additionaldepth) yi.paramsSetFloat("samplingfactor", mat.samplingfactor) diff --git a/prop/yaf_material.py b/prop/yaf_material.py index bad67f2e..395dbb58 100644 --- a/prop/yaf_material.py +++ b/prop/yaf_material.py @@ -339,6 +339,11 @@ def register(): description="If this parameter is set to false, the material will not receive shadows from other objects", default=True) + Material.flat_material = BoolProperty( + update=update_preview, name="Flat Material", + description="Flat Material is a special non-photorealistic material that does not multiply the surface color by the cosine of the angle with the light, as happens in real life. For special applications only", + default=False) + Material.additionaldepth = IntProperty( update=update_preview, name="Additional Ray Depth", description="Additional per-material Ray depth to be added to the general Ray Depth setting", @@ -388,6 +393,7 @@ def unregister(): del Material.material2name del Material.visibility del Material.receive_shadows + del Material.flat_material del Material.additionaldepth del Material.wireframe_amount del Material.wireframe_thickness diff --git a/ui/properties_yaf_material.py b/ui/properties_yaf_material.py index 5d3194c5..04bbdb36 100755 --- a/ui/properties_yaf_material.py +++ b/ui/properties_yaf_material.py @@ -456,6 +456,11 @@ def draw(self, context): split = layout.split() col = split.column() layout.row().prop(yaf_mat, "receive_shadows") + + if yaf_mat.mat_type == "shinydiffusemat": + split = layout.split() + col = split.column() + layout.row().prop(yaf_mat, "flat_material") if yaf_mat.mat_type != "blend": split = layout.split()