Showing posts with label berlin. Show all posts
Showing posts with label berlin. Show all posts

Saturday, 8 August 2015

Creating flat matte videos for chroma keying in Unity with Adobe After Effects

The time seems to be whizzing by lately - it only seems like yesterday we were filming our greenscreen zombie footage and it's already been nearly two weeks! Now we've a load of video footage, and plenty of work to do, to make it "game ready" (i.e. dropping out all the unusable background). We've loads of little clips, so we're starting small - but this is the main technique we used for pretty much all of them (and will continue with for future footage):

Here's a quick clip of Andrea wandering around, getting ready to shoot some zombies with his puny pistol.


As you can see, the background is hardly a perfect flat green (although it didn't quite look that bad when we were actually shooting the footage - the higher contrast of the output video makes the wrinkles in the screen really stand out!)


The footage is also "too big" - it was shot at 1920 x 1088 and included far too much footage, so we've had to crop the video and rescale to a more manageable 720 x 405, as well as trim out the unwanted footage both before and after the action we want to capture


After importing the video into After Effects, the final output render size was massive and there was a lot of unwanted extra footage.

We used the keyboard shortcut to "splice" the video footage at the current keyframe, using Ctrl + Shift + D. This not only creates a razor cut in the video, but splits it out onto two separate frames. Before cutting any footage, we rescaled the actual video and moved it around inside our composition window, so that only the actual footage we wanted was captured.


We made a cut at the start and at the end of the section of footage we wanted to keep. This split the video onto three layers, making it easy to select the bits before and after to remove them completely.

Now, we've had mixed success with the following technique, using the entire footage, so at this point we exported our video selection to a new, separate file, and imported it into a new project. As we've still plenty of work still to do with this footage, we exported it as uncompressed video without using any compression or using a video codec. This makes massive files (100Mb for 5 seconds) but does mean fewer compression artifacts and no blockiness in the new video.

Next we imported the newly rendered file and made sure that it filled our composition size of 720 x 405 (the earlier footage was much larger than this and needed to be cropped). Then, following the instructions at creativecow website (https://library.creativecow.net/articles/rabinowitz_aharon/junk_mattes/video-tutorial) we made the entire background transparent. The basic steps are:

With the video footage selected in After Effects, apply the KeyLight (v1.2) key chroma effect and select a green close to the actor (or one nearest the "average" green of the background).


After applying KeyLight chroma key, we can see that there are lots of imperfections in the footage that didn't get captured by the key colour.

This takes away most of the background, but still leaves semi-transparent shadows in the background. So now, we need to "trace" our actor to completely isolate them from the background. We do this by selecting the video footage and then Layer - AutoTrace and tracing based on the alpha of the channel.


Maybe 70% is a bit much, but it worked for this particular bit of footage, so we're sticking with it - expect to use values 50%-70%.

A short while after applying the trace (it takes a few seconds to go through every frame in the video) a new layer appears with an outline around the main character. We can scrub through the footage to make sure that it captures just our main character on each frame of the video and that nothing is either truncated, or left in when it should be removed.



Next comes the clever bit - we need to expand the outline a few pixels away from the main character, to create a green "halo" around the character. So we select the traced layer and then Effect - Matte - Simple Choker. Setting the choke value to a negative value expands the matte away from the main character. We went with something in the region of -25


Depending on your version of After Effects, you may need to locate and click the "Toggle Switches/Modes" button to enable the "track matte" feature on the original footage. Set this track matte setting to the traced layer (immediately above it).


What's the point of doing all this? Well, what it means is we're only using a traced area of the original footage now, for the chroma key - we've got rid of most of the (wrinkly, unevenly lit) green background, and we're only actually keying the "green halo" around our main character. It basically means we need a much less "harsh" keying setting to completely remove all of the remaining green background (since there is so much less of it to begin with).


What we've done so far is create a "junk mask" around our main character, so remove most of the background, but there are still a few little areas around him that are not quite right. Now we just need to play with the KeyLight Chroma Key settings to get rid of any extra artifacts around the outside of our main actor.

We set the screen gain to 110 and the Matte Black setting to about 15 and all of the artifacts were gone.



One thing we found was that with a slightly more "aggressive" setting to remove the green, we started to lose opacity on our main character. In particular, the body started to disappear, a bit like Marty McFly at the Enchantment Under The Sea Ball. It was quickly corrected by adjusting the Matte White setting down from 100 to about 80.

The final step is to simply export the video footage to a format that supports RGB+ (or RGB+Alpha or 32-bit RGBA colour). For this project, we went with Quicktime as it created the smallest files (about 2.5Mb for our 5 second video). To ensure that the video plays back ok in media players that may not support alpha transparency, we double-checked that our composition settings had a bright green (#00FF00) background. Where alpha channels are supported, the video should play back with a transparent background. Where they are not, a flat, matte, solid green background should appear.



Gone are those nasty greenscreen wrinkles and badly-lit backgrounds! Our video footage is now "game ready".


With our footage now "game-ready" all we need to do is drop it into a game engine that supports alpha videos (Flash has been able to do this since about version 7 or 8) and place the appropriate background bitmap behind it.


The absolute worst case scenario would be to use Flash or Unity (or some other gaming engine) to chroma key out the green at runtime, now that we've got it a nice, solid, uniform bright green throughout the entire video...




Sunday, 2 August 2015

Not all zombies are scary

In fact, looking over the video footage from last weekend's quick-and-dirty video shoot, it would seem that not everyone was taking it entirely seriously at all times either!



Wednesday, 29 July 2015

Last Night In Zombieville - video production

It's of no surprise to regular readers that we're currently putting together an electronic board game, which includes playing piece tracking and an app for PC, tablets and smartphones. The idea is that we can use the same hardware for multiple games, covering multiple genres, and using lots of different rule sets.

On of our more ambitious ideas is the game "Last Night in Zombieville" - an interactive movie-based board game. Like interactive movies of the early nineties, we'll have a number of clips which are played in sequence, depending on the actions of the players.

So this weekend, a few of us hopped over to meet up with fellow nerds in Berlin for three days greenscreen video filming.



Andrea plays one of the hero characters who has the possibility of being turned into a zombie, so had twice as much work to do as the others! Here he is, playing the hero, waving around a big scary (replica) gun.



Sarah has been a make-up artist on quite a few independent horror/zombie movies (as well as being quite a proficient children's face-painter for festivals and parties) and made a great job of turning Andrea into one of the living dead.


The blood and gore were not only completely edible - being made from little more than summer fruits and food colouring - but, this being Berlin, we also completely organic and ethically sourced!

Right now, we've half-a-hard drive of video footage that needs some serious post-production to get it ready for adding to our game engine. There's enough to keep even a few of us busy for quite a while yet....

Wednesday, 8 May 2013

Screen printing PCBs

It's official - making a homebrew screen from a bit of left-over silk, stapled to a picture frame and masked with pound-shop parcel tape, not only works, but works really well! On our frame we had a stencil of the pcb tracks, and a stencil for the solder mask. We started by covering one half of the screen with parcel tape...


... then swiped some acrylic paint over the other half of the screen:


In seconds we had a dozen or more perfectly printed PCBs (on test paper admittedly, not copper board, but it proved the concept)


Knowing we could now rattle out PCBs quickly and easily, the next thing to do was make sure the second print lined up with the first. Here we used red acrylic instead of the expensive solder mask paint:


They actually lined up pretty good. Not perfect (but then the screen wasn't fully taught and the board was lined up by eye) but not bad at all. It'd make a perfectly workable PCB!


All in all, we're calling our screen-printing test a success.
We got a screen made and using acrylic paint, quickly and easily printed a number of circuit boards in seconds. When it comes to making batches of PCBs with the same design, this is definitely something we want to use, in place of sending designs off to China!

Tuesday, 7 May 2013

Nerds in Berlin (again)

We've been here in Berlin for a few days - in the salubrious district of Kreuzberg - and slowly getting to understand (some) of the appeal. It has many similarities to Brighton: only a grubby, dirtier, graffiti-strewn version - and no seaside. The last time I came, I hated it. This time, the weather is better, there are more people about, and we've met some really cool characters. Kreuzberg is still a dirty, rotten area of Berlin, but - as with so many places - it's the people that make the city, and we've met some pretty cool ones!

One of the more exciting things about our short visit was visiting the drop-in print making workshop. There are places like this all over Berlin: places that hackerspaces should be aspiring to. It's basically a shop where you turn up, explain what you need to do and they supply the parts, materials, equipment and (where it's needed) expertise to help you get the job done.


The shop is open an manned by staff five days a week; there's a massive indie/punk subculture in Berlin where people make their own t-shirts, fliers and cd/album covers, mostly using screen printing. Everyone seems to know someone who knows screen-printing! So we took ourselves along to see how it all works.

Andrea made up a simple screen by hand-stretching some medium-grade silk over an A4 sized picture frame and stapled it along each edge. Although you can get machine-stretched frames, this hand-made one seemed pretty taught, so we thought we'd just give it a go. At the print-shop they provided the photo-sensitive emulsion. It's ready mixed, so you just need to put a thin film on your screen and leave it to dry.


the photo-emulsion is a bright lime-green colour. When it's "baked" it goes a dark, leafy-green colour.

A thin film of paint is dropped into a trough (it's expensive stuff and is difficult to re-use, so only the smallest amount needed is taken out of the pot) and the trough is swiped quickly up both sides of the silk - working vertically, from bottom to top


The aim is not to place a film on the surface of the screen (although this may happen) - it should be as thin as possible and we're just trying to get the emulsion to fill the gaps in the silk. Sometimes the paint doesn't get quite into the corners, which is why the screen needs to be oversized: our frame is for an A4 picture so is actually a little larger than A4, all the way around


While the screen was drying, in a dark, warm room, we set about preparing the artwork. Some PCB circuits were laser-printed onto 100gsm paper (not acetate as we were expecting). The paper was then coated with cooking oil (rapeseed I think) and it magically turned translucent: a handy tip to remember for future screen printing - much cheaper than expensive acetate sheets!

we weren't sure, so coated both sides of our sheet with oil

About half an hour later (or however long it takes to drink a coffee in the sunshine, at the cafe opposite) and the screen was ready for exposing. We placed the image onto the exposure bed, then the screen on top and turned on the vacuum to help remove any air bubbles trapped between the image, screen and glass bed. It took a good ten minutes - but only because the exposure box was absolutely massive!


Matt at BuildBrighton always wanted to make a large exposure bed - but this one may be outside even what he was dreaming of!

A4 on medium-guage silk takes about ten minutes to expose, apparently. So after ten minutes, we took the screen out and blasted it with a high-pressure hose. The screen wasn't as dark as we'd expected (but apparently the emulsion continues reacting in sunlight, so is yet to get a bit darker) but after a minute or so of washing, the magic started to happen. All the "unbaked" emulsion washed away and we were left with a perfect copy of our PCB design on the silk:

(our pcb design was only eurocard sized, so we put a solder mask on the bottom half of the screen)

All in all, an amazing success.
The whole thing cost less than five euros and we got help and learned a lot about the how and why of screen printing. Why the screens need to be larger than the image, why different meshes are needed for printing onto different surfaces and so on.

It was a really interesting few hours and has given us a lot of confidence with our own homebrew screen printing rig. Of course, you can use professionally manufactured screens (there were some machine-stretched screens at the workshop which were tighter than a snare drum skin!) and spend a lot of money getting everything "just so". But you can also fudge it with some cobbled-together gear and a bit of know-how. And that's what got us excited.

All we need to do now is go back and see if we can actually print an image with the screen!


Wednesday, 14 December 2011

Back from Berlin

We've not really spoken much about our few days away in Berlin. Neither online, nor between ourselves. Which is a shame because we were really excited about going there and visiting a few of the different hackspaces. The problem was that the Kreuzberg region of Berlin where we were staying was pretty rough. And the so-called "hostel" we'd be invited to was little more than a doss-house squat.

After just a few days of living in squalor we changed our flights and came home. We never got to see any of the different 'spaces we'd planned on visiting scattered around the city (we'd arranged to visit the betahaus the morning after we'd arrived, which is also in Kreuzberg but got lost trying to find it!)


Graffitti is everywhere in Berlin - and especially so in Kruezberg. There are very few pictures or pieces of artwork (as shown in this photo) mostly it's mindless scrawlings, tags drawn in marker pen, and political slogans written in English.



There's a difference between "post-punk-industrial-style" and just filthy squalor. Coupled with a three-day "festival" during which thumping drum-n-bass played from midnight 'til around 10am (meaning no-one slept for the duration of the trip) we'd had enough after just a few days! Needless to say, it'll be some time before we endure another EasyJet flight to Germany's capital city!

Monday, 28 November 2011

The nerds are off to Berlin!

Ok, it's only for a week or so, but we've confirmed our tickets for early next month (December). And a quick look on hackerspaces.org tells us that there are no less than 12 hackerspaces, in Berlin alone!
We won't have time to visit all of them (unless we go to three different ones on each day we have free) so we'll have to concentrate on English-speaking spaces for now (a few of us can speak French to an ok level, but German is a whole new language!)

Woo-hoo, Europe here we come!