R3F, Layers, and Render Targets #2494
Replies: 1 comment 1 reply
-
So after digging a bit more this is what I did wrong:
If anyone finds any mistake in my train of thought, let me know, I'm fairly new to the concept of render targets and layers and still trying to get a good grasp at them (will post working implementation once I'll finish) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all 👋
After deep diving into shaders and R3F, I've been recently looked at layers and render targets. I'm mainly learning Three.js and React Three Fiber by trying to mimic existing websites/projects or looking at Three.js techniques and trying to port them to R3F (worked for me so far)
Recently I've been trying to port this scene from Alien.js (their repo is a gold mine if you're looking for cool shaders btw).
The Three.js code is available here if you're curious, but in a nutshell what I gathered is that these scene uses 2 main Three.js concepts: Layers and Render Targets
When looking at the
update
function I gathered that the following is happening:which should as a result apply different kinds of effects on different layers (? let me know if I'm wrong here, but this is how I understand it)
I've been trying to port this to R3F as I was interested in this technique, here's my code so far https://codesandbox.io/s/dark-night-mgilwb?file=/src/Scene.js
I managed to apply one effect on one layer (at least I think so), but whenever I try to apply a second one, the first one simply disappears.
Am I doing something fundamentally wrong? Or misunderstanding the technique used here?
At this point any pointers would help 😄
Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions