Bugfix & Feature fix: Only Shadow Material options

Patch from Miika Hämäläinen.

The old Material "Only Shadow" used an ancient 'best guess'
formula using Lamp Distance and some averaging for converting
shadow values to alpha.
A couple of bug reporters already complained about the not
very predictable renders. Miika fixed this by adding two
new options, to only give the true shadow factor exclusively,
or to give a result including light intensity values.

More info:
http://projects.blender.org/tracker/index.php?func=detail&aid=26413&group_id=9&atid=127
This commit is contained in:
2011-03-08 16:08:43 +00:00
parent 3d05311d3c
commit 3a43e08deb
4 changed files with 96 additions and 19 deletions

View File

@@ -1583,6 +1583,12 @@ void RNA_def_material(BlenderRNA *brna)
{MA_SPHERE_A, "SPHERE_A", ICON_MAT_SPHERE_SKY, "Flat", "Preview type: Large sphere with sky"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_shadows_only_items[] = {
{MA_SO_OLD, "SO_OLD", 0, "Shadow and Distance", ""},
{MA_SO_SHADOW, "SO_SHADOW", 0, "Shadow Only", ""},
{MA_SO_SHADED, "SO_SHADED", 0, "Shadow and Shading", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "Material", "ID");
RNA_def_struct_ui_text(srna, "Material", "Material datablock to defined the appearance of geometric objects for rendering");
RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
@@ -1713,6 +1719,12 @@ void RNA_def_material(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ONLYSHADOW);
RNA_def_property_ui_text(prop, "Only Shadow", "Renders shadows as the material's alpha value, making materials transparent except for shadowed areas");
RNA_def_property_update(prop, 0, "rna_Material_update");
prop= RNA_def_property(srna, "shadow_only_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "shadowonly_flag");
RNA_def_property_enum_items(prop, prop_shadows_only_items);
RNA_def_property_ui_text(prop, "Shadow Type", "How to draw shadows");
RNA_def_property_update(prop, 0, "rna_Material_update");
prop= RNA_def_property(srna, "use_face_texture", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE);