• Interactive Poisson Blending on GPU
    Interactive Poisson Blending on GPU
  • 404 Not Found In Two Triangles
    404 Not Found In Two Triangles
  • Simplest and Fastest GLSL Edge Detection using Fwidth
    Simplest and Fastest GLSL Edge Detection using Fwidth

Tag: ShaderToy

Implementing Instagram Filters: Brannan, Earlybird

This series illustrate my shaders on Shadertoy.com, which renders Instagram filters in real time. Brannan Filter Brannan filter emphasizes the grey and green colors, and paints a metallic tint upon the photos. Click the mouse for comparison. I write this shader to stylize your photos in batch on my own ShaderToy renderer 🙂 (To be…

PostProcessing: Brightness, Contrast, Hue, Saturation, and Vibrance

Real-time image manipulation is always fascinating. With the power of the modern GPU, it is possible to achieve the postprocessing effects all in a single shader. Remember that in GLSL, matrix are column major. Brightness is a float between [-1, 1], directly adding to the RGB Contrast is a float between [0, 1, ∞], directly…

Code Golf: Halftone Image

 This is a code golf with the help of Dr. Neyret and coyote. Demo   Code


Hopf Fibration

According to Wikipedia:  In the mathematical field of differential topology, the Hopf fibration (also known as the Hopf bundleor Hopf map) describes a 3-sphere (a hypersphere in four-dimensional space) in terms of circles and an ordinary sphere. Discovered by Heinz Hopf in 1931, it is an influential early example of a fiber bundle. Technically, Hopf found a many-to-one continuous function (or “map”) from the 3-sphere onto the 2-sphere such that each distinct point of the 2-sphere comes from…

Unified Gnomonic and Stereographic Projections

Gnomonic projection, or rectilinear projection, together with stereographic projection, are two most commonly used projection in rendering 360 degree videos, or other VR applications. Recently, I found the inverse converting function from screen coordinates to the two projections can be unified within a single function. It’s not really surprising since both projection uses spherical lens,…

Equirectangular Projection, Gnomonic Projection, and Cubemaps

Gnomonic Projection Background According to MathWorld, the gnomonic projection is a nonconformal map projection obtained by projecting points (or ) on the surface of sphere from a sphere’s center O to point P in a plane that is tangent to a point S (Coxeter 1969, p. 93). In a gnomonic projection, great circles are mapped…

0-4 Order of Spherical Harmonics

Spherical Harmonics is widely used in Computer Graphics. They are analogue to Fourier basis on a sphere, consists of a set of orthogonal functions to represent functions defined on the surface of a sphere. However, they are very tricky to implement due to lots of constants and integral functions. Here is a real-time visualization that…

Foveated Rendering via Quadtree

Today, I wrote a shader for foveated rendering uisng Prof. Neyret’s QuadTree: https://www.shadertoy.com/view/Ml3SDf The basic idea is:  Calculate the depth of the QuadTree using the distance between the current coordinate to the foveat region Use the depth as the mipmap level to sample from the texture Code below:


Bilateral Filter to Look Younger on GPU

Bilateral filter can be used to smooth the texture while preserving significant edges / contrast. Below shows a live demo in ShaderToy. Press mouse for comparison. Thanks to mrharicot’s awesome bilateral filter: https://www.shadertoy.com/view/4dfGDH With performance improvement proposed by athlete. With gamma correction by iq: https://www.shadertoy.com/view/XtsSzH   Skin detection forked from carlolsson’s Skin Detection https://www.shadertoy.com/view/MlfSzn#

Interactive Poisson Blending on GPU

Recently, I have implemented two fragment shaders for interactive Poisson Blending (seamless blending).  Here is my real-time demo and code on ShaderToy: Press 1 for normal mode, press 2 for mixed gradients, press space to clear the canvas. Technical Brief I followed a simplified routine of the Poisson Image Editing paper [P. Pérez, M. Gangnet,…