Advertisement

Learn How to Create a Light Rays Custom Effect from Scratch

by

A custom effects is special kind of preset that looks and behaves like a plugin. It allows you to save a special recipe of plugins and keyframes into something that you can reuse with ease. Jorrit Schulte has been producing a bunch of these very useful custom effects and providing them for free at http://aenhancers.com. In this tutorial he breaks down how to create the incredibly popular light rays effect and how to package it all into a custom effect.

We're going to break down how you create a light ray effect, like shine, and then we're gonna learn how to create a preset so you can use it again any time you like
inside of the preset. Finally we are going to make that preset into a custom effect using a script from nabscripts.com.

Download Script

createCustomEffect.jsx

Step 1

Let's start by creating the Custom Effect with all the Controls,
what a Custom Effect is. It is just one 'effect' with all expression controls in it, only it is much easier to control especially if you have lots of controls.
This script as is only works in AE 7 so if you are working in AE 7.0 you can skip Step 1 & 2. Otherwise we are going to quickly edit the script to make it work in CS3 or CS4. Lets open the script in Adobe ExtendScript Toolkit by double clicking it..

Step 2

Lets go in and do "Edit > Find And Replace"
and find: 7.0 & Replace: CS3 (or CS4 if you are working in CS4)
click Replace All, you get a Message that 5 Items are replaced, click OK
Then save the script

Step 3

Now place the script inside of your AE Scripts Folder (C:\Program Files\Adobe\Adobe After Effects CS3\Support Files\Scripts\ in CS3 on Windows), (Applications/Adobe After Effects/Scripts on Mac)

Step 4

Lets start AE and start creating the Custom Effect.
Run the script by going "File > Script > createCustomEffect.jsx"

Step 5

A New window pops up, this script is great I really like it but it is kind of limited.
You can't change the order, or add groups and things like that.
So let's just type a name and a matchName (that is without spaces) and leave the rest as it is.
Hit Create. AE will close.

Step 6

Let's open the PresetEffects.XML file where all the Custom Effects Codes are saved, in CS3 on windows, the standard file path is C:\Program Files\Adobe\Adobe After Effects CS3\Support Files\. On Mac you need to right-click on the After Effects application icon and choose "Show Package Contents"

Then the path is "Contents/Resources/PresetEffects.xml"

Open PresetEffects.XML in Adobe ExtendScript Toolkit and scroll all the way to the bottom, there you will see our Custom effect.

Step 7

