Material Specification Specification THI.js JSON

I am brand new using Three.js and am writing an exporter from my own model format to the JSON model format respectively. The format of the scene to be loaded using Three.js. I do not understand the differences in the JSON material specification. Using the Three.js JSONLoader specifier, the material specification should define such colors: ... "colorAmbient": [0.0, 0.0, 0.0], "colorDiffuse": [0.0, 1.0, 0.0], .... I tried "colorDiffuse" : 65280, but this does not work. Also, the "colorSpecular" parameter is not considered using JSONLoader. When I check the loaded result in Firebug, I see only normal and diffuse color. In contrast, the JSON scene format for Three.js defines materials using a list of parameters, for example:

"phong_skin": { "type": "MeshPhongMaterial", "parameters": { "color": 0, "ambient": 0, "specular": 16777215, "shininess": 50, ... }}, 

Why is the JSON format for the scene and object so different from the material specification? What about specular color and specularCoef? Did I miss something?

My simple JSON file (representing a plane):

 { "faces": [40,0,1,2,0,1,2,0,1,2,40,3,4,5,3,4,5,3,4,5], "materials":[{ "DbgColor":15658734, "DbgIndex":0, "DbgName":"_global_FLOOR_MAT", "colorAmbient":[0.0, 0.0, 0.0], "colorDiffuse":[0.0, 1.0, 0.0], "colorSpecular":[1.0, 1.0, 0.0], "opacity":1, "specularCoef":128, "transparent":false, "wireframe":false, "blending" : "NormalBlending" }], "metadata":{ "formatVersion":3.1, "generatedBy":"My Exporter"}, "normals":[0,-0,1,0,-0,1,0,-0,1,0,-0,1,0,-0,1,0,0,1], "scale":1, "uvs":[[0,-193.333,0,-0,58,-0,0,-193.333,58,-0,58,-193.333]], "vertices":[0,1160,0,0,0,0,1160,0,0,0,1160,0,1160,0,0,1160,1160,0] } 
+4
source share

Source: https://habr.com/ru/post/1500886/


All Articles