Porting Shadertoy Shader to Defold (SOLVED)

#1

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

#2

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

#3

@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

#4

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.jarosz21.

Signing off to rejoice my first shader :wink:

7 Likes