LIBRARY: Tutorials Reviews Interviews Editorials Features Business Authors RSS Feed

Creating A Sunrise Using Expressions

Creating A Sunrise Using Expressions
A CreativeCOW.net Adobe After Effects Tutorial


At Sunrise

Mylenium
Mylenium
http://www.mylenium.de
Germany

©Creativecow.net. All rights are reserved.
Article Focus:
The goal of this mini-tutorial is to show you some basic targeting using expressions as well as a few other tricks. Not only can this be used to create a stylized sun but also for lasers firing or wormholes.


Download the project files here.


Preface

The final result of this tutorial could also be achieved using manual techniques with 3D layers and a look_at expression. "So, what's the point then ?" you may say. Apart from my technique being largely automated once it is set up, there are several other things to consider:

a) 3D layers are slower than 2D layers, both while editing and when rendering.

b) Artifacts. Even though After Effects keeps getting better in 3D, it still is a rather weak tool for that kind of compositing. Even the advanced 3D renderer is far from being really advanced (nowadays it more like deserves the title "average" or "mediocre"). It's slow, has serious motion blur and anti-aliasing problems, causes quite often crashes (because it runs out of memory) etc..

c) There is a mathematical problem - at one point our layers are likely to show unwanted flipping if they were 3D. There are ways to avoid and compensate for it, but we will spare ourselves the trouble this time around.

That's why I try to avoid 3D in After Effects whenever possible and settle for 2D solutions instead.



Step 1: Setting up the project

Unlike in some of my other tutorials this is really simple this time. If you like, you can even do everything in one comp but I prefer to have two compositions - the main one called Sun and one separate comp for the Beam element. Apart from that, we only need to add two layers (or Null objects) to the main composition which will control everything. I named them Center and Target and Controller. Imaginative, isn't it? You can modify Center in any way you like and use it as the disc of the sun. The other layer will remain hidden and is really only used for animation and setting parameters. To keep things simple I only added a slider expression control and called it Radius.


Step 2: Beam me up Scotty

The look of the Beam is really very much a matter of your personal taste. The only immediate requirement is to make the composition 1000 pixels wide. This will simplify calculations later on. You may use other values, but I suggest to always use multiples of 100 (the reason why is explained in the Grid tutorial). Keep in mind that the more beams you use, the finer they should be. Now drop it into the main composition and set its anchor point to the leftmost edge.


Step 3: Expression time

