Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Commit

Permalink
"Flat Material" option added to Shiny Diffuse
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DavidBluecame committed May 19, 2017
1 parent 9ec5000 commit 2fe75fb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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:
----------
Expand Down
4 changes: 4 additions & 0 deletions io/yaf_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
6 changes: 6 additions & 0 deletions prop/yaf_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions ui/properties_yaf_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 2fe75fb

Please sign in to comment.