IceCreamYou / THREE.Terrain

A procedural terrain generation engine for use with the Three.js 3D graphics library for the web.
https://icecreamyou.github.io/THREE.Terrain/
MIT License
717 stars 112 forks source link

Improve material implementation #29

Closed Ithamar closed 3 years ago

Ithamar commented 3 years ago

Instead of building a custom material entirely, I now use MeshLambertMaterial directly, but use the onBeforeCompile hook to patch its shaders to do our additional work. For this patching I use the shader fragment includes for common / map_fragment, which are available in all shaders (So other materials should work as well). This should make the code much more future-proof.