# Porting Shadertoy Shader to Defold (SOLVED)

**URL:** <https://forum.defold.com/t/porting-shadertoy-shader-to-defold-solved/67609>\
**Category:** Questions\
**Created:** [February 21, 2021, 3:57pm UTC](https://forum.defold.com/t/porting-shadertoy-shader-to-defold-solved/67609 "2021-02-21T15:57:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheKing0x9](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/theking0x9/32/13588_2.png) [@TheKing0x9](https://forum.defold.com/u/TheKing0x9)\
**Post date:** [February 21, 2021, 3:57pm UTC](https://forum.defold.com/t/porting-shadertoy-shader-to-defold-solved/67609/1 "2021-02-21T15:57:37Z")

</div>

Hi everyone!  
Today is the first day I started learning shader magic. 😁 I followed the Star Nest tutorial from the Defold Tutorials, and then moved on to implementing a [Glitch Shader](https://www.shadertoy.com/view/XtK3W3) 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

---

<div class="post-metadata">

**Author:** ![roccosaienz](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/roccosaienz/32/19991_2.png) [@roccosaienz](https://forum.defold.com/u/roccosaienz)\
**Post date:** [February 21, 2021, 4:42pm UTC](https://forum.defold.com/t/porting-shadertoy-shader-to-defold-solved/67609/2 "2021-02-21T16:42:43Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [February 21, 2021, 6:01pm UTC](https://forum.defold.com/t/porting-shadertoy-shader-to-defold-solved/67609/3 "2021-02-21T18:01:19Z")

</div>

@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 😉

---

<div class="post-metadata">

**Author:** ![TheKing0x9](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/theking0x9/32/13588_2.png) [@TheKing0x9](https://forum.defold.com/u/TheKing0x9)\
**Post date:** [February 22, 2021, 7:11pm UTC](https://forum.defold.com/t/porting-shadertoy-shader-to-defold-solved/67609/4 "2021-02-22T19:11:05Z")

</div>

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

Signing off to rejoice my first shader 😉

---

<div class="post-metadata">

**Author:** ![dlannan](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dlannan/32/39440_2.png) [@dlannan](https://forum.defold.com/u/dlannan)\
**Post date:** [March 19, 2021, 2:41am UTC](https://forum.defold.com/t/porting-shadertoy-shader-to-defold-solved/67609/5 "2021-03-19T02:41:38Z")

</div>

I have used some of the ShaderToy shaders in this if it helps:  
[https://github.com/dlannan/defold-3d-samples](https://github.com/dlannan/defold-3d-samples)  
The Sky Shader: However, its _not_ screen space, its world space .. which was the challenge 🙂

---

<div class="post-metadata">

**Author:** ![TheKing0x9](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/theking0x9/32/13588_2.png) [@TheKing0x9](https://forum.defold.com/u/TheKing0x9)\
**Post date:** [March 23, 2021, 3:00pm UTC](https://forum.defold.com/t/porting-shadertoy-shader-to-defold-solved/67609/6 "2021-03-23T15:00:55Z")

</div>

That’s great ! Thanks a lot !
