How Bezier Curves Work
Today we are going to take a break from creative procedural generation and talk about a very useful graphics primitive, the Bézier curve, and learn how to render it from scratch.
Today we are going to take a break from creative procedural generation and talk about a very useful graphics primitive, the Bézier curve, and learn how to render it from scratch.
Welcome back to my series on procedural content generation. Today we are going to learn how to play with color. Generating textures is great, but it's so much better when we can generate new color schemes to go with our textures. First, however, we need to do a little clean up.
We've built a lot of stuff so far. In part one we built some tools and noise. In part two we created patterns with sine waves, then mixed them with noise. However, so far our images are essentially black and white, or occasionally hard coded to a particular color like red. Today we're going to lerp through some colors. Don't worry, I'll explain that this means in a minute.
Now that we've got a little toolkit from part 1, let's draw a simple sin wave. As you may recall from your trigonometry, the sin function goes from -1 to 1. It also loops forever. That's going to be very handy.
Thanks to a project I'm doing at work I started reading a book on procedural content generation. ProcGen (as apparently the cool kids call it) is all about creating interesting systems with randomness, which inevitably brings up texture generation, which brings up Perlin Noise, one of the most useful sources of randomness.