Page 1 of 1

iChannel0 texture external image

Posted: Thu Nov 20, 2014 1:21 pm
by iceman
I was checking the forums but no answers to the following question: How do I add to Magic an iChannel0 texture external image?

I was trying to get this shader to work in Magic: https://www.shadertoy.com/view/XsfGzH

I used an image (512px and 1024px noise png) as an input to the GLSL module, and not even close to the expected result.

Would you please let me know what should I do.

Re: iChannel0 texture external image

Posted: Thu Nov 20, 2014 10:39 pm
by Magic
Good question. In general, you just have to connect an Image module to the GLSLShader module, as you said. Like this:
MatrixDonut.jpg
MatrixDonut.jpg (85.34 KiB) Viewed 12901 times
But, the problem with some shaders on Shadertoy.com is that they don't use the images directly, but rather as a shortcut for other computations. In the example you provided, he is using iChannel0 as part of a noise function. I don't think there's a way to download images from Shadertoy.com, so his function can't be duplicated exactly. To come close, you'd have to create the image yourself (using Photoshop, etc.). But I'm not sure it's possible since his function is so specific. I tried it myself and I couldn't get it to work :). Sorry about that.

Re: iChannel0 texture external image

Posted: Fri Nov 21, 2014 11:57 pm
by iceman
Hi Eric,
Thanks for your post. I was playing a little bit with some images I did in photoshop and I am getting some results in some of the shadertoy.com shaders, but for this specific shader I canĀ“t get anything close. I am learning a little bit of noise functions in glsl to generate the noise via function instead of images. I'll keep you posted. Cheers.

Re: iChannel0 texture external image

Posted: Mon Nov 24, 2014 8:48 am
by Syd
here is a mirror of all the shadertoy textures (and cubemaps).

http://shinythings.tv/shadertoy%20textures.zip

Re: iChannel0 texture external image

Posted: Mon Nov 24, 2014 1:41 pm
by Ranya
Hi, how do you use these textures?

Re: iChannel0 texture external image

Posted: Mon Nov 24, 2014 6:54 pm
by Magic
Most of the time it's pretty simple, as I explained above. Just load a texture into an Image module, and connect it as an input to the GLSLShader module.

But, one important thing to understand is that all modules use the entire Magic window as input, even if an image only covers some of the window. In other words, this:
noise1.jpg
noise1.jpg (151.88 KiB) Viewed 12872 times
...is different than this:
noise2.jpg
noise2.jpg (247.19 KiB) Viewed 12872 times
And, shaders that use texture images as noise functions often assume the entire window is the texture, like the second image.

So the bottom line is that you'll get different results depending on the image's aspect ratio.

That might be a little confusing, so let me know if you have any questions.

Re: iChannel0 texture external image

Posted: Tue Nov 25, 2014 5:41 pm
by Magic
Syd wrote:here is a mirror of all the shadertoy textures (and cubemaps).

http://shinythings.tv/shadertoy%20textures.zip
Great, thanks! How did you get this?

Re: iChannel0 texture external image

Posted: Wed Nov 26, 2014 1:40 am
by Syd
Eric wrote:
Syd wrote:here is a mirror of all the shadertoy textures (and cubemaps).

http://shinythings.tv/shadertoy%20textures.zip
Great, thanks! How did you get this?
browser tools network monitor to catch the http request, then pulled them all down individually :)

still doesn't really help much if the sampler only has access to the full window though. Could we perhaps have a experimental shader plugin with 4x samplers from file input instead? the video library you use also does a pretty good job of opening images, so perhaps you could hit two birds with one stone there. Maybe expose the unscaled textures with some new variables so they (the fragment shaders) could be easily ported but not break backwards compatibility in magic?

Re: iChannel0 texture external image

Posted: Tue Dec 09, 2014 5:57 am
by Magic
Maybe expose the unscaled textures with some new variables so they (the fragment shaders) could be easily ported but not break backwards compatibility in magic?
It's a possibility. I'll need to have a good think about it though, because it's tricky.

Re: iChannel0 texture external image

Posted: Sat Apr 29, 2017 10:50 pm
by fractaledvisions
@Syd is it possible to acquire the more recent textures that have been added, specifically the ASCII Font 1 by Otaviogood? Would help me with a project. Not sure anywhere else to find this. Thanks! :D

Re: iChannel0 texture external image

Posted: Wed May 03, 2017 6:29 pm
by Magic
is it possible to acquire the more recent textures that have been added, specifically the ASCII Font 1 by Otaviogood? Would help me with a project. Not sure anywhere else to find this. Thanks! :D
Try this: https://www.shadertoy.com/media/a/08b42 ... b31560.png

:)