For those using the JSON Object Scene format 4 for Three.js, there is a specification for materials that can be found here.
However, it seems unclear whether it is possible to reference a custom shader from this specification. Does anyone have any insights on how this could be achieved?
[UPDATE]
Upon reflection, it appears my initial question may not have been clear enough. What I'm really trying to figure out is how to make the JSON loader interpret a material defined by a custom shader within the JSON Object Scene format 4:
"materials": [
{
"uuid": "87D95D6C-6BB4-4B8F-8166-A3A6945BA5E3",
"type": "MeshPhongMaterial",
"color": 16777215,
"ambient": 16777215,
"emissive": 0,
"specular": 1118481,
"shininess": 30,
"opacity": 1,
"transparent": false,
"wireframe": false
}
],
"object": {
"uuid": "89529CC6-CBAC-412F-AFD1-FEEAE785BA19",
"type": "Scene",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"children": [
{
"uuid": "33FA38D9-0AAC-4657-9BBE-5E5780DDFB2F",
"name": "Box 1",
"type": "Mesh",
"geometry": "C3BF1E70-0BE7-4E6D-B184-C9F1E84A3423",
"material": "87D95D6C-6BB4-4B8F-8166-A3A6945BA5E3",
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]
},
In this excerpt, a mesh references a material by its UUID. The issue lies in the fact that the types of materials are predetermined within the WebGLPrograms function, making it challenging to expand this list with a custom shader.