mrdoob/three.js — Issue #953: about loaders and materials
Author: Gazzell
Created: 2011-12-22 15:45:19+00:00
State: open

Hi all!
im exporting a scene from blender using the blender python script and i have some questions about how material loading is implemented.
Im my test case, I have a scene file with some meshes in separated files (like the blender scene in the examples)
I've been debugging sceneLoader.js and loader.js code and i see that the way three.js loads materials is something like this:

1. SceneLoader loads the materials defined in the scene file and puts them in Result.Materials. These materials are default materials (depending on the material type) plus some (usually few) new properties.
2. For each geometry, Loader.js loads the materials inside the file. These materials (in the blender exporter case) have more properties than the ones loaded in the scene file, but have the same names (in my case)
3. For each model in the scene file, it uses the referenced geometry (loaded from the geometry file) and the material FROM THE SCENE FILE, so the geometry material is not used. I also noticed that most of the scene's material properties are created from default values and not exported from the original materials (these values are correct in the geometry file),

So the questions are these:
1. Why materials from geometry files are not used? I guess a model instance could use a different material...
2. If this is correct, blender exporter should create more complex material files in scene file, is this correct?

One solution could be to have a material on geometry file and the material in scene file could modify some of the properties of this 'geometry material'

I dont know if Im missing something... I think the relation between materials in geometries an scenes is not very clear...

Thank you!