<p>Google was useless for answering this one, but I was surprised that Bard got it on the first go:</p>
<pre><code>vec3 do_something_fancy( in sample2D channel, in vec2 uv, yodeling monkey_nuggets) {
    vec4 lookup_result = texture(channel, uv);

    ...
}
</code></pre>

CC BY-SA 4.0
2023-10-19T23:42:05.197Z
2023-10-19T23:42:05.197Z
Sniggerfardimungus
<p>You can click 'Shader inputs' above the panel containing the code to obtain a dropdown with all the types:</p>
<p><a href="https://i.sstatic.net/rhHky.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rhHky.png" alt="enter image description here" /></a></p>
<p>As can be seen here the type is either sampler2D or samplerCube.</p>

CC BY-SA 4.0
2023-10-21T22:15:03.240Z
I'd never noticed that before. Nice!
Sniggerfardimungus
CC BY-SA 4.0
2023-10-20T08:35:28.157Z
2023-10-20T08:35:28.157Z
Reynolds
<p>I'd like to have a helper function in the Common tab that does something fancy with texture input and returns the result. I'd like the function in question to be able to use any <code>iChannel</code>, like:</p>
<pre><code>vec3 do_something_fancy( in channelType channel, in vec2 uv, yodeling monkey_nuggets) {
    vec4 lookup_result = texture(channel, uv);

    ...
}
</code></pre>
<p>I've taken a few guesses as to the type of <code>iChannel[0-4]</code> but have struck out.</p>

<glsl>
What's the type of iChannel[0-3] in Shadertoy?
Sniggerfardimungus
# What's the type of iChannel[0-3] in Shadertoy?

(Asked by: username_0 on 2023-10-19)

I'd like to have a helper function in the Common tab that does something fancy with texture input and returns the result. I'd like the function in question to be able to use any iChannel, like:
vec3 do_something_fancy( in channelType channel, in vec2 uv, yodeling monkey_nuggets) {
    vec4 lookup_result = texture(channel, uv);

    ...
}

I've taken a few guesses as to the type of iChannel[0-4] but have struck out.

**Tags:** glsl

---

## 2 answers

### Answer by username_0 on 2023-10-19. Score: -2 | Accepted answer

Google was useless for answering this one, but I was surprised that Bard got it on the first go:
vec3 do_something_fancy( in sample2D channel, in vec2 uv, yodeling monkey_nuggets) {
    vec4 lookup_result = texture(channel, uv);

    ...
}


---

### Answer by username_1 on 2023-10-20. Score: 2

You can click 'Shader inputs' above the panel containing the code to obtain a dropdown with all the types:

[![enter image description here](https://i.sstatic.net/rhHky.png)](https://i.sstatic.net/rhHky.png)

As can be seen here the type is either sampler2D or samplerCube.

> **Comments:**
> **username_0**: I'd never noticed that before. Nice!  

---

