Xor Shaders
  • Tutorials
  • About

Converting GlSLsandbox Shaders

3/9/2015

8 Comments

 
In the last tutorial we talked about converting ShaderToy shaders to GameMaker: Studio. Today we'll be converting GLSL Sandbox shaders. Today we'll convert this shader (the code can also be found below). The main differences are caused by undeclared variables. I will list the fixes to the most common ones.

Shaders on glslsandbox.com

Shaders on GLSL Sandbox have a few differences from shaders in GameMaker. Like on ShaderToy there are no textures most of the time. However GLSL Sandbox only supports frame buffers. If a shader uses theses, there will be a uniform sampler2D with the other uniforms. It can be named anything, but it is most often called "backbuffer" or "bb". Frame buffers must be made in GameMaker outside of the shader. These can be done with surfaces in GameMaker, but because these are very rarely used I will not get in too much detail. 

Read More
8 Comments

Converting Shadertoy Shaders

3/8/2015

17 Comments

 
Shaders on websites like Shadertoy.com or GLSLsandbox.com work a little different than shaders in GameMaker: Studio. Today I'll be talking about Shadertoy.com. For this example, we will port my "Pixel Noise" shader to GameMaker (code also below), so use that for the code. 
Note that because the shaders are designed for Shadertoy.com, they won't always be fully optimized for GameMaker. It can often be best to just design a shader yourself. This tutorial may not cover all the differences, but it should help you convert most shaders from Shadertoy.com.
The shaders on Shadertoy.com don't need textures and most of them don't even use textures (my shader does not use any textures either). If a shader does use textures it will show the textures at the bottom right (at the iChannel0-iChannel3). In GameMaker: Studio, shaders must  be applied to something, so most of the shaders designed for GameMaker, are applied to sprites, backgrounds, or in 3D they can be applied to planes. That means shaders in GameMaker must have at least one texture (although that texture can be a blank rectangle). Another difference is Shadertoy shaders recently started using fragColor for gl_FragColor. To remove errors simply change those back to gl_FragColor. Also "void mainImage( out vec4 fragColor, in vec2 fragCoord )" should be replaced with this "void main( void)".

Shaders on shadertoy.com


Read More
17 Comments

    Tutorials

    New tutorial at GMshaders.com!

    Categories

    All
    3D
    Beginner
    Intermediate

    Archives

    October 2021
    November 2019
    January 2019
    May 2016
    August 2015
    June 2015
    March 2015
    February 2015
    January 2015
    December 2014

    RSS Feed

Powered by Create your own unique website with customizable templates.