From a0e769eeb3603a30caf663c97f833f569e757b5f Mon Sep 17 00:00:00 2001 From: Philipp Oeser <info@graphics-engineer.com> Date: Thu, 15 Nov 2018 17:51:35 +0100 Subject: [PATCH] OBJ import: Fix spec --- io_scene_obj/import_obj.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py index 5980a0b25..176a5a99f 100644 --- a/io_scene_obj/import_obj.py +++ b/io_scene_obj/import_obj.py @@ -227,7 +227,7 @@ def create_materials(filepath, relpath, # TODO: Find a way to guesstimate best value from diffuse color... # IDEA: Use standard deviation of both spec and diff colors (i.e. how far away they are # from some grey), and apply the the proportion between those two as tint factor? - spec = sum(spec_color) / 3.0 + spec = sum(spec_colors) / 3.0 # ~ spec_var = math.sqrt(sum((c - spec) ** 2 for c in spec_color) / 3.0) # ~ diff = sum(context_mat_wrap.base_color) / 3.0 # ~ diff_var = math.sqrt(sum((c - diff) ** 2 for c in context_mat_wrap.base_color) / 3.0) @@ -297,7 +297,8 @@ def create_materials(filepath, relpath, col = (float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])) context_mat_wrap.base_color = col elif line_id == b'ks': - spec_color = (float_func(line_split[1]) + float_func(line_split[2]) + float_func(line_split[3])) + spec_colors[:] = [ + float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])] context_material_vars.add("specular") elif line_id == b'ke': # We cannot set context_material.emit right now, we need final diffuse color as well for this. -- GitLab