This commit adds IO support for:
* -o (offset texture)
* -s (scale texture)
* -bm (bump multiplier, used a normal factor)
Note that it also fixes T46459.
ke/map_ke are not official .mtl specs, but seem to be rather common extension.
map_ke was added three years ago to exporter only, this commit finishes the work
by adding ke/map_ke to importer, and ke to exporter.
NOTES:
* mtl ke is a color, while in Blender emit is only a factor, using diffuse color.
this implies there is some loss of data during import here.
* I do not have the slightest idea about the range for ke values, so for now assuming
a direct matching of Blender's emit value.
Use new 'progress_report' util module to do both a (basic) report of I/O progression,
together with some logging/timing of main steps.
We could probably go much further, but for now it will do.
Also, using files as context manager, too!
Own mistake in recent corrections in regarding material's ambient handling.
Also, took the oportunity to fix a bit how shadings modes are handled (previously
if read early, they could be overwritten by other later settings...).
Fixes:
* Wrong (off-by-one) import of specular hardness (aka specular exponent in OBJ).
* Bad usage of world color when exporting ambient color (though it seems to make sense
on first look, this is bad because impossible to 'undo' on import - merging
data external to object itself).
* Bad default values for diff/spec intensity in imported materials (OBJ does not
have those, so we must assume they are 1.0).
Thanks to Luke Brookes (propuke) for finding all those glitches! :)
Was a TODO actually, now we try to match better illum values with current mesh material.
Also, using mirror color as Ka instead of ambient one, when mirror is enabled in blen mat.
This is not a bug, in fact, but imho we do not need to compare exactness of values
up to the 6th decimal, 4th decimal should be enough, and will avoid such cases of
"over generation" of data...
- r3954/patch [#32914], introduced incorrect displacement map name, corrected.
- added support for reading displacement maps.
- remove checks that added alpha support for diffuce images, OBJ has alpha material settings for this.
from dan grauer (kromar)
With change use_map_color_emission (which is for volumetrics only) to use_map_emit.
also ignore generated face-images (which have no file path).
Changed how mtl_mat names are generated, so that we can still be sure to always have a unique mtl_name for each key (mat_name, tex_name), yet avoiding to add tex name to mat when not needed.