three.jsprojection-matrix

To save object that has projected materials as glb file


I have three.js app that project images to object. Now I want to save that object as glb file.

Here is an issue. The projected material is not saved. I can't see it when I open the saved glb file with Blender.

           object.traverse(function (child) {
                if (child instanceof THREE.Mesh) {
                    
                    child.material = material1
                    child.material.needsUpdate = true
                    material1.project(child)
                    
                    scene1.add(child)
                    const exporter = new Exporter();
                    exportBtn.addEventListener('click', () => {
                      exporter.exportScene(child);
                    })
                }
            }

It is not uv mapping, it's project 'mapping'. What do I miss? What should I do now? Please help me.


Solution

  • ProjectedMaterial does not get exported when you export Mesh with GLTFExporter, because it's real-time shader. Leave ProjectedMaterial. You can get the same effect with MeshBasicMaterial. Please try with uv mapping. You can get projection effect as you adjust uv property of the geometry. Keep texture map and other properties of the mesh geometry. You need to concern the image scale and offset.