OpenGL Fragment Shaders | How Do Fragment Shaders Work?
Автор: An Object Is A
Загружено: 17 дек. 2019 г.
Просмотров: 9 471 просмотр
How are fragment shaders actually working?
More than one color on screen?
Why so difficult?
This series is based off of the free on-line book, "The Book Of Shaders", by Patricio Gonzalez Vivo and Jen Lowe.
https://thebookofshaders.com/
If you feel like donating, please donate to those two; a donation link is found on their website linked above.
Previous video: • OpenGL Fragment Shaders | GLSL and Ou...
Editor used: https://patriciogonzalezvivo.github.i...
Subscribe to my channel: / @anobj
If you find value in what I do, think about supporting my channel:
Paypal: https://www.paypal.me/anobjisa
Bitcoin: 3H4NKKwPdbiE5Gtc3Uk2DiwszqHhrRbmKK
Ethereum: 0x48702412F448a27be03836fb6FE6456603668030
Litecoin: MNJ4uv3GD4r62VpQ8rHX1Pj1ihWCj74hCK
Find me here:
Bitchute: https://www.bitchute.com/channel/gPUm...
Twitter: / anobjectisa1
Minds: https://www.minds.com/an_object_is_a/
Instagram: / an_object_is_a
Code used:
1.
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
// Youtube descriptions do not allow the angle brackets
// gteq = greater than or equal to
// lteq = less than or equal to
if (st.x gteq 0.500 && st.x lteq 0.503 &&
st.y gteq 0.500 && st.y lteq 0.503) {
gl_FragColor = vec4(1.,1.0,1.0,1.0);
} else {
gl_FragColor = vec4(0.,0.0,0.0,1.0);
}
}
2.
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 canvas = vec3(1.0);
canvas = mix(canvas, vec3(1.0,0.0,0.0), st.x);
gl_FragColor = vec4(canvas, 1.0);
}

Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: