Search code examples
javascriptreactjsthree.jsrenderer

three.js in React - THREE.ShaderTerrain missing


I need to make a 3D map from heightmap image in React and I came across this website which has a decent demo I wanted to implement in my application as a beginning.

The very problem of this example is that the ShaderTerrain property is completely missing (at least in my application). Am I missing an import? Here is the error I am getting:

Failed to compile.

./src/App.js
Attempted import error: 'ShaderTerrain' is not exported from 'three' (imported as 'THREE').

Solution

  • The tutorial you have linked is many years old. The respective demo uses three.js in version r49. The current release is r115. In the past, ShaderTerrain was first renamed to TerrainShader and later removed with release r112.

    However, you can move back in time with this URL and copy the code to your project.