diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-07-05 18:20:53 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-07-05 18:20:53 +0300 |
commit | 3430fbc7013d037e153160d5de9bfbd887cecb4f (patch) | |
tree | b0ff633cb96e174bdf70205b98ae6acbf8a5f45d /io_scene_obj/export_obj.py | |
parent | df9b373f660c931426f65deae01ea8bccc4be628 (diff) |
Fix T45316: Obj loading/saving brightness inconsistency.
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! :)
Diffstat (limited to 'io_scene_obj/export_obj.py')
-rw-r--r-- | io_scene_obj/export_obj.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py index e7d646b0..00733dd1 100644 --- a/io_scene_obj/export_obj.py +++ b/io_scene_obj/export_obj.py @@ -79,14 +79,15 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict): if mat.specular_shader == 'WARDISO': tspec = (0.4 - mat.specular_slope) / 0.0004 else: - tspec = (mat.specular_hardness - 1) * 1.9607843137254901 + tspec = (mat.specular_hardness - 1) / 0.51 fw('Ns %.6f\n' % tspec) del tspec + # Ambient if use_mirror: fw('Ka %.6f %.6f %.6f\n' % (mat.raytrace_mirror.reflect_factor * mat.mirror_color)[:]) else: - fw('Ka %.6f %.6f %.6f\n' % (mat.ambient * world_amb)[:]) # Ambient, uses mirror color, + fw('Ka %.6f %.6f %.6f\n' % mat.ambient[:]) # Do not use world color! fw('Kd %.6f %.6f %.6f\n' % (mat.diffuse_intensity * mat.diffuse_color)[:]) # Diffuse fw('Ks %.6f %.6f %.6f\n' % (mat.specular_intensity * mat.specular_color)[:]) # Specular if hasattr(mat, "raytrace_transparency") and hasattr(mat.raytrace_transparency, "ior"): |