blobt
4 years ago
6 changed files with 108 additions and 1 deletions
-
BIN.vs/shader3/v14/.suo
-
60main.cpp
-
20res/shader/fullscreenquad_dilation.fs
-
21res/shader/fullscreenquad_erosion.fs
-
2shader3.vcxproj
-
6shader3.vcxproj.filters
@ -0,0 +1,20 @@ |
|||
varying vec2 V_Texcoord; |
|||
|
|||
uniform sampler2D U_MainTexture; |
|||
|
|||
void main() |
|||
{ |
|||
vec4 maxValue = vec4(0.0); |
|||
int coreSize = 2; |
|||
int halfCoreSize = coreSize / 2; |
|||
float texelOffset = 1/100.0; |
|||
|
|||
for(int y=0; y<coreSize; y++){ |
|||
for(int x=0; x<coreSize; x++){ |
|||
vec4 color = texture2D(U_MainTexture, V_Texcoord+vec2((-halfCoreSize+x)*texelOffset, (-halfCoreSize+y)*texelOffset)); |
|||
maxValue = max(maxValue,color); |
|||
} |
|||
} |
|||
|
|||
gl_FragColor=maxValue; |
|||
} |
@ -0,0 +1,21 @@ |
|||
|
|||
varying vec2 V_Texcoord; |
|||
|
|||
uniform sampler2D U_MainTexture; |
|||
|
|||
void main() |
|||
{ |
|||
vec4 minValue = vec4(1.0); |
|||
int coreSize = 6; |
|||
int halfCoreSize = coreSize / 2; |
|||
float texelOffset = 1/100.0; |
|||
|
|||
for(int y=0; y<coreSize; y++){ |
|||
for(int x=0; x<coreSize; x++){ |
|||
vec4 color = texture2D(U_MainTexture, V_Texcoord+vec2((-halfCoreSize+x)*texelOffset, (-halfCoreSize+y)*texelOffset)); |
|||
minValue = min(minValue,color); |
|||
} |
|||
} |
|||
|
|||
gl_FragColor=minValue; |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue