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.
Learn How to Create a Light Rays Custom Effect from Scratch
May 25th in Motion Graphics by Jorrit SchultePreview
RSS readers: click post title to view preview video at Aetuts+.
Download Preview
File size: 30mbWe'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.jsxStep 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 FilesPlus Members
Source Files, Bonus Tutorials and
More for $9 a month for all Tuts+
sites in one subscription.











User Comments
( ADD YOURS )vasu May 25th
gr8 tutorial keep em coming
( )Sal May 25th
Very interesting. Thank you for sharing. Great tut.
( )GhosTz May 25th
Nice Tut !! ThanX
( )Sal May 25th
Jorrit,
I don’t understand. What script do you open in step one? I downloaded nablib_3 but I don’t see any createCustonEffect.jsx. I’m assuming that’s what you’re using in step one.
( )Lloyd May 25th
[EDITOR REPLY] That was my fault, I’ve corrected the link.
( )Satya Meka May 25th
Wow! I never thought of using Glow to convert Alpha to RGBA. I always used to precomp the layer which is a mess. Also, now I know how to group things in a preset. Awesome! While, I used ‘Zoom-Blurring’ to get a trapcode shine like effect but I never was able to pull it off with midtones and shadows. Also, on a Mac, you can get a lot image effects with animation including ‘Zoom Blur’ with Quartz Composer ( Free). It helped me a lot in many occasions. For a tutorial on that http://www.dvcreators.net/rayz-o-lite/ . Finally, I am glad to see tutorials related to scripting etc.,
( )Loay May 25th
I think Video Tutorials will be better but thank you very much
.
( )L May 25th
amazing tust!
( )Sal May 25th
It’s alright, forget it. The script shows up now when I click on the download button.
( )his1nightmare May 25th
omg…
crazy
( )Jim Hines May 25th
Awesome! Today is my B’Day so this was a nice gift. Thank you! I learned so much from this tutorial beyond the effect itself. I don’t mind reading the tutorials. In fact in this instance, considering the nature of the instruction I believe I prefer it.
I made one of these long rays of light fx with Quartz Composer a few weeks ago like Satya pointed out. Anyone on a Mac should check into that hidden app.
Here is my attempt at it on Quartz Composer. You will need quicktime to see it.
( )http://web.mac.com/jameshines/Site/Client_Preview.html
David W. May 25th
Nice effect. A video would be better since you don’t tell us what to type. I mean, you just say, ‘lets add a check-box and 2 sliders.’ I don’t know anything about scripting and probably half the people who come here don’t either. Still, great job and I’ll try and figure it out.
( )kevin May 25th
lol i love the song.. well not really, but i do come from the netherlands.. anyhow, great tutorial!
( )kevin May 25th
or should I say:
Goed gedaan man! Leuk dat hier ook Nederlanders zijn!
( )ninjtso May 25th
great Video Tutorials i like it
( )RVS May 25th
No man, not the toppers :p
Great tutorial however. Keep them coming
( )Prabhik Jain May 25th
Thanks for all these tutorial
( )i think this is best way for me to improve my work
RGB May 26th
very good
( )tony May 26th
nice nice… there is also a software called Vitascene that do that kind of special effects….
( )e11world May 26th
Very cool! I’ll try this on my next project.
( )liudi May 27th
goooood!
( )Thomas June 2nd
Jeah what an awesome song (and tut)!
Dat Nederland nog meedoet aan ‘t songfestival -.-’
( )Craig June 4th
Awesome tut… thanks. I am on step 38 and have tried just about everything to get the curve look but am now stuck. Any hints on the curve effect?
( )Jorrit Schulte June 4th
Try adding another Curves effect and make it a darker contrast curve.
( )else, you can try adding ‘Brightness & Contrast’.
CgBaran Tuts June 8th
Great tutorial and best think is that you show how to use it again by saving effect
( )Luis Valente June 15th
Step 5 – I click on “CREATE” and the button doesn’t do nothing . What was i do wrong?
( )Jorrit Schulte June 15th
Make sure to check Step 1 + 2
also, when you have AE installed on D:\ E:\ or whatever other than C:\
Redo Step 2, only Find: C:\ And Replace whatever disk you have AE installed on (for example D:\)
Lastly, make sure there are no spaces in in ‘machName’
( )RoseWater74 June 17th
Thanks to the Question asker and the Responder!!!
You both have just saved me about 4 hours!
WTF June 17th
I tried this, but stilll having problems… I have Vista and have both CS3 and CS4 on the same machine… tried this multiple times for both (making sure to change the .jsx to either CS3 or CS4 and either C: for CS4 or E: for CS3)…
Could it be a permissions issue? It does nothing after clicking “create” on step 5
Jorrit Schulte June 18th
Hmm, you could try going ‘Edit > Preferences > General’
and make sure you have “Allow Scripts to Write Files and Access Network” checked on…
WTF June 18th
OK… I’ve successfully gotten past step 5 by right-clicking on the CS4 app icon and opening As Administrator, then was able to perform the tasks… However, I am not understanding how you are able to copy and paste the effect from the Custom Effect Comp to the other comp… the windows keep switching when you choose the new comp, and there is no copy / paste available in right click menu. I’ve tried it several different ways, even CTL + C and CTL + V. Sorry, I’m 2 weeks new to AE. It would help to also have this tutorial in video so that it can be seen exactly what you are doing.
Thanks.
( )... June 18th
What makes it worse is that I am also new to Vista which was installed a couple of weeks ago as well (so now coupled with having both CS3 and CS4, I am also new to Vista)… Having said that… I downloaded the final product files at the end of the tutorial and upon trying to open it, I got error messages for each one of the parameters within the Light Rays effect that was created. The warning is this:
After Effects warning: Class ‘Effect’ has no property or method
named ‘[name of parameter - for example I'll use:Source Point]‘
Expression disabled.
Error occurred at line 1.
Comp: ‘Comp1′
Layer:1 (’AE Tuts+’)
Property: ‘Center’
It does this for each comp as well as each parameter in the comp.
I get the feeling that somewhere along the line, AE is not pulling the PresetEffects.XML or something?
( )Darren Hardaway July 14th
I was wondering whats up with the little pop-up window that says:
Unable to execute script at line 15. After Effects error: Can not add a property with name “Generate” to this PropertyGroup.
This is all I had to start and I didn’t see any problem with it:
I’m not really sure where its pulling this out from, the XML or the original script or what, but this is exactly what I have been looking for to organize a particularly hairy preset dealing solely with transformations, so if anyone can help with this strange issue (nobody else seems to have it) that would be great. I’m running Vista Premium CS3. this is happening when I reboot AE after creating the XML data
( )Darren Hardaway July 15th
He he he, sorry nevermind, I see I didn’t paste the text in there and it was because a group didn’t have a slash at the beginning of the text. I fixed it, and man oh man does that rock! Thank you so much!
( )Tyler August 6th
Hey i have a question, whenever i get the script in the adobe file i see all the other scrips are seen as unopenable files and the custom one from this tutorial is seen as a read me file. They are not in the script format. I need help.
( )chris August 13th
great tutorial!
i actually enjoyed it not being video, since i messed up a couple times; i didn’t have to rewind, i just had to scroll up.
thanks so much, not just for the files, but for how the files were made.
( )Sjon Ueckert August 26th
I, too get through to the end of step 5, and nothing happens. I click Create (this is on a Mac with CS4), the button blinks blue, but nothing happens, and AE does not close. Yes I checked the Allow Scripts to write… in the Preferences.. I would love to learn this, but can’t.
( )dag martin August 26th
Same problem with step 5 here…! Vista and CS4..! :/
( )