Return-Path: Received: from mail-qe0-f52.google.com ([209.85.128.52] verified) by media-motion.tv (CommuniGate Pro SMTP 4.2.10) with ESMTP-TLS id 5284999 for AE-List@media-motion.tv; Wed, 13 Nov 2013 21:39:53 +0100 Received: by mail-qe0-f52.google.com with SMTP id cz11so162564qeb.39 for ; Wed, 13 Nov 2013 12:41:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=3Qe2f2xruh3Vn16CzPg58a+xA5rKyuEUFGnChKoJa8w=; b=XvVZBxxc3Stqm/ZlK0vUTBJK3+nCcaXimF2HiDXBg3hjRZ6lF4lcIbxBT+Grd5j+lC sWE3E4g1njMr7C7328JJ05irWyAakceHeCPdCXgPO3CYZAx0DZIOGFS+8OPGcPg/NRWF oJDfCIyMlHYSYbHAeBQsOSPb5wGO0lCkmnOQmUyLbqjbckj3V1UUudTrUsZjzQXso4bV 4PC8TcQpl8ljNvYqPsbuueAQjEg4jbb/acWqH/Wc+8709mf9/93+f+1KPNMh5VWe93Oq /esJna3STQQH9iQ9nalD/YpvTCPi7kkIaLFUDsQB+MDFxAeWqdewciV9vs/+xMPNaA7x 0Afg== MIME-Version: 1.0 X-Received: by 10.49.98.133 with SMTP id ei5mr1192049qeb.19.1384375280266; Wed, 13 Nov 2013 12:41:20 -0800 (PST) Received: by 10.229.104.131 with HTTP; Wed, 13 Nov 2013 12:41:20 -0800 (PST) Received: by 10.229.104.131 with HTTP; Wed, 13 Nov 2013 12:41:20 -0800 (PST) In-Reply-To: References: Date: Wed, 13 Nov 2013 15:41:20 -0500 Message-ID: Subject: Re: [AE] freeze frame from precomp - expression needed to not get duplicates From: Greg Balint To: After Effects Mail List Content-Type: multipart/alternative; boundary=047d7bdcac7ed11b6304eb14fc52 --047d7bdcac7ed11b6304eb14fc52 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable This is what I ended up doing. I also added a number driven by an expression slider to the index. Between each camera change I change that slider a good bit and it gives me a fresh pool of faces, ensuring they all get used eventually. Thanks for the help! ///Greg Balint //Art Director / Motion Graphics Designer /321.514.4839 delRAZOR.com/ On Nov 13, 2013 2:06 PM, "rendernyc" wrote: > which is why using index numbers on consecutive layers to map to the time > of the layers in the precomp is a good way to go. each index will give yo= u > a unique image > > > On Wed, Nov 13, 2013 at 1:57 PM, Byron Nash wrote: > >> I've written something like this in script form(Fisher-Yates) although I >> did not know it had a name. I can't think of a good way to do it with >> expressions without killing the render. It would need to go through many >> iterations for each layer on each frame to get it going. I imagine with = 125 >> layers you would start to get speed issues. >> >> >> On Wed, Nov 13, 2013 at 6:35 AM, Chris Zwar wrote: >> >>> Grrr sorry, I decided to google my own suggestion and discovered I was >>> wrong. What you need is a Fisher-Yates algorithm: >>> >>> http://en.wikipedia.org/wiki/Fisher=96Yates_shuffle >>> >>> Luckily there's plenty of examples on the web, and it seems that writin= g >>> a script to shuffle cards is a common task given to computer students, = so >>> if you think of your 300+ faces as a deck of 300 cards then you should = be >>> able to google a solution sooner or later. >>> >>> >>> -Chris >>> >>> >>> On 13/11/2013, at 10:23 PM, Chris Zwar wrote: >>> >>> This question has come up before, and I remember someone else explainin= g >>> that you will need to use a custom random number generator, and not jus= t >>> the generic random expression. As you have realised, the problem with >>> random() is that even though the numbers are random there is nothing to >>> stop the same number being randomly chosen more than once. >>> >>> You need to use a "monte carlo" random number expression, which I don't >>> have and am not sure where you find one. I think the algorithm is norm= ally >>> used to shuffle a deck of cards, hence the name. I guess when you want= a >>> computer to create a random deck of cards it's important to know that e= ach >>> card only appears once! >>> >>> It might be quicker to do it manually. >>> >>> HTH >>> -Chris >>> >>> On 13/11/2013, at 9:18 AM, Greg Balint wrote= : >>> >>> Got a quick one here.. something i'm probably just either not familiar >>> with, or I'm thinking too hard about it. >>> >>> I've got a large grid wall of squares with people's faces in them. Eac= h >>> face panel is the same precomp with this expression in the time-remap >>> attribute. >>> >>> seedRandom(index,true); >>> myFrame =3D Math.floor(random(303)); >>> framesToTime(myFrame) >>> >>> Basically this grabs a random frame from the precomp, which is about 10 >>> seconds long, and shows it as a freeze frame for that particular layer. >>> >>> I've got 125 face panels all using this expression, and for the most >>> part it works wonderfully.. they all have random faces on them, and if = I >>> add another layer, the random seed changes and I get a whole new slew o= f >>> faces (which doesn't matter in this instance, but i could see that as a >>> problem in others) >>> >>> My issue is, even though I've got over 300 frames (each frame with a ne= w >>> face) in my precomp.. the randomness is grabbing duplicates.. in some c= ases >>> 2-3 pairs of duplicates over the course of the 125 it chooses. >>> >>> >>> Anyone know of a way to append this script so that it does not choose >>> something it has already? >>> >>> I'd even be fine if there were a way to use an expression to grab frame= s >>> sequentially from the precomp and then I could just hand choose to make >>> sure there's no duplicates in the first 125 frames. >>> >>> I think i might just be overthinking this, but I'm not sure if I've see= n >>> a "check for duplicate and don't use" sort of expression before. >>> >>> thanks in advance. >>> >>> -- >>> >>> ///Greg Balint >>> //Art Director / Motion Graphics Designer >>> /321.514.4839delRAZOR.com/ >>> >>> >>> >>> >> > > > -- > danny princz > > vimeo.com/rendernyc > --047d7bdcac7ed11b6304eb14fc52 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable

