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

Project onto a normaly textured mesh #26

Closed qwertasyx closed 2 years ago

qwertasyx commented 2 years ago

Hello,

Is it possible to project a texture onto an already textured mesh? Mixing materials like below results in an error when calling project() -> (Mesh material must be a ProjectedMaterial )

const materialA = new MeshBasicMaterial( { map: whateverTexture } ) const materialB = new ProjectedMaterial( { ... } ) const mesh = new THREE.Mesh(geometry, [materialA, materialB])

so maybe there is another another way that i dont see :)

cheers

marcofugaro commented 2 years ago

Hello!

You can pass any property from MeshPhysicalMaterial to ProjectedMaterial, so a thing like this should work:

const material = new ProjectedMaterial({ map: whateverTexture, ... })
const mesh = new THREE.Mesh(geometry, material)
qwertasyx commented 2 years ago

As simple as this ? Seems like the fragment Shader doesnt like that :D. grafik

marcofugaro commented 2 years ago

Fixed in v2.0.5