KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.48k stars 316 forks source link

Material is not exported #262

Closed mholthausen closed 5 years ago

mholthausen commented 5 years ago

When creating a scene with a mesh in it, that is assigned with a new Material (either through Material pane or by Python Scripting) with a diffuse color, e.g.: activeObject = bpy.context.active_object mat = bpy.data.materials.new(name="Material") activeObject.data.materials.append(mat) bpy.context.object.active_material.diffuse_color = (random.uniform(0, 1), random.uniform(0, 1), random.uniform(0, 1)) the assigned material/color is not exported into the glb-File when watching it in the gltf-viewer (https://gltf-viewer.donmccurdy.com/) Following setup and steps have been processed: Date: 2019-01-27 19:17 Hash: 690478027bd7 Branch: blender2.7

Running on Linux Mint 19 The worklfow consists of: 1) Importing a shapefile into Blender with the BlenderGIS-Plugin (https://github.com/domlysz/BlenderGIS/tree/Blender28) as mesh where the normals of some triangles are up and some others are down 2) Assigning a material and color to the mesh 4) Exporting the scene as glb 5) Uploading the scene into the glTF-Viewer (https://gltf-viewer.donmccurdy.com/) and the assigned color is missing

In Blender 2.79 with the current master of glTF-Blender-Exporter it works like expected (without double sided, of course)

ghost commented 5 years ago

Thank's for already telling us your OS and Blender version :+1: Please also setup and submit a .blend file that produces the problem.

mholthausen commented 5 years ago

test_pane.tar.gz This contains a .blend File with a simple pane, with a material assigned to it. As well as the resulting .glb-File which shows no material on it when loading it into the gltf-viewer or my application ( test_pane) The error message in the gltf-viewer says: MESH_PRIMITIVE_UNUSED_TEXCOORD Material does not use texture coordinates sets with indices (0).

ghost commented 5 years ago

You have to toggle “Use Nodes” at the top in the Shader Editor. Even in Blender it doesn't use the material if that's off. image

mholthausen commented 5 years ago

You have to toggle “Use Nodes” at the top in the Shader Editor. Even in Blender it doesn't use the material if that's off. image

This works. From my point of view, this issue can be set to closed, I guess.