Pages

sâmbătă, 29 octombrie 2022

Shader Editor - example 001.

You can test your skills in shader theory with this excellent android application named Shader Editor.
The application can be found on google play.
After installation, you can use the eye icon to toggle between the source code and the output and the three dots icon to load, load samples, and save ...
If you want to rename it after creating a new shader or save it as a new shader, just click on the icon with three lines and double-click on the shader's name.
This is a shader created for my cardboard virtual reality and set for my eye anatomy ...
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec2 resolution;
uniform vec2 cameraAddent;
uniform mat2 cameraOrientation;
uniform samplerExternalOES cameraBack;

void main(void) {
vec2 uv = gl_FragCoord.xy / resolution.xy;
vec2 st = cameraAddent + uv* cameraOrientation * vec2(tan(0.805),cos(0.31));
gl_FragColor= vec4(
texture2D(cameraBack, st*vec2(2.0,1.0)).rgb,0.1);
}