Porting Shadertoy Shader to Defold (SOLVED)

Hi everyone!
Today is the first day I started learning shader magic. :grin: I followed the Star Nest tutorial from the Defold Tutorials, and then moved on to implementing a Glitch Shader from the Shadertoy website.

Most of the code from it has been understandable so far, but I don’t get what is ichannel0 in the code.

Thanks in advance

3 Likes

I would say that

texture(iChannel0, ...)

is somehow equivalent to

texture2D(tex0, ...)

where tex0 is a 2dsampler

uniform lowp sampler2D tex0;

But I am not sure.
Ciao!

3 Likes

@roccosaienz is totally right, I don’t know what approach are you trying, but generally you are providing what is called a texture sampler to the fragment program and on Shadertoy the first one is called iChannel0, while in Defold’s example and default programs it is called tex0 :wink:

3 Likes

I tried doing the suggested changes, and I now have a working glitch Shader :partying_face: Thanks a lot for your help @roccosaienz and @Pawel.

Signing off to rejoice my first shader :wink:

8 Likes

I have used some of the ShaderToy shaders in this if it helps:


The Sky Shader: However, its not screen space, its world space … which was the challenge :slight_smile:

7 Likes

That’s great ! Thanks a lot !

1 Like