The Shadertoy website is a great tool to test your skill in writing shaders.
This is my first try with this tool.
See the source code I write to make a notepad paper example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #define PI 3.14159265359 void mainImage( out vec4 fragColor, in vec2 fragCoord ) { vec2 uv = (fragCoord.xy) / iResolution.xy; vec2 auv=vec2(uv.x*iResolution.x/iResolution.y,uv.y); vec3 col=vec3(1.,1,.95); vec4 ink=vec4(0.,.8,.8,0.1); ink.rgb+=col*0.009; col=mix(col,ink.rgb,1.-clamp(64.+cos(auv.y*PI*64.)*64.,0.,1.)); col=mix(col,ink.bar,clamp((.5+(distance(auv.x,0.1)*-90.)),0.,1.)); vec4 tex=vec4(0.,0.,0.,1.); col=mix(col,vec3(0.1),clamp(tex.r*0.1,0.,1.)); col*=clamp((1./inversesqrt(2.4-distance(vec2(0.5),uv))),0.,1.); fragColor = vec4(col,1.0); } |
Use the fullscreen option to see correctly the result of this shader.