how to migrate a project from three js to react? #2575
-
Hi, for 4 days I've been trying to transfer this project https://codepen.io/deantek/pen/WNJYdmM from threejs to react, but it just doesn't work, I tried different methods, but the result is the same, the animation is twitchy and not so smooth, and in general it turns out not quite what you need, who can anyone suggest me what I'm doing wrong? my try - https://codesandbox.io/s/magical-ben-z6j619?file=/src/App.js Please tell me or give me some example because I don't know what to do |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
When I run your code it gives a warning dat the Output of vertex shader ... not read by fragment shader. the rest of the code looks a clean copy from three.js to r3f. But if you want the same effect via this link it is explained step by step how you can do this. Making the blob is one of the last exercises in the link. link --> https://blog.maximeheckel.com/posts/the-study-of-shaders-with-react-three-fiber/ |
Beta Was this translation helpful? Give feedback.
-
yes, i have already seen this and reviewed these examples, but i would like to overlay perlin noise like in my example |
Beta Was this translation helpful? Give feedback.
-
Here's a cleaned up vanilla version: I'd recommend looking into Here's the R3F version: As an aside, I'd check out https://github.com/stegu/webgl-noise with updated Perlin noise code. It should have less artefacts along diagonals than previous versions. I use this on my personal site to a similar effect. |
Beta Was this translation helpful? Give feedback.
Here's a cleaned up vanilla version:
I'd recommend looking into
Drei#shaderMaterial
for custom materials, but the tricky part here is maintaining a stable reference to uniforms; I opted to store them in auseRef
, but you could use any form of state.Here's the R3F version:
As an aside, I'd check out https://github.com/stegu/webgl-noise with updated Perlin noise code. It should have less artefacts along diagonals than previous versions. I use this on my personal site to a similar effect.