1

I'm creating terrain editor with three.js and i have encountered few problems. First. Shadows renders on MeshLambertMaterial, but it wont on ShaderMaterial. Second. How to change object's material (from lambert to shader) on runtime? Here's demo of my editor: http://78.62.160.169/webgl/editor/ And source code: http://78.62.160.169/webgl/editor/script.js

4

2 回答 2

1

LambertMaterial是插件支持的内置材质。所以阴影插件支持在 上渲染LambertMaterial,虽然ShaderMaterial是你自己的着色器/材质,应该手动启用阴影支持,默认情况下没有设置。

切换素材:https ://github.com/mrdoob/three.js/wiki/Updates

于 2013-09-23T18:34:59.200 回答
0

这是带有阴影和雾的 ShaderMaterial 的示例

https://gist.github.com/wmcmurray/6696fc95f25bbd2401d72a74e9493261

或者您也可以从 LambertMaterial 或其他重写着色器,

让它支持你自己的着色器

于 2020-07-19T15:15:53.247 回答