Learn How to Create a Light Rays Custom Effect from Scratch

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.

Preview

RSS readers: click post title to view preview video at Aetuts+.

Get the Flash Player to see this player.

Download Preview

File size: 30mb

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 &amp 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 &amp Contrast
“Effect > Color Correction > Brightness &amp 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 &amp 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 &amp 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

Related Posts

Add Comment

Discussion 44 Comments

  1. vasu says:

    gr8 tutorial keep em coming

  2. Sal says:

    Very interesting. Thank you for sharing. Great tut.

  3. GhosTz says:

    Nice Tut !! ThanX

  4. Sal says:

    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.

  5. Satya Meka says:

    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.,

  6. Loay says:

    I think Video Tutorials will be better but thank you very much :) .

  7. L says:

    amazing tust!

  8. Sal says:

    It’s alright, forget it. The script shows up now when I click on the download button.

  9. his1nightmare says:

    omg…

    crazy

  10. Jim Hines says:

    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

  11. David W. says:

    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. ;)

  12. kevin says:

    lol i love the song.. well not really, but i do come from the netherlands.. anyhow, great tutorial!

  13. kevin says:

    or should I say:

    Goed gedaan man! Leuk dat hier ook Nederlanders zijn!

  14. ninjtso says:

    great Video Tutorials i like it

  15. RVS says:

    No man, not the toppers :p

    Great tutorial however. Keep them coming

  16. Prabhik Jain says:

    Thanks for all these tutorial
    i think this is best way for me to improve my work

  17. RGB says:

    very good

  18. tony says:

    nice nice… there is also a software called Vitascene that do that kind of special effects….

  19. e11world says:

    Very cool! I’ll try this on my next project.

  20. liudi says:

    goooood!

  21. Thomas says:

    Jeah what an awesome song (and tut)!

    Dat Nederland nog meedoet aan ‘t songfestival -.-’

  22. Craig says:

    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 says:

      Try adding another Curves effect and make it a darker contrast curve.
      else, you can try adding ‘Brightness & Contrast’.

  23. CgBaran Tuts says:

    Great tutorial and best think is that you show how to use it again by saving effect

  24. Luis Valente says:

    Step 5 – I click on “CREATE” and the button doesn’t do nothing . What was i do wrong?

    • Jorrit Schulte says:

      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 says:

        Thanks to the Question asker and the Responder!!!

        You both have just saved me about 4 hours!

        :)

      • WTF says:

        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 says:

        Hmm, you could try going ‘Edit > Preferences > General’
        and make sure you have “Allow Scripts to Write Files and Access Network” checked on…

  25. WTF says:

    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.

    • ... says:

      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?

  26. Darren Hardaway says:

    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 says:

      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!

  27. Tyler says:

    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.

  28. chris says:

    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.

  29. Sjon Ueckert says:

    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.

  30. dag martin says:

    Same problem with step 5 here…! Vista and CS4..! :/

  31. Alex Mutnick says:

    I was wondering how you were able to do the rotation since the object is 2D. I tried making the layers 3d, but it wasn’t working. please help.

  32. rajesh says:

    this tutorial is good but i needd more for the motion graphics, those r incldd with 3d also

  33. Rick says:

    hi,

    can you quickly tell us mac users what to exactly change in the jsx file to be mac compatible?
    It appears to be setup for windows users.

    thanks

  34. rajat says:

    written tutorials are better than video

  35. Justin says:

    Hi,

    If there are any mac users still out there that cannot get this to work, here are the steps to fix it.

    If you have it installed on Macintosh HD (default) the steps that follow will be exact, otherwise please change to your installation path. I am currently on Snow Leopard and using CS4 of After Effects.

    First go to Applications, Adobe After Effects CS4 (or CS3)
    Control Click Adobe After Effects CS4 and Show Package Contents.
    Browse to Contents\Resources\PresetEffects.xml
    Click the file to select and press Apple+I to bring up file info.
    Click the lock to open the file to changes then Change permissions
    to be read/write by everyone (and yourself if not already).

    Second open the createCustomEffect.jsx file.
    find:
    “var StartUpScriptPath = \”C:\\” + “\\Program Files\\” + “\\Adobe\\” + “\\Adobe After Effects 7.0\\” + “\\Support Files\\” + “\\Scripts\\” + “\\Startup\\” + “\\” + “\”;\r\r” +

    and change to:
    “var StartUpScriptPath = \”/Applications/Adobe After Effects CS4/Scripts/Startup/\”;\r\r” +

    Find:
    ==========
    var AEPath = “C:\\Program Files\\Adobe\\Adobe After Effects 7.0\\Support Files\\”; // “PresetEffects.xml” location folder

    AND
    ==========
    var StartUpScriptPath = “C:\\Program Files\\Adobe\\Adobe After Effects 7.0\\Support Files\\Scripts\\Startup\\”; // “Startup” script folder

    CHANGE TO:
    ==========
    var AEPath = “/Applications/Adobe After Effects CS4/Adobe After Effects CS4.app/Contents/Resources/”;

    AND
    ==========
    var StartUpScriptPath = “/Applications/Adobe After Effects CS4/Scripts/Startup/”;

    Hope this helps all of the MAC users out there!

    Justin

  36. Matías says:

    Hello, I have a problem with step 5 … I put the names and clicks to create, but I bounced an error saying:

    The application preference “Allow Scripts to Write Files and Access Network” must be set.

    I want to know how to fix this, thanks.

    PS: sorry for the grammar, do not speak English :/.

Add a Comment