blobt
5 years ago
6 changed files with 68 additions and 34 deletions
-
BIN.vs/shader3/v14/.suo
-
42main.cpp
-
21res/shader/fullscreenquad_gaussian_horizontal.fs
-
21res/shader/fullscreenquad_gaussian_vertical.fs
-
6shader3.vcxproj
-
12shader3.vcxproj.filters
@ -0,0 +1,21 @@ |
|||
|
|||
varying vec2 V_Texcoord; |
|||
|
|||
uniform sampler2D U_MainTexture; |
|||
|
|||
void main() |
|||
{ |
|||
//1 2 1 |
|||
//2 4 2 |
|||
//1 2 1 |
|||
vec4 color = vec4(0.0); |
|||
float texelOffset = 1/100.0; |
|||
float weight[5] = float[](0.22,0.19,0.12,0.08,0.01); |
|||
|
|||
for(int i = 0; i < 5; i++){ |
|||
color += texture2D(U_MainTexture, vec2(V_Texcoord.x+texelOffset*i, V_Texcoord.y))*weight[i]; |
|||
color += texture2D(U_MainTexture, vec2(V_Texcoord.x-texelOffset*i, V_Texcoord.y))*weight[i]; |
|||
} |
|||
|
|||
gl_FragColor = color; |
|||
} |
@ -0,0 +1,21 @@ |
|||
|
|||
varying vec2 V_Texcoord; |
|||
|
|||
uniform sampler2D U_MainTexture; |
|||
|
|||
void main() |
|||
{ |
|||
//1 2 1 |
|||
//2 4 2 |
|||
//1 2 1 |
|||
vec4 color = vec4(0.0); |
|||
float texelOffset = 1/100.0; |
|||
float weight[5] = float[](0.22,0.19,0.12,0.08,0.01); |
|||
|
|||
for(int i = 0; i < 5; i++){ |
|||
color += texture2D(U_MainTexture, vec2(V_Texcoord.x, V_Texcoord.y+texelOffset*i))*weight[i]; |
|||
color += texture2D(U_MainTexture, vec2(V_Texcoord.x, V_Texcoord.y-texelOffset*i))*weight[i]; |
|||
} |
|||
|
|||
gl_FragColor = color; |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue