All Projects → dmnsgn → glsl-smaa

dmnsgn / glsl-smaa

Licence: MIT license
SMAA (Enhanced Subpixel Morphological Antialiasing) post-processing; WebGL (OpenGL ES 2.0) implementation with no fluff.

Programming Languages

javascript
184084 projects - #8 most used programming language
GLSL
2045 projects
HTML
75241 projects

Projects that are alternatives of or similar to glsl-smaa

smaaDemo
Subpixel Morphological AntiAliasing OpenGL/Vulkan demo
Stars: ✭ 64 (+18.52%)
Mutual labels:  antialiasing, smaa
shaderview
A GLSL shader development tool for the LÖVE game framework.
Stars: ✭ 22 (-59.26%)
Mutual labels:  glsl
glsl-layout
No description or website provided.
Stars: ✭ 24 (-55.56%)
Mutual labels:  glsl
ShaderWriter
Library used to write shaders from C++, and export them in either GLSL, HLSL or SPIR-V.
Stars: ✭ 171 (+216.67%)
Mutual labels:  glsl
3D interactive graphics rendering engine
Develop a 3D interactive graphics rendering engine
Stars: ✭ 31 (-42.59%)
Mutual labels:  glsl
hwoa-rang-gl
WebGL Library
Stars: ✭ 21 (-61.11%)
Mutual labels:  glsl
GLSL-howto
random code that I use/write
Stars: ✭ 18 (-66.67%)
Mutual labels:  glsl
glslc
Simple GLSL compilation checker that uses the display driver
Stars: ✭ 24 (-55.56%)
Mutual labels:  glsl
ada
A general porpose OpenGL app library
Stars: ✭ 105 (+94.44%)
Mutual labels:  glsl
cellular-automata-explorer
(WIP) An interactive web app for exploring cellular automata.
Stars: ✭ 18 (-66.67%)
Mutual labels:  glsl
radar
OpenGL 4 PBR engine
Stars: ✭ 25 (-53.7%)
Mutual labels:  glsl
shadertoy-to-video-with-FBO
Render a ShaderToy script directly to a video file. (added FrameBuffers support)
Stars: ✭ 26 (-51.85%)
Mutual labels:  glsl
three-noise
Simple gradient noise library for use with Three.js. Now with fBm!
Stars: ✭ 31 (-42.59%)
Mutual labels:  glsl
AndroidGLKit
AndroidGLKit provides OpenGL ES 2.0 boilerplate codes for Android.
Stars: ✭ 22 (-59.26%)
Mutual labels:  glsl
RayTracedGGX
Ray tracing sample using GGX reflection model, 1spp with spatial-temporal denoiser. Acceleration structure build uses async compute.
Stars: ✭ 43 (-20.37%)
Mutual labels:  antialiasing
AlizaMS
DICOM Viewer
Stars: ✭ 144 (+166.67%)
Mutual labels:  glsl
TD-Flow-ABS
Real-time Flow-based Image and Video Abstraction in TouchDesigner.
Stars: ✭ 72 (+33.33%)
Mutual labels:  glsl
GLGrassRenderer
OpenGL Grass Renderer
Stars: ✭ 63 (+16.67%)
Mutual labels:  glsl
spritekit-water-node
🌊 Custom SpriteKit node that allows to simulate 2D water with respect to physics. The app demonstrates Flocking behaviour using GameplayKit, key-frame animation and custom fragment shader chaining (GLSL) 🤯
Stars: ✭ 82 (+51.85%)
Mutual labels:  glsl
WaterColor
openframeworks parametric shader effect watercolor
Stars: ✭ 54 (+0%)
Mutual labels:  glsl

glsl-smaa

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

SMAA (Enhanced Subpixel Morphological Antialiasing) post-processing; WebGL (OpenGL ES 2.0) implementation with no fluff. All credit goes to the incredible work here (iryoku) and there (beakbeak).

paypal coinbase twitter

Installation

npm install glsl-smaa

Usage

Three passes are required to apply the effect:

             |input|------------------·
                v                     |
      [ SMAA*EdgeDetection ]          |
                v                     |
            |edgesTex|                |
                v                     |