This is what I ended up doing.

I also added a number driven by an expression slider to the = index. Between each camera change I change that slider a good bit and it gi= ves me a fresh pool of faces, ensuring they all get used eventually.

Thanks for the help!

///Greg Balint
//Art Director / Motion Graphics Designer
/321.514.4839
delRAZOR.com/
=A0=A0=A0

On Nov 13, 2013 2:06 PM, "rendernyc" &= lt;rendernyc@gmail.com> wrote= :
which is why using index numbers on consecutive layers to = map to the time of the layers in the precomp is a good way to go. each inde= x will give you a unique image


On Wed, Nov 13, 2013 at 1:57 PM, Byron Nash <byronnash@gmail.com&g= t; wrote:
I've written something like this in script form(Fisher= -Yates) although I did not know it had a name. I can't think of a good = way to do it with expressions without killing the render. It would need to = go through many iterations for each layer on each frame to get it going. I = imagine with 125 layers you would start to get speed issues.


On Wed, Nov 1= 3, 2013 at 6:35 AM, Chris Zwar <chris@chriszwar.com> wrote= :
Grrr sorry, I decided to google my own = suggestion and discovered I was wrong. =A0What you need is a Fisher-Yates a= lgorithm:


Luckily there's plenty of examples on the web, and = it seems that writing a script to shuffle cards is a common task given to c= omputer students, so if you think of your 300+ faces as a deck of 300 cards= then you should be able to google a solution sooner or later.


<= div>-Chris

On 13/11/2013, at 10:23 PM, Chris Zwar <chris@chriszwar.com&g= t; wrote:

This ques= tion has come up before, and I remember someone else explaining that you wi= ll need to use a custom random number generator, and not just the generic r= andom expression. =A0As you have realised, the problem with random() is tha= t even though the numbers are random there is nothing to stop the same numb= er being randomly chosen more than once.

You need to use a "monte carlo" random number expr= ession, which I don't have and am not sure where you find one. =A0I thi= nk the algorithm is normally used to shuffle a deck of cards, hence the nam= e. =A0I guess when you want a computer to create a random deck of cards it&= #39;s important to know that each card only appears once!

It might be quicker to do it manually.

HTH
-Chris

On 13/11/2013, at 9:18 AM, = Greg Balint <delrazoraelist@gmail.com> wrote:

Got a quick one here.. somet= hing i'm probably just either not familiar with, or I'm thinking to= o hard about it.

I've got a large grid wall of squar= es with people's faces in them. =A0Each face panel is the same precomp = with this expression in the time-remap attribute.

seedRandom(index,true);
myFrame =3D Math= .floor(random(303));
framesToTime(myFrame)

Basically this grabs a random frame from the precomp, which is about 10 = seconds long, and shows it as a freeze frame for that particular layer.

I've got 125 face panels all using this expression,= and for the most part it works wonderfully.. they all have random faces on= them, and if I add another layer, the random seed changes and I get a whol= e new slew of faces (which doesn't matter in this instance, but i could= see that as a problem in others)

My issue is, even though I've got over 300 frames (= each frame with a new face) in my precomp.. the randomness is grabbing dupl= icates.. in some cases 2-3 pairs of duplicates over the course of the 125 i= t chooses.


Anyone know of a way to append this scri= pt so that it does not choose something it has already?

I'd even be fine if there were a way to use an expression to grab= frames sequentially from the precomp and then I could just hand choose to = make sure there's no duplicates in the first 125 frames.

I think i might just be overthinking this, but I'm = not sure if I've seen a "check for duplicate and don't use&quo= t; sort of expression before.

thanks in advance.

--
///Greg Balint
//Art Director / Motion Graphics Designer
/321.=
514.4839
delRAZOR.com/ 






--
=
--047d7bdcac7ed11b6304eb14fc52--