No WebGL available :(
0.00
00.0 fps
Created by in
Comments
Sign in to post a comment.
uniform vec3 iResolution; // viewport resolution (in pixels)
uniform float iGlobalTime; // shader playback time (in seconds)
uniform float iTimeDelta; // render time (in seconds)
uniform int iFrame; // shader playback frame
uniform float iChannelTime[4]; // channel playback time (in seconds)
uniform vec3 iChannelResolution[4]; // channel resolution (in pixels)
uniform vec4 iMouse; // mouse pixel coords. xy: current (if MLB down), zw: click
uniform samplerXX iChannel0..3; // input channel. XX = 2D/Cube
uniform vec4 iDate; // (year, month, day, time in seconds)
uniform float iSampleRate; // sound sample rate (i.e., 44100)
0 chars
Filter
Wrap
iChannel0
Filter
Wrap
iChannel1
Filter
Wrap
iChannel2
Filter
Wrap
iChannel3
Select Input
Misc
Buffers
Textures
Videos
Cubemaps
Music
Buffers
Render buffer A | Render buffer B | Render buffer C | Render buffer D |
Textures
Videos
Cubemaps
Music
Select Input
Misc
Textures
Textures
Select Input
Misc
Buffers
Textures
Videos
Cubemaps
Music
Buffers
Render buffer A | Render buffer B | Render buffer C | Render buffer D |
Textures
Videos
Cubemaps
Music
GLSL Help
This help only covers the parts of GLSL ES that are relevant for Shadertoy. For the complete specification please have a look at GLSL ES specification
For image shaders, fragColor is used as output channel. It is not, for now, mandatory but recommended to leave the alpha channel to 1.0.
For sound shaders, the mainSound() function returns a vec2 containing the left and right (stereo) sound channel wave data.
Language:
- Preprocessor: # #define #undef #if #ifdef #ifndef #else #elif #endif #error #pragma #extension #version #line
- Operators: () + - ! * / % < > <= >= == != && ||
- Comments: // /* */
- Types: void bool int float vec2 vec3 vec4 bvec2 bvec3 bvec4 ivec2 ivec3 ivec4 mat2 mat3 mat4 sampler2D
- Function Parameter Qualifiers: [none], in, out, inout
- Global Variable Qualifiers: const
- Vector Components: .xyzw .rgba .stpq
- Flow Control: if else for return break continue
- Output: vec4 fragColor
- Input: vec2 fragCoord
Built-in Functions:
|
|
|
|
|
|
How-to
- Use structs: struct myDataType { float occlusion; vec3 color; }; myDataType myData = myDataType(0.7, vec3(1.0, 2.0, 3.0));
- Initialize arrays: arrays cannot be initialized in WebGL.
- Do conversions: int a = 3; float b = float(a);
- Do component swizzling: vec4 a = vec4(1.0,2.0,3.0,4.0); vec4 b = a.zyyw;
- Access matrix components: mat4 m; m[1] = vec4(2.0); m[0][0] = 1.0; m[2][3] = 2.0;
Be careful!
- the f suffix for floating pont numbers: 1.0f is illegal in GLSL. You must use 1.0
- saturate(): saturate(x) doesn't exist in GLSL. Use clamp(x,0.0,1.0) instead
- pow/sqrt: please don't feed sqrt() and pow() with negative numbers. Add an abs() or max(0.0,) to the argument
- mod: please don't do mod(x,0.0). This is undefined in some platforms
- variables: initialize your variables! Don't assume they'll be set to zero by default
- functions: don't call your functions the same as some of your variables
Shadertoy Inputs
vec3 | iResolution | image | The viewport resolution (z is pixel aspect ratio, usually 1.0) |
float | iGlobalTime | image/sound | Current time in seconds |
float | iTimeDelta | image | Time it takes to render a frame, in seconds |
int | iFrame | image | Current frame |
float | iFrameRate | image | Number of frames rendered per second |
float | iChannelTime[4] | image | Time for channel (if video or sound), in seconds |
vec3 | iChannelResolution[4] | image/sound | Input texture resolution for each channel |
vec4 | iMouse | image | xy = current pixel coords (if LMB is down). zw = click pixel |
sampler2D | iChannel{i} | image/sound | Sampler for input textures i |
vec4 | iDate | image/sound | Year, month, day, time in seconds in .xyzw |
float | iSampleRate | image/sound | The sound sample rate (typically 44100) |
Shadertoy Outputs
For image shaders, fragColor is used as output channel. It is not, for now, mandatory but recommended to leave the alpha channel to 1.0.
For sound shaders, the mainSound() function returns a vec2 containing the left and right (stereo) sound channel wave data.
BBCode Help
Codes:
You can format your comments by using standard BBCode. The following tags are implemented in Shadertoy:
Bold | [b]this text goes in bold[/b] | |
Italic | [i]this text goes in italic[/i] | |
Images | [img]url_to_image[/img] | |
Url | [url]http://www.shadertoy.com[/url] | |
Url | [url=http://www.shadertoy.com]Shadertoy[/url] | |
Code | [code]fixed-width text[/code] | |
Video | [video]http://www.youtube.com/watch?v=0ifChJ0nJfM[/video] |
Emoticons:
:) | ||
:( | ||
:D | ||
:love: | ||
:octopus: | ||
:octopusballoon: |
Symbols:
:alpha: | α | |
:beta: | β | |
:delta: | Δ | |
:epsilon: | ε | |
:nabla: | ∇ | |
:square: | ² | |
:cube: | ³ | |
:limit: | ≐ |
Share your shader
Yes
No