diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-01-07 17:42:01 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-01-07 17:42:01 +0300 |
commit | c8e0ca44a3c5d49be01f90a49b98a9ee8f875d36 (patch) | |
tree | 188ab5686fd7b27a258fd0b19d4ba4467f57b14a /source/blender/makesrna/intern/rna_material.c | |
parent | 03e0f28ea054923d1bb682ad8cd6ee931caea89f (diff) |
Improved bump mapping patch by M.G. Kishalmi (lmg) and M.S. Mikkelsen (sparky).
Many thanks to them!
For comparison, see here:
http://kishalmi.servus.at/3D/bumpcode/
Based on algorithm in: Mikkelsen M. S.: Simulation of Wrinkled Surfaces Revisited.
http://jbit.net/~sparky/sfgrad_bump/mm_sfgrad_bump.pdf
This fixes bugs:
#24591: Artefacts/strange normal mapping when anti-aliasing is on
#24735: Error at the Normal function.
#24962: Normals are not calculated correctly if anti-aliasing is off
#25103: Weird artefacts in Normal
This will break render compatibility a bit, but fixing this bugs would have also
done that, so in this case it should be acceptable.
Patch committed with these modifications:
* Bump method Old/3-Tap/5-Tap option in UI, 3-Tap is default
* Only compute normal perturbation vectors when needed
* Fix some middle of block variable definitions for MSVC
Diffstat (limited to 'source/blender/makesrna/intern/rna_material.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index ba2cea3defd..f8de8bd9664 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -367,6 +367,12 @@ static void rna_def_material_mtex(BlenderRNA *brna) {MTEX_NSPACE_TANGENT, "TANGENT", 0, "Tangent", ""}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem prop_bump_method_items[] = { + {0, "BUMP_OLD", 0, "Old Bump", ""}, + {MTEX_NEW_BUMP, "BUMP_3_TAP", 0, "3-Tap", ""}, + {MTEX_NEW_BUMP|MTEX_5TAP_BUMP, "BUMP_5_TAP", 0, "5-Tap", ""}, + {0, NULL, 0, NULL, NULL}}; + srna= RNA_def_struct(brna, "MaterialTextureSlot", "TextureSlot"); RNA_def_struct_sdna(srna, "MTex"); RNA_def_struct_ui_text(srna, "Material Texture Slot", "Texture slot for textures in a Material datablock"); @@ -668,9 +674,10 @@ static void rna_def_material_mtex(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Enabled", "Enable this material texture slot"); RNA_def_property_update(prop, 0, "rna_Material_update"); - prop= RNA_def_property(srna, "use_old_bump", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "texflag", MTEX_NEW_BUMP); - RNA_def_property_ui_text(prop, "Old Bump", "Use old bump mapping (backwards compatibility option)"); + prop= RNA_def_property(srna, "bump_method", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "texflag"); + RNA_def_property_enum_items(prop, prop_bump_method_items); + RNA_def_property_ui_text(prop, "Bump Method", "Method to use for bump mapping"); RNA_def_property_update(prop, 0, "rna_Material_update"); } |