Some material with JSONLoader?

Can two materials be assigned to the same grid loaded by JSONLoader?

I made a simple symbol in a blender and exported it to three.js format, which contains morphing targets and UVs.

I tried to assign solid colored material to the body and picture of my character ( http://touhou.ru/dev/webgl-test-stackoverflow/kourindouhime.jpg ), but after loading the grid and materials I get a gray grid.

Here is the production version of my project (using wasd to move, and when you see the gray grid of players with which you will control, this is exactly what I'm talking about): http://touhou.ru/dev/webgl-test-stackoverflow /

And this is how I load the grid and materials using JSONLoader:

var player_loader = new THREE.JSONLoader(); player_loader.load( "running_babe.js", function(geo, material) { material[0].morphTargets = true; material[1].morphTargets = true; var materials = new THREE.MeshFaceMaterial(material); player = new THREE.Mesh( geo, materials ); scene.add(player); }); 

Am I doing something wrong?


UPDATE: The problem was in my export. Now the second material looks like this:

  { "DbgColor" : 15597568, "DbgIndex" : 1, "DbgName" : "Material.001", "blending" : "NormalBlending", "colorAmbient" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865], "colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865], "colorSpecular" : [0.5, 0.5, 0.5], "depthTest" : true, "depthWrite" : true, "mapDiffuse" : "kourindouhime.jpg", "mapDiffuseWrap" : ["repeat", "repeat"], "shading" : "Lambert", "specularCoef" : 50, "transparency" : 1.0, "transparent" : false, "vertexColors" : false } 

and it works very well. Thanks guys.

+2
source share
2 answers

If I looked at your code correctly, running_babe.js is the grid you are talking about. Considering its source, the materials are as follows:

 "materials" : [ { "DbgColor" : 15658734, "DbgIndex" : 0, "DbgName" : "Material", "blending" : "NormalBlending", "colorAmbient" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865], "colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865], "colorSpecular" : [0.5, 0.5, 0.5], "depthTest" : true, "depthWrite" : true, "shading" : "Lambert", "specularCoef" : 50, "transparency" : 1.0, "transparent" : false, "vertexColors" : false }, { "DbgColor" : 15658734, "DbgIndex" : 0, "DbgName" : "default", "vertexColors" : false }], 

You can clearly see that there are no textures, the second has nothing, and the first has all the colors as a shade of gray. It seems that the materials are not exported correctly. This is not a big surprise, since it is difficult to export materials, since there may not be a clear comparison between the concepts of 3d modeling and three-phase parameters. I will simply fix this by manually specifying material parameters in this file.

+1
source

You may have one material for each grid that runs OpenGL. Do you have only one grid?

-one
source

All Articles