How to make shader work with deprecated/Geometry

Hello,

I was trying to add this Shader to my Drei/Fiber project, but after researching the error I notice that

import { Geometry } from “three/examples/jsm/deprecated/Geometry”

is no longer supported. However, the demo is still up and running. Is there a workaround I can use to make this shader work with the newest version of three.js?

Replace it with BufferGeometry and hope for the best :crossed_fingers:

import { BufferGeometry } from “three”

Edit: Here is an edited version of the example with BufferGeometry

2 Likes

Thanks a lot for taking the time to fork it @Fennec.

I’m having a few tiny problems setting that up; getting these errors (yes I am a beginner :slight_smile: ) but it seems imported BufferGeometry is not used due to the “instanced” at the beginning of the BufferGeometry that’s declared inside the < mesh >. I made a < BufferGeometry > wrapper around it. But then there is the two other errors: PlaneBufferGeometry not exported and “simplex-noise” does not contain a default export

@drcmda I noticed you wrote this beautiful shader into React. Maybe you’ve got an idea how it can be upgraded to BufferGeometry. Fennec did some work above

sorry this has too many deprecations. three removed the geometry class completely now. i wouldn’t know how to fix that part.

1 Like

PlaneBufferGeometry is now just PlaneGeometry. As for simplex-noise you can try
import { simplexNoise } from 'simplex-noise' if the simplex-noise file does not export “simplexNoise” you’re going to have to find a way to export it yourself eg…

export const simplexNoise = () => {
  //simplex-noise code here
}

and then import as above…

import { simplexNoise } from 'simplex-noise'
1 Like