[ SMAABlendingWeightCalculation ]     |
                v                     |
            |blendTex|                |
                v                     |
  [ SMAANeighborhoodBlending ] <------·
                v
             |output|

You would typically set this up as part of a post-processing chain with FBOs.

See the demo and its source for an example with REGL.

Attributes

Attributes required for all vertex shaders:

Name Type Description
aPosition vec2 Screen vertices.

Uniforms and defines

Uniforms required for all shaders:

Name Type Description
resolution vec2 The framebuffer size.

#define can be preprended to the shaders to overwrite default settings. Typically:

const frag = `#define SMAA_PRESET_HIGH
${PRESETS}
${SMAA_WEIGHTS_FRAG}
`;

edges.vert

N/A

edges-<edge-detection-method>.frag

You can use one of the 3 following edge detection method:

  • Depth: the fastest but it may miss some edges.

  • Luma: more expensive than depth edge detection, but catches visible edges that depth edge detection can miss.

  • Color: the most expensive one but catches chroma-only edges.

Defines:

#define SMAA_THRESHOLD 0.1
#define SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR 2.0
Name Default [Range] Description
SMAA_THRESHOLD 0.1 [0, 0.5] Specifies the threshold or sensitivity to edges. Lowering this value you will be able to detect more edges at the expense of performance. Range: [0, 0.5]. 0.1 is a reasonable value, and allows to catch most visible edges. 0.05 is a rather overkill value, that allows to catch 'em all.
SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR 2.0 If there is an neighbor edge that has SMAA_LOCAL_CONTRAST_FACTOR times bigger contrast than current edge, current edge will be discarded. This allows to eliminate spurious crossing edges, and is based on the fact that, if there is too much contrast in a direction, that will hide perceptually contrast in the other neighbors.

Uniforms:

luma-edges.frag

Name Type Description
colorTex sampler2D The input color framebuffer.

color-edges.frag

Name Type Description
colorTex sampler2D The input color framebuffer.

depth-edges.frag

Name Type Description
depthTex sampler2D The input depth framebuffer.

smaa-weights.(vert|frag)

Defines from presets.glsl:

# Use presets:
#define SMAA_PRESET_LOW
#define SMAA_PRESET_MEDIUM
#define SMAA_PRESET_HIGH
#define SMAA_PRESET_ULTRA

# or individually setting:
#define SMAA_THRESHOLD 0.1
#define SMAA_MAX_SEARCH_STEPS 16
#define SMAA_MAX_SEARCH_STEPS_DIAG 8
#define SMAA_CORNER_ROUNDING 25

# and optionally disable diagonal and corner detection:
#define SMAA_DISABLE_DIAG_DETECTION
#define SMAA_DISABLE_CORNER_DETECTION
Name Default [Range] Description
SMAA_THRESHOLD 0.1 [0, 0.5] Should the same as for the edge pass.
SMAA_MAX_SEARCH_STEPS 16 [0, 112] Specifies the maximum steps performed in the horizontal/vertical pattern searches, at each side of the pixel. In number of pixels, it's actually the double. So the maximum line length perfectly handled by, for example 16, is 64 (by perfectly, we meant that longer lines won't look as good, but still antialiased.
SMAA_MAX_SEARCH_STEPS_DIAG 8 [0, 20] Specifies the maximum steps performed in the diagonal pattern searches, at each side of the pixel. In this case we jump one pixel at time, instead of two.
SMAA_CORNER_ROUNDING 25 [0, 100] Specifies how much sharp corners will be rounded.

Uniforms:

Name Type Description
edgesTex sampler2D The framebuffer with edges.
areaTex sampler2D Precalculated textures loadable from textures.js base64 urls.
searchTex sampler2D Precalculated textures loadable from textures.js base64 urls.

smaa-blend.(vert|frag)

Name Type Description
colorTex sampler2D The input color framebuffer.
blendTex sampler2D The framebuffer with weights.

License

Copyright (C) 2013 Jorge Jimenez ([email protected]) Copyright (C) 2013 Jose I. Echevarria ([email protected]) Copyright (C) 2013 Belen Masia ([email protected]) Copyright (C) 2013 Fernando Navarro ([email protected]) Copyright (C) 2013 Diego Gutierrez ([email protected])

MIT. See license file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].