marcofugaro / three-projected-material

📽 Three.js Material which lets you do Texture Projection on a 3d Model
https://marcofugaro.github.io/three-projected-material/
MIT License
671 stars 57 forks source link

multiple materials #12

Closed juanuys closed 3 years ago

juanuys commented 3 years ago

Three.js supports multiple materials on a Mesh.

I'm a bit of a Three.js/GLSL newb, so would like some guidance on how to get this library to support multiple projections (i.e. projecting material 0 onto the "front" and material 1 onto the "back" of a set of geometries). I guess I can instantiate two ProjectedMaterials, each with a different texture and a different camera.

Would it require changes to the shaders? It seems it would require multi-material support here.

marcofugaro commented 3 years ago

Yeah that has been in the TODOs in the readme for a bit, would need to find a way on how to do that.

On the API side ideally it would require only a camera and multiple textures. Then internally there would be as many savedModelMatrix as the textures passed initially.

Then it would be a matter of choosing the texture and savedModelMatrix to use in the shader.

It's doable in my opinion.

marcofugaro commented 3 years ago

Multiple materials are now supported in v2.0.0 🎉

Check out these examples:

https://marcofugaro.github.io/three-projected-material/multiple-projections https://marcofugaro.github.io/three-projected-material/multiple-projections-instancing