5 Replies Latest reply on Mar 29, 2018 6:30 PM by stib_at_work

    Random Seed for Essential Graphics Motion Graphics Template

    Oz Mzw Level 1

      I am making a Motion Graphics Template for use in Premiere.

      The problem I am trying to solve is to have a straight in multi-line text animation where the order of the lines are randomized (using Randomize Order in the Range Selector) every time the template is used.

       

      I now use the following expression in the Random Seed of the Range Selector (thanks Dan Ebberts!):

      seedRandom(index,true);
      myValue = random(0, 1000) ;
      [myValue];
      

      This creates a static Random Seed, but it stays the same on all computers and instances of the template, thus making the animation order of the lines the same every time.

       

      Is there a way to solve this so that every instance of the .mogrt in Premiere gets a unique random seed?

       

      Thanks for any input.

       

      -Oz.

      After Effects CC 2017.2

        • 1. Re: Random Seed for Essential Graphics Motion Graphics Template
          Mathias Moehl Adobe Community Professional

          Instead of using index in seedRandom, you could link to a slider. Then the template user can choose a random seed (i.e. whenever he moves the slider to a different value he gets a different randomness).

          There is no way to let the exact same template behave differently on different machines. Think about it: it is really essential that a template always behaves in the same way, no matter on which machine it is. Imagine a template being rendered on a render farm - each frame by a different machine. Would be really bad if all of them would have different random seeds.

          1 person found this helpful
          • 2. Re: Random Seed for Essential Graphics Motion Graphics Template
            Oz Mzw Level 1

            Thanks Mathias, that is very helpful.

             

            I don't think I will introduce a random seed slider for the user, though – if they see something they don't understand they'll just stop using the templates altogether (in my experience).

            But maybe I can find a way to generate a unique slider value anyway. for example by somehow converting Date() into an integer or something. If someone has a solution for something like that I'd appreciate it.

             

            I agree about the principle of of things behaving the same way in most cases. In the context of templates, though, it would be awesome to have the ability to create things that are a bit more "generative". I don't see why there has to be a conflict between those two things, necessarily.

            • 3. Re: Random Seed for Essential Graphics Motion Graphics Template
              Mathias Moehl Adobe Community Professional

              I highly recommend not trying something like that. Imagine a user being happy with your template and rendering it. Then rendering it two days later again because he needs to do some final tweaks or needs the same video in a different format. The user will not be happy if the same video looks different when rendered two days later. That would really be a reason for people stop using your templates. Not to mention what would happen if a video renders over night and the first half uses a different randomness than the second one. If you need randomness make it transparent, i.e. expose it to the user.

              1 person found this helpful
              • 4. Re: Random Seed for Essential Graphics Motion Graphics Template
                Oz Mzw Level 1

                Good point, duly noted.

                I still think it would be unproblematic in my specific case I, but it seems like a sensible principle to have.

                • 5. Re: Random Seed for Essential Graphics Motion Graphics Template
                  stib_at_work Level 2

                  While I agree that this might cause confusion and anger for the user, for reference here are a couple of ways to get unique random seeds.

                   

                  Method 1: JS String methods are a gold mine. You could also use the comp name, and turn the ascii code of the characters into the seed, using the string method charCodeAt() like thus:

                   

                  var n = thisComp.name;  
                  var randoSeed= 0;  
                  for (var i=0; i<n.length; i++){  
                       randoSeed += n.charCodeAt(i);  
                  }  
                  

                  This will return a unique random seed for every comp (as long as it has a unique name). To personalise the seed per layer you just add the index of the layer. Pretty much all of the standard string methods that work in a browser work in expressions.

                   

                  Method 2:  It's a little known fact that you can use the javascript Date() object in expressions. I use this to make sure that copyright notices in templates are always set to the correct year. But with just a little hackiness we can use it to generate a random seed that will be different every day the comp is opened. As discussed (full disclosure: my blog) here, you can call Date(0) to return a string with the current date, formatted like this: "Thu Mar 29 2018 23:50:06 GMT+1100 (AEDT)". So with the help of the string method match() you can get say, the day to use as a random seed like this:

                   

                   

                  var d=date(0);  
                  var randoSeed=d.match("[A-z]+ ([0-9]+)")[1]  
                  

                   

                  Of course that would cause problems if the render was started a 11:59 pm, as the seed would change on the stroke of midnight. Remember that this is the date and time seen by the OS, not the time property of the comp. You could of course have it change on the hour, minute, or second too, if you can work out a situation where that would be useful (I can't). There is one killer use for this hack that I'm dying to have someone ask me to do, which is time-stamping each frame with its render time. I don't know why you would ever want to do it, but it's good to know how.

                  1 person found this helpful