Whale Shark: Art Created With Math
by saltyspinach in Design > Art
99 Views, 1 Favorites, 0 Comments
Whale Shark: Art Created With Math
This project stems from the goal of finding a unique medium with which to create a piece of art.
The whale shark, pictured above, was created in the 3D version of the Desmos Graphing Calculator, and is made out of a series of lines and dots that form the full image when viewed at a specific angle. I find it nice to see how nominally random parts can come together and make a complete whole.
I was inspired to create this by a challenge put out by Mathemagic Land tasking entrants with making a 3D piece of art using the software, but I unfortunately did not come up with an idea until after the deadline had passed.
In this Instructable, I will break down the methods I used to create this piece, and how one can use the features of the calculator to develop their own creative works in the 3D calculator. Note that I am only trying to showcase a small subset of all the features of the calculator, so exploration is suggested.
You can access the graph here: https://www.desmos.com/3d/znjqlpmfxh
Supplies
Necessary:
- a device with which to create your art
- for the 3D calculator, you will need a laptop or a computer
Helpful:
- a reference of what you are trying to create
Dots
The base functions of the calculator are pretty simple, and I only used a few features in the creation of this graph. As mentioned previously, most of this piece is made up of lines and dots, and there is nothing as complicated as a parabola here.
For the style I have chosen, I mainly used parenthetical notation to represent my lines and dots, in the format (x,y,z). For example, if I write the expression (0,0,1), as pictured above, a dot will form one unit above the origin, since z represents height. Modifying these numbers can place a point anywhere of your choosing within 3D space.
Lines
Lines are a bit more complicated, but can be made in much the same way. With a line, there must be some input and output, so we will be using variables. In this case, the calculator accepts only t, u, or v. This behavior is because x, y, and z are all outputs in this situation, not inputs. For example, if we type the expression (0,0,t), we will receive a vertical line, since x and y are set to 0, but z can change. However, you might see something strange happening: the line is really short. The calculator's default is set to only consider the domain of 0≤t≤1, though we can change it to suit our needs.
There are a couple more things we can do. Making the other axes also variable gives us more opportunity to vary the lines, along with adjusting their slope and adding constants. These tweaks result in more complex expressions, like (t,2t,t+1) with the bound -4≤t≤3 (shown in the third image), which can be used to create more complex shapes.
Planning
For this project, I started with setting my angle for the future. Since I will need to be able to easily return to it, I decided to keep it flat (which the calculator locks onto). However, I did decide to rotate along the vertical axis for a bit of variety. The angle itself does not matter much, only that it can be easily found to view the full image. While adding elements, I decided to lock rotation so I could work from one singular frame of reference and have a consistent point of view. This can be done in the top right in the setting menu, under the "More Options" tab.
After setting up, I worked on some preliminary points that I could use as an outline for the whale shark. The red dots represent the outline of the creature on the whole, and the blue dots are the shape of the mouth. The gray is the eye.
One last note: Also, in the settings menu, are the options to remove lighting, and turn off the axes and grid. This ensured I had a clear view of what I was doing and could more directly manipulate colors to the hues they should be. More on colors in Step 7.
Outline
With the aid of the lines, we now have a full outline. Trying to add variation in to where the lines are in 3d space was a priority for me, given the goal of trying to make it nonsensical when viewed from other angles. Adjustments were made in small increments, and usually pertained to where the segment was (x, y, & z additions/substractions), where it was angled towards (slope for x, y, & z), or how long it was (bounds for t: a≤t≤b).
Lines (again)
With the outline out of the way, I added in the lines that make up the interior of the shape (+ the eye!). This added a lot of definition and is the step that makes it look recognizable as a whale shark, in my opinion.
Dots and Scaling
Since all the dots are white, I turned on reverse contrast mode (also in the settings) so they can be seen against the backdrop. This was easily the most time consuming part of the project, despite being the simplest. However, it is not without its details. You might have noticed that is a slight variation in size for many of the dots. Each dot (and line, for what it's worth) has its own scale factor. In the second image, you can see that the selected dot is set to a scale of 0.6.
Colors
Up until this point, I have not discussed the matter of color, despite it being a prominent feature of this piece. I wanted to introduce it later given how many cans of worms it opens up, so here we are. In this piece, I found it important to focus on the aspect of color, given how much it plays into our perception of the world. Furthermore, its relation to the ocean is strong. The ocean is known for its vibrancy and life, and I wanted to represent that with various blues, even if the whale shark itself has a grey tint to its color scheme.
Desmos 3D only has a few (six) default colors to mess around with, all of which can be seen in the top row of the first image above. But, this constraint can be ignored, with some knowledge of color systems.
Desmos allows you to add custom colors using two different systems: HSV and RGB
Here's a breakdown on both:
The letters in HSV stand for Hue, Saturation, and Value respectively, each with a unique property.
- Hue runs on a scale of 0-360, representing the degrees of rotation on a color wheel. Red starts at zero degrees, and every 60 degrees it shifts to the next color in the rainbow (0°=red, 60°=yellow, 120°=orange, etc.).
- Saturation represents how vibrant a color is, going from 0% saturation (entirely grayscale), to 100% saturation, or the full brightness of the chosen color. On Desmos, saturation runs from 0 to 1.
- Value is a simple measure of how bright a color is. 0% would be black, and 100% would represent a color in full. On Desmos, value runs from 0 to 1.
An example of red in HSV on Desmos would be as follows:
a=hsv(0,1,1)
The 'a=' is there since all colors in the calculator must be attached to a variable. The first number following the parenthesis is the hue. As discussed, this is 0° on the color wheel, and so it must be red. The following number indicate that it has a saturation of 1, or 100%, and so it is fully colorful. Furthermore, it is bright as well, given the last number, also a 1, represents 100% value, or brightness.
The letters in RGB stand for Red, Green, and Blue respectively. Each runs on a scale from 0 to 255, and the resulting color of each combination is each amount of red, green, and blue added on top of each other. Most devices use this technique through colored LEDs to produce the colors of a screen.
Here is red in RGB:
a=rgb(255,0,0)
The color is using entirely red, at full brightness. No blue or green is present.
For me, HSV is the slightly more intuitive choice, and has been my go-to for creating things in Desmos, but RGB has its merits as well. HSV is responsible for the colors in this piece.
Color Mapping
Coordinate-based color mapping is a feature of 3D Desmos that is pretty instrumental in creating some of the cooler things to do with color. It is the easiest way to make gradients and changes in color over an area. It functions by basing the color of a point off of where it lies in 3D space. That might seem complex, but it can be as easy as adding a variable onto one of the numbers in an HSV or RGB sequence, and seeing how it affects the color.
In its most basic sense, the feature determines color by relating it to a variable, which is related to where a point lies on the plane.
Let's dissect the image. I've used a sphere so that we can easily see the effects. The sphere is using this color for its texture:
a=hsv(10z,1,1)
The first number in HSV is hue, and that's what we're modifying. On this graph, z is the vertical axis. So, to find out the color of any given point, we are multiplying the number 10 with where the point is on the z-axis. This is what gives that vertical gradient from magenta to orange. As we go up, we are cycling around the color wheel.
What's nice is that you can put all kinds of functions into the HSV or RGB system, and they can return some really interesting color patterns. Experiment with it and see what you can find!
*At the time of writing, the system does not work with lines or points.*
Here are some links to help learn color mapping:
Background
I saved this bit for last since it requires knowledge on color mapping, even though I made it earlier. The background is composed of a few panels that are colored with a gradient. The panels are at certain levels of x, y, and z to cover the space (the equations are just x=, y=, or z= the value that you want them to be at) The gradient gets lighter as you near the top, since it is based on height.
There is also a thin layer of noise that I placed near the bottom, right above the solid panel. The color is made by the function outlined in the second image above. There are a lot of ways to generate static like so, and I'm sure this is one of many, but it essentially works by creating a lot of division by zero errors, so only some points show up as existing.
I think the background pulls its weight to add some life to the piece, since it is probably the brightest element.
But, that's the final product! A big thank you to you if you have decided to read up to this point. I hope you learned something. In the next chapter there are some pretty helpful links if you want to learn how to do this type of thing, but I'd honestly say that it's often just as easy to figure out by doing, so take your pick if you're interested in learning more.
Helpful Links
Here are a few (more) links to getting started creating art in Desmos
- Desmos art introduction article (for an introduction)
- Desmos art gallery (for inspiration)
- Mathemagic Land's channel (for very cool challenges, inspiration, and some tutorials)
- Desmos art playlist (for a visual introduction)