Below is a paper I submitted to jcgt.org that unfortunately did not get accepted. Maybe next time!
The main idea of this paper is that bilinear interpolation can be equivalent to the De Casteljau algorithm, which means that if you set up a texture in a specific way, and sample from it at specific texture coordinates, that it will in fact give you Bezier curve points as output! It scales up for higher dimensional textures, as well as higher order curves.
The image below shows this in action for a cubic Bezier curve (3 control points) being stored and recalled from a 2×2 texture (there is actually a curve stored in each color channel).
This image is from an extension linked to lower down which applies the technique to surfaces and volumes:
The primary feedback from the reviewers and editor was that:
- It was an interesting technique and they thought it was a paper worth reading.
- The usage case was fairly limited though – basically only when your are compute bound in your shader program, and have some curve calculations to offload to the texture sampler. Or if you are already using a lookup texture and would benefit from fewer instructions and smaller lookup textures.
- It could have been shorter due to the writing being shorter, but also it could have been less thorough. For instance, it didn’t need to show equivalence to both the De Casteljau’s algorithm as well as Bernstein polynomials, since it’s already known that those are equivalent.
- They wanted some more performance details
I agree with the feedback, and don’t feel like taking the time to change and resubmit or submit else where, so I’m sharing it here on my blog. I hope you enjoy it and find it interesting (:
Here is the paper:
GPUBezier2016.pdf
Here is the supplemental materials (opengl and webgl source code):
SupplementalMaterials.zip
Here is the webgl demo from the supplemental materials, hosted on my site:
GPU Efficient Texture Based Bezier Curve Evaluation
Here are some working shadertoy demos of the technique:
Shadertoy: Mystery Curves – Quadratic
Shadertoy: Mystery Curves – Cubic
Shadertoy: Mystery Curves – Quartic
Shadertoy: Mystery Curves – Quintic
Extensions
Continuations of this work:
- Evaluating Polynomials with the GPU Texture Sampler – Extends this to all polynomials instead of just Bernstein polynomials. This is made possible by the fact that you can convert any power basis polynomial to a Bernstein basis polynomial.
- Evaluating Points on Analytical Surfaces and in Analytical Volumes Using the GPU Texture Sampler – Extends this to surfaces and volumes.
- Improved Storage Space Efficiency of GPU Texture Sampler Bezier Curve Evaluation – Explores packing more curves into fewer pixels.
- Taking a Stroll Between The Pixels – Explores sampling off of the main diagonal from A to C, and sampling along non linear paths.
Failed Experiments
Continuations that didn’t work out:
What are your thoughts? Is this cool? Is it lame? Got some ideas to improve it? Leave a comment! (: