复制现有 Three.js 材料以添加位移计算 [英] Duplicate existing Three.js materials to add displacement calculations

查看:66
本文介绍了复制现有 Three.js 材料以添加位移计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 Three.js 中使用纹理贴图进行顶点位移.

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

  1. 是否有支持这一点的现有材料?
  2. 如果没有,复制现有 Three.js 着色器以便我可以添加一些顶点位移计算的最佳方法是什么?我想在材质上保留现有的功能,例如阴影和线框.

推荐答案

THREE.ShaderTerrain[ "terrain" ]THREE.ShaderLib[ " 支持使用纹理贴图的顶点位移法线贴图"].

它们的使用示例可以在 http://threejs.org/examples/webgl_terrain_dynamic.htmlhttp://threejs.org/examples/webgl_materials_normalmap.html.

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

three.js r.61

这篇关于复制现有 Three.js 材料以添加位移计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