Affinity Photo Procedural Textures for Absolute Beginners: 101.4

Recommended Posts

USING BRACKETS IN EQUATIONS PART 1.

The previous lesson is HERE

Introduction

In the last lesson we looked at how to substitute controls (Custom Inputs) for numerical values in equations, giving you the ability radically change the appearance of textures. The example equation we looked at was Affinity’s Simple Perlin Noise preset whose equation looks like this:

perlinsc(rx/200,ry/200,7,0.6)*0.7

We saw how the *0.7 at the end of the equation affected the brightness of the texture and substituted the 0.7 with a slider custom input. This gives the ability to slide the brightness from the default maximum level of brightness down to black, but what if we want to go the other way? What if we want to take the default brightness of a texture and go brighter?

In this lesson we’ll look at how simply adding a pair of brackets will give you better brightness controls of your procedural textures. Using this technique on the Perlinsc Noise Maker will give you custom grunge texture maker capable of producing textures like these:

We will also see how to add brackets in the middle of equations, which can alter the way the texture appears.

Don’t Be Sacred of Brackets!

Above, I said that brackets – () – will improve brightness controls in your Procedural Textures, this is because in the equations, brackets are used to change how Affinity interprets what to do with the equation. Let’s go back to a bit of maths we all learned at school with this sum:

2x3+2

(or 2*3+2 in Procedural Textures, since they use * for the multiplication sign)

The answer here is 8 because it is worked out like this:

2*3=6  then 6+2=8

BUT add a pair brackets to the sum and you get a different result:

2x(3+2)

Now the answer is 10. Why? Because anything in brackets is treated separately. So now the sum goes like this:

2 times whatever is inside the brackets.

What’s inside the brackets? 3+2 which equals 5.

2x5 equals 10.

This basic principle of putting stuff inside brackets to change the way an equation works is the same with brackets in Procedural Texture equations. When Affinity sees stuff inside brackets it goes, “Hey, wait minute, I’ll do the stuff inside the brackets separately, and then I’ll do the other stuff.”

You don’t particularly need to understand the maths or how brackets work in C++ coding (unless your into either), you just need to be aware that using brackets can radically change a texture, helping you find new and interesting textures for your projects – as you’ll see!

Why is this important? Take a look at this equation I tweaked from one of Affinity’s default presets:

