问题
I am looking to make a copy of THREE.MeshBasicMaterial, and create my own modified material based on it. I will need to edit the shader a little, and add some uniforms ( but I can deal with that ) .
For a start I would like to have the material work just like MeshBasicMaterial and take things from there.
This is my poor attempt (where I started), which is not working: https://gist.github.com/karimbeyrouti/80c00a6b3731f52fe173
How do you create a new material based on MeshBasicMaterial in threejs ?
回答1:
this slide might be helpful
https://speakerdeck.com/yomotsu/low-level-apis-using-three-dot-js?slide=22
Use ShaderMaterial with build-in Shader-Chunks.
https://github.com/mrdoob/three.js/blob/master/src/renderers/shaders/ShaderLib.js
then you can make own extended MeshBasicMaterial.
来源:https://stackoverflow.com/questions/34853621/extending-three-meshbasicmaterial