Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US :: FAQ
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
LIBRARY:TutorialsVideo TutorialsReviewsInterviewsEditorialsFeaturesBusinessAuthorsRSS Feed

Creating A Sunrise Using Expressions

COW Library : Adobe After Effects Tutorials : Mylenium : Creating A Sunrise Using Expressions
Share on Facebook
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.

  Adobe After Effects Tutorials   •   Adobe After Effects Forum
Reply   Like  
Share on Facebook


Related Articles / Tutorials:
Adobe After Effects
Zero VFX: Why Some Effects Are Better Unseen

Zero VFX: Why Some Effects Are Better Unseen

Kyle Andal and Gerard Andal, lead compositors at Zero VFX, bring invisible post-production magic to several films - including 2014 Academy Award-winning "American Hustle," in which the team helped transform 2013 Boston to 1978 New York - and also several commercial shots with mocha Pro.

Editorial, Feature, People / Interview
Adobe After Effects
LightGrid Script and Demo Tutorial Part TWO with New Feature

LightGrid Script and Demo Tutorial Part TWO with New Feature
  Play Video
LightGrid Script creator Brian Charles demonstrates his newly modified After Effects script for rigging lights in grids and circles. The modified script with the new feature, which adds the ability to enable individual light colors through a checkbox in the effect control panel, is available as a free download in the Project Files folder.

Tutorial, Video Tutorial
Adobe After Effects
Green Screen Billboard Compositing

Green Screen Billboard Compositing

This After Effects tutorial demonstrates how to simulate augmented reality centered around a city billboard by compositing green screen footage and editing it into the scene.

Tutorial
Adobe After Effects
After Effects Handwriting Tutorial

After Effects Handwriting Tutorial

This tutorial will show you how to create an animation of a marker writing out a logo or a few words, followed by a slick reveal to an actual logo.

Tutorial
Adobe After Effects
LightGrid Script and Demo Tutorial

LightGrid Script and Demo Tutorial
  Play Video
LightGrid Script creator Brian Charles demonstrates his After Effects script for rigging lights in grids and circles. The script is available as a free download in the Project Files folder.

Tutorial, Video Tutorial
Adobe After Effects
mocha Tracks The Wolf of Wall Street

mocha Tracks The Wolf of Wall Street

With multiple VFX Oscars (Hugo and Titanic, plus a nomination for Apollo 13) plus a couple of Emmys (Star Trek: The Next Generation and Star Trek: Deep Space Nine) under his belt, the most remarkable thing about Rob Legato's latest VFX extravaganza is that it doesn't appear to have any VFX at all! Martin Scorsese's The Wolf of Wall Street is a masterpiece of what has become known as invisible effects, and this article from our friends at Imagineer, highlighting Rob's work with mocha, is a real eye-opener.

Editorial, Feature
Adobe After Effects
Klip Collective Pushes Film Into New Spaces At Sundance

Klip Collective Pushes Film Into New Spaces At Sundance

Projection mapping installation relies on Adobe Creative Cloud tools to create stunning visuals for the Sundance Film Festival entry, "What's He Building in There."

Editorial, Feature, People / Interview
Adobe After Effects
Joseph Kosinski’s Film “Oblivion” Showcases Elegant Effects

Joseph Kosinski’s Film “Oblivion” Showcases Elegant Effects

World‐class user interface designers, graphic artists, and animators create crisp, timeless visual elements for the sci-fi film starring Tom Cruise and Morgan Freeman, Oblivion. Kosinski turned to Bradley G. Munkowitz (GMUNK), whom he'd previously worked with on Tron Legacy. As lead interface graphic designer, GMUNK then pulled a team together that included Interface Graphic Designers Joseph Chan (Chanimal) and Jake Sargeant, and Interface Animators Alexander Perry (AP), Navarro Parker (Nav), and David Lewandowski (D-Lew). They were happy to reunite to share how much fun they had creating the 2D effects for the film using an Adobe workflow.

Editorial, Feature, People / Interview
Adobe After Effects
VFX & Motion Graphics on Star Trek: Into Darkness

VFX & Motion Graphics on Star Trek: Into Darkness

Andrew Kramer of Bad Robot and author/owner of the site Video Copilot was tapped to create more than 30 title sequences for the resurrection of the classic science fiction franchise with Star Trek: Into Darkness, while the OOOii team created stunning graphics and heads-up displays for the blockbuster film. OOOii CEO Kent Demaine, Lead Designer Jorge Almeida and Andrew Kramer shared their great experiences working on the latest seminal Star Trek film.

Editorial, Feature, People / Interview
Adobe After Effects
Delivering Content for TV's Top Shows

Delivering Content for TV's Top Shows

Delivering content for some of television's top shows, including House of Lies, Grey's Anatomy, and, of course The Walking Dead, Stargate Studios continues to break the mold of how feature films, television series, electronic games, and commercials are generated. In this article, read how Adobe Creative Cloud and automation create a competitive edge for the iconic production studio, Stargate Studios.

Editorial, Feature, People / Interview
MORE


FORUMSTUTORIALSFEATURESVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2014 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]