The Beam layer uses expressions on all three standard transformation properties. First let's take a look at the position property.
center_X=thisComp.layer("Center").position[0];
center_Y=thisComp.layer("Center").position[1];
radius=thisComp.layer("Target and Controller").effect("Radius"("Slider");
my_angle=Math.PI*2/(thisComp.numLayers-2)*(index-2)-degreesToRadians(thisComp.layer("Center").rotation);
position_X=center_X+Math.sin(my_angle)*radius;
position_Y=center_Y+Math.cos(my_angle)*radius;
[position_X,position_Y]
What are we doing here? The position of a point on a circle can be expressed as functions of sines and cosines. Unfortunately the result of those is always somewhere between -1 and 1. Therefore we must multiply the results with the Radius from our Target and Controller layer and add the values to the position values of Center. Otherwise our sun would always stay in the top left corner where After Effects' coordinate system has its origin. Furthermore we are also taking precautions and already factor in a possible rotation of Center which we need to convert from degrees to radians. The circle itself is defined as a function of Pi. To split it into equal segments, we need to divide it by the number of layers in our comp (minus the two control layers).

The rotation is calculated very much as a standard targeting function:

diffX=position[0]-thisComp.layer("Target and Controller").position[0];
diffY=position[1]-thisComp.layer("Target and Controller").position[1];
myRot=radiansToDegrees(Math.atan2(diffY,diffX))-180; [myRot]
The last expression is also the simplest one. The scale is calculated as follows:
[length(position-thisComp.layer("Target and Controller").position)/10,100]
And that's it! Now go ahead and clone the Beam layer a few times and see the sun shine into your life ;o).





Feel free to ask questions regarding this tutorial in the After Effects forum at Creativecow.net


Please visit our forums at Creativecow.net if you found this page from a direct link.



Related Articles / Tutorials:
Adobe After Effects
Compositing Secrets Everyone Can Use: Pt. 3 - Alpha Channels

Compositing Secrets Everyone Can Use: Pt. 3 - Alpha Channels

When most people hear the words "alpha channels", they think "transparency", but that's not exactly accurate. The truth is more complex, and a quite bit more interesting! Join longtime VFX artist, editor, software developer, and business owner Simon Ubsdell for Part 3 of the best look behind the technology of compositing that you've ever seen, packed with practical advice for applying the secrets of alpha channels that's simply not possible before understanding these underlying principles. No matter which applications you're using for editing, compositing, or visual effects, this one is a must-see!

Tutorial
Simon Ubsdell
Adobe After Effects
Compositing Secrets Everyone Can Use 2: Advanced Blend Modes

Compositing Secrets Everyone Can Use 2: Advanced Blend Modes

Whether you're a full-time compositor and VFX artist, an editor working in one of the many NLEs that supports Blend Modes (including Adobe Premiere, Apple FCP and FCPX, Avid Media Composer, DaVinci Rsolve, and VEGAS Pro), or whether you just want the additional graphics power that comes with insight into the secret world of pixels, this is the tutorial for you! Join longtime VFX artist, editor, software developer, and business owner Simon Ubsdell for Part 2 of the best look behind the technology of blend modes that you've ever seen, with some practical steps you can start taking today to make your work look better than ever.

Tutorial
Simon Ubsdell
Adobe After Effects
Compositing Secrets Everyone Can Use: Pt. 1 - Blend Modes

Compositing Secrets Everyone Can Use: Pt. 1 - Blend Modes

Join longtime VFX artist, editor, software developer, and business owner Simon Ubsdell for the best look behind the technology of blend modes that you've ever seen. This isn't just for graphics and VFX, but for video editors too -- anyone who puts anything together, and wants to learn more about HOW images combine at the most basic level, in a way that applies to every application you might use, whether Adobe Premiere Pro, Apple FCPX, Avid Media Composer, DaVinci Resolve, VEGAS Pro, and yes, graphics and VFX programs like After Effects, Motion, Fusion, Nuke, Scratch, and many more.

Tutorial
Simon Ubsdell
Adobe After Effects
Disintegration VFX in Adobe After Effects

Disintegration VFX in Adobe After Effects

Join VFX guru Tobias Gleissenberger of Surfaced Studio for a classically energetic Adobe After Effects tutorial combining difference mattes, displacement maps, edge glows, and compositing tricks to dissolve (or explode!) one element in your frame while leaving the rest alone.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects: Common QT & Export Problems & Solutions

Adobe After Effects: Common QT & Export Problems & Solutions

Problems with Adobe After Effects? Can't import or export QuickTime videos? Exports too big? Missing codecs? AE guru and VFX whiz Tobias Gleissenberger of Surfaced Studio has the answers you're looking for to make every project come to completion more smoothly, including a comparison of exported file sizes for common codecs.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Fancy Title Animations In Adobe After Effects -- FAST!

Fancy Title Animations In Adobe After Effects -- FAST!

Follow along as VFX guru Tobias Gleissenberger shows you how how to quickly create professional-looking animated text elements using the free presets that are included with Adobe After Effects, customizing them to suit your needs. Tobias will also show you how to apply masks to your text layers to have them appear from behind other elements.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Remove People from Moving Video in After Effects with Mocha

Remove People from Moving Video in After Effects with Mocha

Learn how to remove a person from a moving video using the Remove module of the Mocha Pro plug-in for Adobe After Effects! In one of his most epic tutorial's yet, Surfaced Studio's Tobias Gleissenberger then adds a bonus Beam Up effect using some of the great filters from the Boris Continuum and Sapphire collections.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Basic Clone Effect Interaction - After Effects Tutorial

Basic Clone Effect Interaction - After Effects Tutorial

Want to take your CLONE EFFECT to the next level? Want to know how to make your clones INTERACT? Tobias Gleissenberger shows you how.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects: Glitch Effects Without Using Plug-ins!

Adobe After Effects: Glitch Effects Without Using Plug-ins!

Join VFX guru Tobias Gleissenberger for a fun, high-energy look at how to create all sorts of digital noise, glitch, and other disturbing video effects with any version of Adobe After Effects, without using any plug-ins!

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects Energy Ball

Adobe After Effects Energy Ball

In his latest high-energy Adobe After Effects tutorial, VFX guru Tobias Gleissenberger of Surfaced Studio combines a variety of effects to create the pulsating energy ball, composited with motion tracking, optical flares, and more.

Tutorial
Tobias Gleissenberger
MORE
© 2018 CreativeCOW.net All Rights Reserved
[TOP]