There’s a common problem that those new to the basic UI system in Unity have when it comes to properly stretching Images or Raw Images across the screen inside the Canvas. This can also happen even with other UI objects like the Panels. While the stretch functionality under Rect Transform in the Inspector is one the absolute greatest things in the UI toolset, it does unfortunately suffer from some un-intuitiveness.
The reason that probably led you here is that you’ve used the stretch mechanism before, perhaps many times before, but for some reason its just not working this time and its driving you crazy, right? Never fear!
You’ve seen these effects before on peoples websites in the background. I myself wanted to create a large image for this site that I am setting up in a few weeks. We’ll start with creating the gradient, laying it down, applying the correct filters, the final result, as well as some conjecture on making the process more interesting, easier or possibly advancing it.
I wanted to create a particularly large image for this example, so I made a new image with decently size proportions (in this case: 1600×1200 – your own mileage while you create your first test one should probably be smaller)
Next I created a new gradient by going to the Layers/Channels/Paths/ window, going down to the Brushes / Patterns / Gradients section at the bottom and selecting “New Gradient”.
We now have the Gradient Editor display. We can title the gradient, we can manipulate the gradient by creating & diving sections, we can see what the result will be, zoom-in, zoom-out and save.
The basic original gradient is split up into one Segment which has a left “section” and a “right” section.
When just working with two colors, I set my foreground and background colors in the color tools area as the two respective colors I will be using in my gradient.
Since I want more out of my Gradient than a natual 1 part gradient, we will need to use the “Split Segment at Midpoint” action. Most of the actions inside GIMPs Gradient Editor (and very powerful ones at that) are all accessible by right clicking on the area you want to manipulate.
I begin by right-clicking on the left part of the 2-part segement underneath the gradient, where you can see the white delimiter triangle and its two accompanying black division triangles. Then I select “Split Segment at Midpoint”.
We now should have something that looks like the following image, where the gradient now effectively has two segments. A left segment and a right segment (both of which each have a left point and a right point).
Feel Free to Move the White and Black Triangle Segment Pieces in this Example to Match mine or to create your own original Look
Now that we have our doublly segmented gradient, lets start on changing the colors on the first segment (the left one) by clicking ON that segment, as you can see I am on this next image.
You’ll remember that I had chosen my gradient’s two colors ahead of time and setting them as the Foreground and Background colors. So my colors look like this:
So now lets right-click again on the left segment and select “Left Color Type” and choose “Foreground Color”
Then right-click on the left segment once more and select “Right Color Type” and choose “Background Color”.
We’ll do the right (second) segment next but your gradient should now look like the following:
To complete setting the colors, we have now clicked (chosen) the second (or right segment) of the gradient and likewise right-clicked to set the Left point as the Background (blue) color and the Right point as the Foreground (red) color.
This makes sure our gradient’s colors have a good flow when they are repeated later in this tutorial. However, I don’t want my pinwheel to have such a soft edge between colors. So we’re going to create a thirdYES A THIRD segment that will go in the middle of the gradient. So we go ahead and right-click to “Split Segment at Middle Point”again.
To give the gradient a “harder edge” I begin to move the white and dark triangle segments closer together.
Now I am going to go a little more extreme and give blue the most amount of space and take away most of the gradient. After that we’ll be done and can save our new gradient.
If I were you, I would leave both sides a little more equal, and even allow one segment to have a softer edge/look.
We will now select our fresh spanking new gradient and choose the “Sawtooth wave” repeat option.
Now lets apply the Gradient to our image by starting at X-coordinate 0 and holding down the Ctrl key so that our gradient line is straight.
We should end up with something looking similar to the following:
Then to initiate the Pinwheel Effect we make use of the Polar Coordinates filter.
We now have the final product.
Lastly, I’d like to make mention of a couple different things. First that giving an even harder edge to one side and a slightly (but not so much more) softer gradient look to another when creating your gradient will help give you that look you are seeking. As well increasing/decreasing the size of gradient area or introducing an extremely sharp third color to act as a semi-border between the two major colors.
Another idea would be to make use of the “Transparent” option in the Gradient Editor and using a flat color background in the back.
Either way, enjoy!
Here’s an example of a soft gradient that has more of an equal space for the two color and I’ve overlayed the light color-transparency gradient to run through the middle and the darker color->transparency to run through the top and bottom creating the effect we all know and love.