Previous topicNext topic

iChannel0 texture external image

Questions, comments, feedback, etc.
Post Reply
iceman
Posts: 2
Joined: Thu Nov 20, 2014 1:19 pm

iChannel0 texture external image

Post 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.
Magic
Site Admin
Posts: 3441
Joined: Wed Apr 09, 2014 9:28 pm

Re: iChannel0 texture external image

Post 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 12346 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.
iceman
Posts: 2
Joined: Thu Nov 20, 2014 1:19 pm

Re: iChannel0 texture external image

Post 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.
Syd
Posts: 60
Joined: Thu Oct 16, 2014 10:32 am

Re: iChannel0 texture external image

Post by Syd »

here is a mirror of all the shadertoy textures (and cubemaps).

http://shinythings.tv/shadertoy%20textures.zip
Ranya
Posts: 18
Joined: Fri Nov 07, 2014 7:57 pm

Re: iChannel0 texture external image

Post by Ranya »

Hi, how do you use these textures?
Magic
Site Admin
Posts: 3441
Joined: Wed Apr 09, 2014 9:28 pm

Re: iChannel0 texture external image

Post 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 12317 times
...is different than this:
noise2.jpg
noise2.jpg (247.19 KiB) Viewed 12317 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.
Magic
Site Admin
Posts: 3441
Joined: Wed Apr 09, 2014 9:28 pm

Re: iChannel0 texture external image

Post 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?
Syd
Posts: 60
Joined: Thu Oct 16, 2014 10:32 am

Re: iChannel0 texture external image

Post 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?
Magic
Site Admin
Posts: 3441
Joined: Wed Apr 09, 2014 9:28 pm

Re: iChannel0 texture external image

Post 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.
fractaledvisions
Posts: 1
Joined: Sat Apr 29, 2017 10:48 pm

Re: iChannel0 texture external image

Post 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
Magic
Site Admin
Posts: 3441
Joined: Wed Apr 09, 2014 9:28 pm

Re: iChannel0 texture external image

Post 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

:)
Post Reply