Importing from Shadertoy - Error

Hello!

I am trying to import this from Shadertoy:
shadertoy.com/view/llfczH

These are the first times I am working with GLSL and importing and I am trying to figure out, if the buffer procedure is fine.

However, the buffer A returns an error back.
Can anyone help me with that? see attached toe

Thank you!
Raindrop_error.toe (7.01 KB)

Hi there,

You were almost there!.. I fixed a few things for you:

  • First shader had a ‘g’ in the main function (think this is a left over of gl_FragCoord what it was before). That part is used to calculate the uv coordinate. In TD you can jut use ‘vUV.st’.
  • I noticed the shader used mipmapping (textureLod()). You need to set this in the ‘common’ tab of the glsl top (input smoothness).
  • After this I noticed some crazy ugly repeating pattern. This was caused by the ‘Input Extend Mode UV’ of the first shader set to ‘hold’. This should be ‘repeat’.
  • Then last thing I changed was the input in the second shader. You had 3 inputs but it should be 2, where the first one is the output of the first buffer, and the second on the feedback of the second buffer.
  • Changed the resolution to fixed 1280x720 (was set to same as input, which was 400x300)

Hope this helps!
Cheers,
tim
Raindrops.tox (4.12 KB)

Thank you for your help!

I am still having lot of problems in converting other shadertoys. Someway I always get some error especially undefined variables and implicit cast from “vec4” to “vec2”.

Are there any sources explaining how to overcome such errors?

There’s a chapter in Nvoid’s book Introduction to TouchDesigner about Importing Shaders from Shadertoy which covers the basics.

other useful resources are the implementation of Uğur Güney’s GLSL 2d Tutorials on shadertoy in TouchDesigner by Matthew Ragan, here: glsl2dTuts-in-TouchDesigner

also the online Book of Shaders

If you prefer a book I recommend Graphics Shaders: Theory and Practice, Second Edition and/or OpenGL 4 Shading Language Cookbook - Second Edition.
These will also help you understand Vertex Shaders and Geometry shaders (most online resources only go into pixel shaders)

Thank you for your advice nettoyeur!