问题
I need to do vertex displacements using a texture map in Three.js.
- Is there an existing material that supports that?
- If not, what is the best way to duplicate an existing Three.js shader so that I can add in some vertex displacement calculations? I would like to keep existing functionalities such as shadows and wireframe on the material.
回答1:
Vertex displacements using a texture map are supported by THREE.ShaderTerrain[ "terrain" ]
and THREE.ShaderLib[ "normalmap" ]
.
Examples of their use can be found in http://threejs.org/examples/webgl_terrain_dynamic.html and http://threejs.org/examples/webgl_materials_normalmap.html.
If these do not suit your needs, then you will have to write your own shader. Doing so is not easy. It is best to modify an existing shader.
three.js r.61
来源:https://stackoverflow.com/questions/18938710/duplicate-existing-three-js-materials-to-add-displacement-calculations