Compute normals from displacement map in three.js r.58?

后端 未结 3 860
天命终不由人
天命终不由人 2021-01-01 02:52

I\'m using the normal shader in three.js r.58, which I understand requires a normal map. However, I\'m using a dynamic displacement map, so a pre-computed normal map won\'t

3条回答
  •  时光说笑
    2021-01-01 03:05

    You can also calculate a normal map from the displacement map with JavaScript. This results in smooth normals, and is a good option if your displacement map isn't changing too often.

    This method uses the code found in this demo: http://mrdoob.com/lab/javascript/height2normal/

    Demo here: http://meetar.github.io/three.js-normal-map-0/index14.html

    enter image description here

提交回复
热议问题