perlincubic((rx+500)/((w*2)/b),(ry+500)/((h*2)/c),7,a

It looks really complicated with A LOT of brackets, but it started off as good old Simple Perlin Noise (perlinsc(rx/200,ry/200,7,0.6)*0.7)

We’re going to look more closely at this equation in the next tutorial. The point is that once you get your head around brackets you can look out for them in existing equations to see if there are any obvious ways to change what’s inside; whether you can change or substitute anything like numbers for Custom Input controllers. Equally, you can add brackets to equations to change how the texture works.

This is where we look more closely at the *0.7 part at the end of the perlinsc(rx/200,ry/200,7,0.6)*0.7 equation which we’ve already discovered sets the brightness level for perlinsc noise.

Note: Whilst this seems to be the case for noise functions, in other functions, e.g. the “sin” function, it controls other features.

A Better Brightness Control

Create a new canvas 1920 x 1080 pixels (although, like vector graphics, the dimensions and resolution don’t matter with Procedural Textures since they are generated by the equation).

Create a new layer via Layer>New Layer (or click the chequerboard icon at the bottom of the layer palette)

Fill with your foreground colour via Edit>Fill with Primary Colour.

Add a Procedural Texture filter either as a live filter or through Filters>Colours>Procedural Texture and select the Perlinsc Noise Maker preset you made in the last lesson. If you don’t have that saved, you’ll need to go back to the previous lesson and create it now. It should look like this:

As you can see, the last Custom Input control we added in the bottom section was a 0,1 Custom Input with the value e which we called Brightness. The equation reads perlinsc(rx/a,ry/b,c,d)*e.

Sliding the brightness control fully to the right, it maxes out with a few pure white patches like this:

TIP: Custom Input values don’t have to be single letters.

Delete the e at the end of the equation and substitute it for br (for Brightness), and then change the e at the beginning of the Brightness custom input slider also to br. You could just as easily call it spiderbum, if you were so inclined – just so long as the value name in the equation matches the value name in the custom input. Stick with br for the moment.

By putting the br in brackets we can multiply, divide, add or subtract the default level of brightness by any number we choose, making the texture brighter or darker. In practice, I’ve found * (multiply) and / (divide) to be the most useful for adding more control to brightness levels.

To begin with, lets double the brightness. To do this, we simply times br by two, but enclose in brackets so the equation now reads:

perlinsc(rx/a,ry/b,c,d)*(br*2)

The texture should be a lot brighter.

Because it is DOUBLE the brightness, sliding the slider back half-way returns the texture to its default level, whilst moving the slider to the right of centre makes the texture lighter than the default setting.

If we use / (divide) instead of * (multiply) we get the opposite effect. / (divide) makes the texture much darker to start with. perlinsc(rx/a,ry/b,c,d)*(br/2) with the slider fully right means that the starting brightness value is now HALF its default value.

Make Some Grunge

Let’s go really bright. Instead of multiplying br by 2, multiply it by 20 so that the equation now reads:

perlinsc(rx/a,ry/b,c,d)*(br*20)

(multiplying the default brightness level 20x)

Change the Custom Input values as follows:

Width = 15

Height = 15

Softness = 7

Detail = Set the slider midway

Brightness = Set the slider midway

You should have something that looks like this:

Save this as a Preset. Click on the burger icon at the right-hand end of the Equation Preset drop-down list. Call this preset Perlinsc Grunge Maker. You could save it one of the categories we made in previous lessons or create a new category just for grunge.

NOTE: You get some really wacky results if you multiply (*) or divide (/) the brightness by huge numbers like 1,000,000.

Before we move on to another example, make a note of these grunge variations:

Grunge Variations

Try these different variations. Each one can be saved as a sub-preset by clicking on the burger icon at the right-hand end of the Custom Inputs Preset drop-down list.

Sand

Width = 2

Height = 2

Softness = 5

Detail = Set the slider to about 90%

Brightness = Set the slider to about 1%

Test this texture out by adding a new Fill Layer above the texture layer with an orange-yellow as the fill colour, then flip through the various layer blend modes to see the effects.

Large Grubby Marks

Width = 500

Height = 500

Softness = 9

Detail = Set the slider to about 100%

Brightness = Set the slider to about 100%

Remember that the rx and the ry in perlinsc(rx/a,ry/b,c,d)*(br*20) means that you can click on the texture and drag it around to find other areas of the texture.

Two different areas of the Large Grubby Marks sub-preset.

Weathered Wood Grain

Width = 5

Height = 600

Softness = 25

Detail = Set the slider to about 90%

Brightness = Set the slider to about 1%

Another Example of Using Brackets

Undo everything you’ve done so far, going back to the new document with a filled pixel layer, then add the Procedural Texture filter. If you’ve got the Procedural Texture as a Live Filter layer, double-click on the icon for the Procedural Texture (a black hourglass on a white background) to reopen the Procedural Texture Dialogue.

From the Equations Presets dropdown list, select Ripples in the Monochrome Patterns category.

The equation looks like this:

var v=vec2(rx,ry)*(c/w); noisesc(v+(udirsc(v)*t))

This texture has two Custom Inputs (c and t) called Square Count and Turbulence.

There are already quite a few sets of brackets is this equation: (rx,ry) we know make it click-dragable. (c/w) divides whatever number is in the c input (50) by w – which C++ code for width.

All this front section - var v=vec2(rx,ry)*(c/w) - is doing is setting a value for the letter v in the next section. The next section takes whatever value for v is to help in the making of noisesc noise.

The second section of the equation - noisesc(v+(udirsc(v)*t) – is where the action takes place. It is making noisesc noise, guided by the v value and using the udirsc function to stir the pattern up (make it turbulent). The amount of turbulence is controlled by the t Custom Input.

Mix Things Up

The turbulence controller, t, is a good place to start. We can make the texture really gnarly if we multiply that t by a number like 25. t*10 multiplies the turbulence set by the t Custom Input by 10, BUT WE HAVE TO ENCLOSE IT IN BRACKETS. Edit the last part of the equation so it reads:

var v=vec2(rx,ry)*(c/w); noisesc(v+(udirsc(v)*(t*10)))

Note the number of closing brackets at the end.

That’s a MUCH more interesting texture! If you wished, you could save this as a preset called “Turbulent Ripples” in the Monochrome Patterns category. In the image below, I set the Square Count to 20, applied it to some text, added an elliptical layer fx gradient set to hard light and added an Outline, also via layer fx.

Go Large

Looking at the equation, thus far we have: var v=vec2(rx,ry)*(c/w); noisesc(v+(udirsc(v)*(t*10))).

The segment of the equation (c/w) takes the width w and divides it by whatever number is in the Custom Input c. What happens if we want to see what happens when multiply w by a number like 200? The sum, or expression, to do that is straightforward – w*200 (width time 200) – but you can just slap that in after c/w like this: c/w*200. Affinity will take c, divide that by width w and then multiply the result by 200. Instead, we put brackets around w*200 to let Affinity know we want it to treat that bit separately like this: var v=vec2(rx,ry)*(c/(w*22)); noisesc(v+(udirsc(v)*(t*10))).

The difference the brackets make could not be more dramatic:

WITHOUT BRACKETS var v=vec2(rx,ry)*(c/w*200); noisesc(v+(udirsc(v)*(t*10))) PRODUCES THIS:

WITH BRACKETS var v=vec2(rx,ry)*(c/(w*22)) PRODUCES THIS:

Go ahead and add the expression in brackets so that the equation now reads:

var v=vec2(rx,ry)*(c/(w*22))

You have now produced a click-draggable, scaleable AND distortionable lighting gradient. You can save this a preset as BW Adjustable Lighting Gradient. I have created a category for Lighting FX in which I save textures of this kind.

Using the Lighting Gradient

Open an image or download my Bluebell Woods from the files at the end of this tutorial.

Go to Layer>Live Filter Layer>Colours>Procedural Texture.

Click on the left side of the gradient and drag it to the right (towards the dialogue box). I was looking for something that might make an interesting effect and found this:

It doesn’t matter if you can’t find the same section of the texture, just something with a bit of high contrast will do.

At the bottom right of the Live Procedural Texture dialogue is the drop-down list for change the filter’s blend mode. Change it to Overlay.

A dramatic shaft of light (or something similar).

Play with the Turbulence and Square Count controls whilst dragging the texture around. Returning the Blend Mode to Normal can be helpful in finding other useful areas of the texture.

With the Turbulence set to about 75%, and dragging around, I found this:

Giving this effect of deep-shaded forest floor when the Blend Mode is changed to Colour Burn and the Opacity (bottom left corner of the dialogue) set to 50%:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• Affinity

×
• Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.