Now lets start by adding controls to the custom effect. I took the time to create a text file with all the Custom Effect codes I know so you can use it on your own, it is included in the preset download at the end of this tutorial. I will show you some controls to get you started. (If things don't make sense, check the Custom Effect codes text file and hopefully things will make more sense.) First add a group called Pre-Process.

Step 8

Let's add a Checkbox and 2 Sliders inside of this Group.

Step 9

We put a Point after this group, we want this Point to be at the center of the Comp at default. At the end of the Custom Effect codes text file, you see a Center Point Lets add that.

Step 10

You can see the completed Custom Effects from the Final Preset available for download at the end of this tutorial, so let's move on and start After Effects again.

Step 11

When you start you get a message asking if you want to clean up the startup script, click yes. There's a new comp automatically made called 'my Custom Effect Comp'
in that comp there's a layer called 'my Custom Effect' then look at the Effect Controls for that layer, and there it is, our Custom Effect!

Step 12

Make a new comp, choose whatever settings you like, create some text so we can see what we're doing. Then copy and paste the Custom Effect from
'my Custom Effect Comp' to this text layer.

Step 13

First let's add the effect that will be the basis of our ligh rays, go "Effect > Blur > Sharpen > CC Radial Fast Blur"

Step 14

We want these rays to be bigger, the further the source point is from the center of the comp, CC Radial Fast blur does not do this automatically, so let's add an expression for the Amount by Alt + Clicking on the stopwatch. The first part of the expression will represent the center of the comp, so we are going to create 2 variables 1 for X and one for Y axis:

 
X = thisComp.width/2;  //(center in X axis)  
Y = thisComp.heigt/2;  //(center in Y axis)
 
SP = effect("Light Rays")("Source Point"); //(the Source Point from the Custom Effect)

Now we need the expression that will calculate the distance between the XY center and the Point, there is a command for that called 'length' so lets type: length (SP, [X,Y]) That's a little too much so add /10 right at the end of that: length (SP, [X,Y])/10 now we need to add to that the ray length slider which is too small so add *2: +effect("Light Rays")("Ray Length") *2 Here is that full expression: X = thisComp.width/2; //(center in X axis) Y = thisComp.heigt/2; //(center in Y axis) SP = effect("Light Rays")("Source Point"); //(the Source Point from the Custom Effect) length (SP, [X,Y])/10 + effect("Light Rays")("Ray Length") *2

We also need to add an expression for the center of CC Radial Fast Blur, so just use the pickwhip to the Source Point. The expression should come out to this:
effect("Light Rays")("Source Point")

Step 15

If CC Radial Fast Blur's Amount is at 100, it will not go any further because that is the maximum value of this effect, to overcome this we need to duplicate CC Radial Fast Blur.
To this duplicated effect we need to add at the end of the amount expression -100 so when the first one stops, the second one starts growing. The expression for the duplicated effect should look like this:

X = thisComp.width/2;  //(center in X axis)  
Y = thisComp.heigt/2;  //(center in Y axis)
 
SP = effect("Light Rays")("Source Point"); //(the Source Point from the Custom Effect)
length (SP, [X,Y])/10 + effect("Light Rays")("Ray Length") *2 -100

Step 16

Everything looks great so far, now we are going to take a look at the Pre-Process group, which are the mask options. We are going to use 'Circle' for that. Go "Effect > Generate > Circle" and put it above the CC Radial Fast Blur.

Step 17

The result is not what we want, we want this to represent the alpha so let's set the Blending Mode of 'Circle' to Stencil Alpha.

Step 18

If the 'Use Mask' checkbox from our Custom Effect is checked, we want our circle to not be visible. We can't shut this effect off with expressions, so as a workaround we can make the circle very big so it never cuts off the text or whatever layer you are using it on.
Let's alt + Click on Radius to add an expression, Type:

 
if( 

and Pickwhip The 'Use Mask' Checkbox. Then after that type: 
 
== enabled){	//(this is what happens when it's checked, make sure there's 2 =='s) 

and then pickwhip the Mask radius Option from the Custom Effect. 
 
effect("Light Rays")("Mask Radius") 
}else{  // this is what happens when it is not checked
10000 }  //(which is the maximum value) 

Here is the full expression:

if (effect("Light Rays")("Use Mask") == enabled) {
effect("Light Rays")("Mask Radius")
} else {
10000 
}

And finally, under the Group 'Feather' from the Circle effect, Alt + Click on 'Feather Outer Edge'
and use the Pickwhip and pickwhip to 'Mask Feather' from our Custom Effect:

effect("Light Rays")("Mask Feather")

also, do the same thing for the Circle's Center and the Source Point.
  

Step 19

We're gonna work on the Blur Group now. Go "Effect > Blur > Sharpen > Radial Blur" and put it right below Circle. Set the 'Type' to Zoom & the 'Antialiazing (Best Quality)' to High.

Step 20

We're going to add an expression for amount (Alt + Click) almost the same as the last one:

  
if(effect("Light Rays")("Use Blur") == enabled){ 
effect("Light Rays")("Ray Length") 
}else{ 
0 
}

and again pickwhip the center to the source point:
effect("Light Rays")("Source Point")

Step 21

Let's move on to the color group, there are 3 colors so we are going to use the 'tritone' effect.
Let's add "Effect > Color Correction > Tritone" making sure to keep it below everything
and Alt + Click on the colors from tritone and pickwhip them to the Color Controls from the Custom Effect with the same name.

Step 22

Nothing happens, the colors won't change. This is because Tritone looks only at RGB channels. To fix this we need a kind of Alpha to RGB + Alpha (or RGBA) converter, we can do that using a cool technique that I found. First let's add a Glow effect:
"Effect > Stylize > Glow"

Step 23

That's not quite what we want, it is really bright and blown out. To achieve the effect we're looking for lets use these options: Set the Glow Threshold, Radius and Intensity To 0, 'Composite Original' to On Top And the 'Glow Operation' to None.
Now, we have our neat Alpha to RGBA converter, which is also included by the final preset file as an individual preset (Called 'Alpha to RGBA Colors').

Quick Tip: As you can see in the image below, you can't see the Shadow color. Duplicate the Glow to see it, or if you want a bit more glowy look.

Step 24

Twirl open the 'Circle' and Alt + Click on the Opacity in circle and pickwhip that to the Shine Option From the Custom Effect.
The Glow will make a weird, but cool looking effect that, while fading the opacity, first lowers the highlights, then the midtones and then the shadows, pretty cool. For a normal opacity, you can use the layer's transform opacity.

Step 25

For the boost light option, add Brightness & Contrast
"Effect > Color Correction > Brightness & Contrast
And Alt + click on 'Brightness' and Pickwhip it to 'Boost Light' and Add *2:

effect("Light Rays")("Boost Light") * 2 

do the same Thing For 'Contrast':

effect("Light Rays")("Boost Light") * 2 

Step 26

Use the image below as a reference to give all the controls appropriate names by selecting the effect name and hitting Enter. Finally reset the custom effect by clicking 'Reset' at the top of the effect. Now it is ready to be saved as a preset (Glow is now Called: Alpha to RGBA Colors (Copy Me))

Step 27

To save it as a Preset, open the Effects & Presets window, Select everything you want to save and click on the little post-it button in the lower right corner.

Step 28

A save sialog box comes up, go to "C:\Program Files\Adobe\Adobe After Effects CS3\Support Files\Presets" on Windows or on Mac go to "/Application/Adobe After Effects CS3/Presets"
I'm going to create a new folder called 'Jorrit Schulte' and inside another one called 'Light Rays'.
In there, i'll will save the preset as 'Light Rays.ffx'

Step 29

Now that we have our preset saved, lets create a little project using the preset.
Create a new Comp, choose whatever settings you want. and a layer that is comp size. Call that layer 'Planet'

Step 30

Add "Effect > Noise & Grain > Fractal Noise"
Change the 'Fractal Type' to Dynamic, set the 'Contrast' to 75 and set the 'Brightness' to -15

Step 31

Add "Effect > Color Correction > Curves"
Play with the settings until you get a cool looking color like this orange:

Step 32

Let's add "Effect > Perspective > CC Sphere"
Set the 'Radius' to 150.
Under the 'Light' Group set 'Light Height' to 100.

Step 33

Now that we have our simple planet, lets go on with the Light Rays part.
Create a new solid called Light Rays, make it comp size and hit OK.

Step 34

Let's add "Effect > Noise & Grain > Fractal Noise" again.
Set the 'Fractal Type' to Dynamic, set the 'Contrast' to something very high like 700 and the 'Brightness' to about -100

Step 35

Copy The 'CC Sphere' Settings to the 'Light Rays' layer.
Pre-Compose it, we do this because otherwise the edges will get cut off.

Step 36

Apply our Light Rays preset, and hit Reset for 'Light Rays'

Step 37

Lets set the shadow color to a pure black, and we can set the midtones to some cool fiery orange color (I use #B46928 here). Also set the 'Boost Light' to 7.5 and the 'Ray Length' to about 43. Finally, set the transfer mode of the Light Rays Pre-Comp to 'Add'

Step 38

Under 'FX: Rays' set the 'Zoom' to Brightest, set the Custom Effect's 'Opacity' a little bit lower. I also added a curves effect to get this final look (I'll leave this part for you to figure out).

Step 39

We're going create a quick star background. Create a new white solid called BG, make it comp size and hit OK. Place the solid on the bottom of the timeline.

Step 40

go "Effect > Simulation > CC Star Burst". Play with the settings until you get something you like this. Make sure 'Speed' is set to 0 so the background doesn't move.

Here's what it looks like:

Conclusion

We have created a preset from start to end, including creating the custom effect,
after that we've created a very basic planet with our preset

We've had some fun time, well... I did, if you not, you are probably not reading this...
ah well, I will see you next time

Download

Final Preset & Associated Files