public GLTexture Process(GLTexture Input) { Filter.SetSize(Input.Width * 2, Input.Height * 2); return(Filter.Process((_Shader) => { _Shader.GetUniform("OGL2Texture").Set(GLTextureUnit.CreateAtIndex(0).SetWrap(GLWrap.ClampToEdge) .SetFiltering(GLScaleFilter.Nearest).SetTexture(Input)); })); }
private GLTexture edge_pass(GLTexture albedo_tex, GLTexture depthTex) { if (edge_shader == null) { edge_shader = GLShaderFilter.Create(Width, Height, new GLShader( VertexHeader + @" out vec2 texcoord; out vec4 offset[3]; out vec4 dummy2; void main() { texcoord = a_texcoords.xy; vec4 dummy1 = vec4(0); SMAAEdgeDetectionVS(dummy1, dummy2, texcoord, offset); gl_Position = a_position; } " , FragmentHeader + @" uniform sampler2D albedo_tex; uniform sampler2D depthTex; in vec2 texcoord; in vec4 offset[3]; in vec4 dummy2; void main() { #if SMAA_PREDICATION == 1 gl_FragColor = SMAAColorEdgeDetectionPS(texcoord, offset, albedo_tex, depthTex); #else gl_FragColor = SMAAColorEdgeDetectionPS(texcoord, offset, albedo_tex); #endif } " )); } return(edge_shader.Process((Shader) => { Shader.GetUniform("albedo_tex").Set(GLTextureUnit.CreateAtIndex(0).SetWrap(GLWrap.ClampToEdge) .SetFiltering(GLScaleFilter.Linear).SetTexture(albedo_tex)); Shader.GetUniform("depthTex").NoWarning().Set(GLTextureUnit.CreateAtIndex(1).SetWrap(GLWrap.ClampToEdge) .SetFiltering(GLScaleFilter.Linear).SetTexture(depthTex)); })); }
private GLTexture pass_blend(GLTexture edge_tex) { if (blend_shader == null) { blend_shader = GLShaderFilter.Create(Width, Height, new GLShader( VertexHeader + @" out vec2 texcoord; out vec2 pixcoord; out vec4 offset[3]; out vec4 dummy2; void main() { texcoord = a_texcoords.xy; vec4 dummy1 = vec4(0); SMAABlendingWeightCalculationVS(dummy1, dummy2, texcoord, pixcoord, offset); gl_Position = a_position; } " , FragmentHeader + @" uniform sampler2D edge_tex; uniform sampler2D area_tex; uniform sampler2D search_tex; in vec2 texcoord; in vec2 pixcoord; in vec4 offset[3]; in vec4 dummy2; void main() { gl_FragColor = SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edge_tex, area_tex, search_tex, ivec4(1, 1, 1, 0)); //gl_FragColor = SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edge_tex, area_tex, search_tex, ivec4(0)); } " )); } return(blend_shader.Process((Shader) => { Shader.GetUniform("edge_tex").Set(GLTextureUnit.CreateAtIndex(0).SetWrap(GLWrap.ClampToEdge) .SetFiltering(GLScaleFilter.Linear).SetTexture(edge_tex)); Shader.GetUniform("area_tex").Set(area_tex_unit.SetIndex(1)); Shader.GetUniform("search_tex").Set(search_tex_unit.SetIndex(2)); })); }
private GLTexture pass_neighborhood(GLTexture albedo_tex, GLTexture blend_tex) { if (neighborhood_shader == null) { neighborhood_shader = GLShaderFilter.Create(Width, Height, new GLShader( VertexHeader + @" out vec2 texcoord; out vec4 offset[2]; out vec4 dummy2; void main() { texcoord = a_texcoords.xy; vec4 dummy1 = vec4(0); SMAANeighborhoodBlendingVS(dummy1, dummy2, texcoord, offset); gl_Position = a_position; } " , FragmentHeader + @" uniform sampler2D albedo_tex; uniform sampler2D blend_tex; in vec2 texcoord; in vec4 offset[2]; in vec4 dummy2; void main() { gl_FragColor = SMAANeighborhoodBlendingPS(texcoord, offset, albedo_tex, blend_tex); } " )); } return(neighborhood_shader.Process((Shader) => { Shader.GetUniform("albedo_tex").Set(GLTextureUnit.CreateAtIndex(0).SetWrap(GLWrap.ClampToEdge) .SetFiltering(GLScaleFilter.Linear).SetTexture(albedo_tex)); Shader.GetUniform("blend_tex").Set(GLTextureUnit.CreateAtIndex(1).SetWrap(GLWrap.ClampToEdge) .SetFiltering(GLScaleFilter.Linear).SetTexture(blend_tex)); })); }