Time for action – testing some post-process effects
- Open the file
ch10_PostProcess.html
in an HTML5 browser.The buttons at the bottom allow you to switch between several sample effects. Try each of them to get a feel for the effect they have on the scene. We've already looked at grayscale, so let's examine the rest of filters individually.
- The invert effect is similar to grayscale, in that it only modifies the color output; this time inverting each color channel.
uniform sampler2D uSampler; varying vec2 vTextureCoord; void main(void) { vec4 frameColor = texture2D(uSampler, vTextureCoord); gl_FragColor = vec4(1.0-frameColor.r, 1.0-frameColor.g, 1.0-frameColor.b, ...
Get WebGL Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.