patriciogonzalezvivo / glsl-pipeline

Prototype complex pipelines directly from a single shader by branching it into stages
MIT License
80 stars 5 forks source link

GlslPipelineReact material blank with multiple buffer / General GLSL confusion #8

Open eriksachse opened 9 months ago

eriksachse commented 9 months ago

I'm trying to port a shader from Shadertoy to my React Three application. I'm just very confused in working with buffer. The examples and documentation don't help me much and I don't know where I'm going wrong..

Here is a CSB I'm working with right now: https://codesandbox.io/p/sandbox/glsl-pipeline-material-fslk3y?file=%2Fsrc%2Fcomponents%2Fthree%2FScene.jsx%3A97%2C28

This is the Shadertoy I want to port: https://www.shadertoy.com/view/tljXWV

Thing is I'm not an expert and it seems so simple, but also very complex in terms of getting the right function/prop. In Shadertoy there is textureLod being used, and upon googling I'm not sure if that is even possible inside WebGL(?). There is this thing and that thing, but I just want multiple buffers in a feedback working. Same as now in the examples there is being color += being used in each buffer, while Shadertoy is always using fragColor as output. How is it that all the tools are so different, but in the end should be the same: Some cool flickering canvas doing fun stuff.

ammein commented 1 month ago

Might be too late for you, I haven't tried textureLod feature in webgl. Perhaps this StackOverflow solution will solve your issue?

https://stackoverflow.com/questions/15188434/webgl-texture2dlod-alternative