{“vs_code”:”/*MY_VERTEX_SHADER*/\n/* #version 330 core */\n varying vec2 vUv;\n void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n}”,”fs_code”:”/*MY_FRAGMENT_SHADER */\n/* #version 330 core */\nuniform vec2 u_resolution;\nvarying vec2 vUv;\nvoid main() {\n vec2 uv = gl_FragCoord.xy/u_resolution.xy;\n\n // Move coordinate from (0.0 to 1.0) => (-1.0 to 1.0)\n uv = uv * 2.0 – 1.0;\n \n gl_FragColor=vec4(uv.x,uv.y,0.0,1.0);\n}”,”uniforms”:{“u_time”:{“type”:”f”,”value”:0,”editable”:false},”u_resolution”:{“type”:”v2″,”value”:{“x”:512,”y”:512},”editable”:false},”u_mouse”:{“type”:”v2″,”value”:{“x”:0,”y”:0},”editable”:false}},”description”:”Info about your shader.”,”threeJsSettings”:{“showFloor”:false,”ambientLight”:true,”directionalLight”:true,”selected3DObject”:”Plane”},”attributes”:{“isPublic”:true,”defaultIndex”:1,”categoryId”:31}}
Shader Category: Shapes
-
Tut Basic Shape 3
{“vs_code”:”/*MY_VERTEX_SHADER*/\n/* #version 330 core */\n varying vec2 vUv;\n void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n}”,”fs_code”:”/*MY_FRAGMENT_SHADER*/\n\n// Screen/Window resolution (width and height of window)\nuniform vec2 u_resolution;\nuniform float u_time;\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy/u_resolution.xy;\n vec3 red = vec3(1.0,0.0,0.0);\n vec3 green = vec3(0.0,1.0,0.0);\n \n vec4 finalColor = vec4(0.0,0.0,0.0,1.0);\n // Calculate sin movement.\n float movement = sin(u_time * 1.0) * 0.5;\n // Modify uv coordinate based on the movement. Here we are not actually moving the object but moving/modifying the coordinate itself.\n uv.x += movement;\n if(uv.x >= 0.45 && uv.x <= 0.55 && uv.y >= 0.4 && uv.y <= 0.6)\n { \n finalColor=vec4(green, 1.0);\n }\n \n gl_FragColor=finalColor;\n }\n","uniforms":{"u_time":{"type":"f","value":0,"editable":false},"u_resolution":{"type":"v2","value":{"x":814,"y":398},"editable":false},"u_mouse":{"type":"v2","value":{"x":0.004086881070523648,"y":0.3182175219358511},"editable":false}},"description":"Info about your shader.","threeJsSettings":{"showFloor":false,"ambientLight":true,"directionalLight":true,"selected3DObject":"Plane"},"attributes":{"isPublic":true,"defaultIndex":1,"categoryId":31}}
-
Tut Basic Shape 2
{“vs_code”:”/*MY_VERTEX_SHADER*/\n/* #version 330 core */\n varying vec2 vUv;\n void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n}”,”fs_code”:”/*MY_FRAGMENT_SHADER*/\n\n// Screen/Window resolution (width and height of window)\nuniform vec2 u_resolution;\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy/u_resolution.xy;\n vec3 red = vec3(1.0,0.0,0.0);\n vec3 green = vec3(0.0,1.0,0.0);\n \n vec4 finalColor = vec4(0.0,0.0,0.0,1.0);;\n if(uv.x >= 0.45 && uv.x <= 0.55 && uv.y >= 0.4 && uv.y <= 0.6)\n { \n finalColor=vec4(green, 1.0);\n }\n \n gl_FragColor=finalColor;\n }\n\n","uniforms":{"u_time":{"type":"f","value":0,"editable":false},"u_resolution":{"type":"v2","value":{"x":827,"y":409},"editable":false},"u_mouse":{"type":"v2","value":{"x":0.002818613848057739,"y":0.24097373607980593},"editable":false}},"description":"Info about your shader.","threeJsSettings":{"showFloor":false,"ambientLight":true,"directionalLight":true,"selected3DObject":"Plane"},"attributes":{"isPublic":true,"defaultIndex":1,"categoryId":31}}
-
Tut Basic Shape 1
{“vs_code”:”/*MY_VERTEX_SHADER*/\r\n/* #version 330 core */\r\n varying vec2 vUv;\r\n void main() {\r\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\r\n vUv = uv;\r\n}”,”fs_code”:”/*MY_FRAGMENT_SHADER*/\n\n// Screen/Window resolution (width and height of window)\nuniform vec2 u_resolution;\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy/u_resolution.xy;\n vec3 red = vec3(1.0,0.0,0.0);\n vec3 green = vec3(0.0,1.0,0.0);\n \n vec4 finalColor = vec4(0.0,0.0,0.0,1.0);\n if(uv.x >= 0.5) { \n finalColor=vec4(red, 1.0);\n } else {\n finalColor=vec4(green, 1.0);\n }\n gl_FragColor=finalColor;\n}”,”uniforms”:{“u_time”:{“type”:”f”,”value”:0,”editable”:false},”u_resolution”:{“type”:”v2″,”value”:{“x”:825,”y”:411},”editable”:false},”u_mouse”:{“type”:”v2″,”value”:{“x”:0.22087298768939395,”y”:0.44908138377243007},”editable”:false}},”description”:”Info about your shader.”,”threeJsSettings”:{“showFloor”:false,”ambientLight”:true,”directionalLight”:true,”selected3DObject”:”Plane”},”attributes”:{“isPublic”:true,”defaultIndex”:1,”categoryId”:31}}