Duplicate existing Three.js materials to add displacement calculations

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 02:36:18

问题


I need to do vertex displacements using a texture map in Three.js.

  1. Is there an existing material that supports that?
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!