본문 바로가기

그래픽스35

[GLSL] Gradient Noise https://thebookofshaders.com/11/ The Book of Shaders Gentle step-by-step guide through the abstract and complex universe of Fragment Shaders. thebookofshaders.com #ifdef GL_ES precision mediump float; #endif uniform vec2 u_resolution; // vec2 vec2 random vec2 random(vec2 st){ float x = fract(sin(dot(st*25., vec2(17.34,50.13)))*84239.523); float y = fract(cos(dot(st*25., vec2(28.13,39.49)))*94820.. 2022. 1. 6.
[GLSL] Value Noise https://thebookofshaders.com/11/ The Book of Shaders Gentle step-by-step guide through the abstract and complex universe of Fragment Shaders. thebookofshaders.com Vec2-float noise. #ifdef GL_ES precision mediump float; #endif uniform vec2 u_resolution; float random(vec2 st){ float c = fract(sin(dot(st*25., vec2(17.34,50.13)))*84239.523); return c; } float noise(vec2 st){ vec2 i = floor(st); vec2.. 2022. 1. 6.
[GLSL] Rectangle https://thebookofshaders.com/07/ The Book of Shaders Gentle step-by-step guide through the abstract and complex universe of Fragment Shaders. thebookofshaders.com After listening to the lecture, followed the memory and wrote the code below. #ifdef GL_ES precision mediump float; #endif #define TWO_PI 6.28318530718 uniform vec2 u_resolution; uniform float u_time; vec3 rect(vec2 coord, vec2 loc, ve.. 2022. 1. 5.
[GLSL] Qualifier https://thebookofshaders.com/06/ The Book of Shaders Gentle step-by-step guide through the abstract and complex universe of Fragment Shaders. thebookofshaders.com int newFunction(in vec4 aVec4, // read-only out vec3 aVec3, // write-only inout int aInt); // read-write The default is in. The inout qualifier is similar to a call by reference. 2022. 1. 5.
[GLSL] Atan https://thebookofshaders.com/06/ The Book of Shaders Gentle step-by-step guide through the abstract and complex universe of Fragment Shaders. thebookofshaders.com As you probably know there are different ways to organize color besides by red, green and blue channels. HSB stands for Hue, Saturation and Brightness (or Value) and is a more intuitive and useful organization of colors. #ifdef GL_ES p.. 2022. 1. 5.
[GLSL] Mix https://thebookofshaders.com/06/ The Book of Shaders Gentle step-by-step guide through the abstract and complex universe of Fragment Shaders. thebookofshaders.com In GLSL there is a very useful function, mix( ), that lets you mix two values in percentages. Can you guess what the percentage range is? Yes, values between 0.0 and 1.0! Check the following code at line 18 and see how we are using the.. 2022. 1. 5.
[GLSL] Color https://thebookofshaders.com/06/ The Book of Shaders Gentle step-by-step guide through the abstract and complex universe of Fragment Shaders. thebookofshaders.com vec3 red = vec3(1.0,0.0,0.0); red.x = 1.0; red.y = 0.0; red.z = 0.0; vec4 vector; vector[0] = vector.r = vector.x = vector.s; vector[1] = vector.g = vector.y = vector.t; vector[2] = vector.b = vector.z = vector.p; vector[3] = vector.a .. 2022. 1. 5.
[GLSL] Gain http://www.iquilezles.org/www/articles/functions/functions.htm Inigo Quilez Articles on computer graphics, math and art iquilezles.org Remapping the unit interval into the unit interval by expanding the sides and compressing the center, and keeping 1/2 mapped to 1/2, that can be done with the gain() function. This was a common function in RSL tutorials (the Renderman Shading Language). k=1 is th.. 2022. 1. 5.
[GLSL] Shaping Functions https://thebookofshaders.com/05/ The Book of Shaders Gentle step-by-step guide through the abstract and complex universe of Fragment Shaders. thebookofshaders.com Here is the code I met previously. #ifdef GL_ES precision mediump float; #endif uniform vec2 u_resolution; uniform vec2 u_mouse; uniform float u_time; // Plot a line on Y using a value between 0.0-1.0 float plot(vec2 st, float pct){ re.. 2022. 1. 5.