mjanisz1
mjanisz1

Reputation: 1516

Mix textures in predefined materials

Is there a way to add multiplie texture maps to a material like phong?

I know it's easy to use shadermaterial and pass them as uniforms, than just mix in the shader, but I want to use predefined specularmaps, envmaps etc. and don't want to rewrite everything from scratch.

Upvotes: 2

Views: 144

Answers (2)

WestLangley
WestLangley

Reputation: 104783

You want to add multiple texture maps to MeshPhongMaterial and mix or blend them.

If you don't want to replicate the functionality of MeshPhongMaterial with a custom ShaderMaterial, you can render to a texture first using your mixing shader, and then use the resulting texture as the MeshPhongMaterial.map.

three.js has a render-to-texture example here.

three.js.r.71

Upvotes: 1

Adam Finley
Adam Finley

Reputation: 1610

Have you checked out the documentation page for MeshPhongMaterial?

It supports a number of different textures at the same time, and has some rudimentary support for defining how they are blended.

Upvotes: 0

Related Questions