Previous topicNext topic

using shaders from shadertoy.com

Questions, comments, feedback, etc.
Post Reply
bylefjild
Posts: 14
Joined: Wed Oct 23, 2024 7:37 am

using shaders from shadertoy.com

Post by bylefjild »

I did find a few interesting shaders on shadertoy.com and my question is: why do some shaders load without a problem in MMV and others don't? What makes a shader compatible with Magic?
Terry Payman
Posts: 719
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: using shaders from shadertoy.com

Post by Terry Payman »

Are you using the VIDVOX ISF editor to convert Shadertoy shaders to ISF format?

Not an exact answer to your question, but I find that some Shadertoy shaders work perfectly in the ISF editor, some need slight edits and some have ISF editor compilation errors that are way beyond my understanding.

I think there are some Shadertoy built-in facilities that are not implemented in ISF, although I don't have the skills to spot these in the Shadertoy code and just use an empirical approach - I simply try to import it and see if it works.

It would be useful if someone with an understanding of both Shadertoy and ISF could list some ISF editor compilation errors showing which ones could have fixes/workarounds and which ones are unfixable.

Strangely, although I suspect an error on my part, I think I have had shaders that work in the ISF editor environment but not in Magic. I will save an example if it happens again.
bylefjild
Posts: 14
Joined: Wed Oct 23, 2024 7:37 am

Re: using shaders from shadertoy.com

Post by bylefjild »

Thanks for your reply! After my post I came across another thread about this subject and your contribution. I had already installed the ISF editor. So I used it for the failing shader and indeed it gave a programming error. It was just one, so I have to find out how to correct the error. It was about using an undeclared identifier, so maybe doable. Another shader gave numerous errors, probably because of sloppy programming, and that seems impossible for me to correct. So I support you, if someone with more shader programming experience could step in on how to repair a faulty shader, that would be nice. BTW quite a lot of shaders worked by just copying the code into a text file and load this file in MMV, so no need for the ISF editor.
Sadler
Posts: 1188
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: using shaders from shadertoy.com

Post by Sadler »

The shaders that will give the most issues are the multi-buffer shaders and any shader that is 'golfed' i.e. optimised for minimal code length. There are also a few specific things that aren't supported which can't be fixed (breaks, cubemaps and others) and some standard issues that are relatively easy to fix (e.g. shadertoy allows writing to fragCoord which isn't allowed in Magic or ISF and maybe all other shader implementations).

If you're using GLSLShader module text files, the Magic_GLSLShader_compile_errors.txt will tell you what's up when it fails.

Even if a shader looks 'sloppy', given the amount of skill required to write shaders, I doubt it is anything but sloppy, in most cases. Like Terry, I've had shaders work in the vidvox editor but not in Magic - there's nothing more to be done at this stage.
Sadler
Posts: 1188
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: using shaders from shadertoy.com

Post by Sadler »

Terry wrote:I think I have had shaders that work in the ISF editor environment but not in Magic
I've just had that experience with a multi-buffer shader that ran in the ISF editor but not in Magic. After trying a few obvious attempts to fix it, I gave up with Magic_GLSL_compile_errors.txt giving this error/warning:

Code: Select all

0(370) : warning C1503: undefined variable "_BufferA_imgRect"
0(128) : error C1008: undefined variable "_BufferA_imgRect"
However, later I persevered and managed to get it working in Magic. There was a #define BUFSIZE IMAGE_SIZE(BufferA) that corresponded to each error/warning in the log each time it was used. It wasn't immediately obvious to me how to fix it but I eventually replaced all references to that define with RENDERSIZE which didn't change the shader and allowed it to run in Magic.
Terry Payman
Posts: 719
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: using shaders from shadertoy.com

Post by Terry Payman »

Many thanks Sadler!
Very helpful info :D
Post Reply