Jump to content

Yet another Chroma Key Composition Tutorial (Greenscreen)


ValKalAstra
 Share

You are about to reply to a thread that has been inactive for 213 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Alright, sat down for a quick minute or two! This is meant for Second Life and the pictures will be from the Firestorm Viewer. It will also be using Krita - because that's a free and powerful piece of software and I am a firm believer in learning the tools and concepts first before buying anything. With that out of the way. I'll first get into setting up a greenscreen and then will also list an alternative.

Chroma Key

The basic idea behind chroma key compositing is to pick a colour that is neither represented in the image nor adjacend to any of the colours present. In common use, this is usually a very aggressive green colour, lending itself to the colloquialism green screen. However it's important to note that every colour can work for this and in fact, sometimes it is necessary to pick a different colour. Got a green top? Greenscreen ain't doing it that day.

So ideally you want a colour that is not found in the image. Furthermore, you want that colour to be as clean as you can get it. We'll get more into what that means for Second Life in a hot minute.

Setting up the screen

First, you want the actual screen. Let's make ourselves a nice little prim that we can lug around, attach or rez as needed. Find a Sandbox or use your own home territory, doesn't matter as long as you can rez something. You'll want to make a basic prim. Right click on the ground, create and then pick the cube icon. You'll rez one of the standard prims and I'll run through what settings you pick and why.

In the General Tab:

  • Give it a name. Any will do, it's just so you can find it again because my inventory is a black hole and these things vanish somewhere :P

In the Object Tab:

  • Give it a decent size. Doesn't matter much, just needs a starting value, you can always change it here later. You want it big enough that it covers your screen when you are posing in front of it. Personally I use:
    • X: 8.0
    • Y: 0.05
    • Z: 4.0

In the Texture Tab:

  • Check [X] Full Bright. Reason being, you want the chroma key to be uniform in colour. That means you want as little noise on it as possible. Light and shadow creates noise. Full Bright avoids this.
  • Leave Transparency and Glow at 0. Especially Glow. Same reason. No noise.
  • Color - Remember what I mentioned above. It needs to be a colour not otherwise found in the image. Click the white bar. You can then either enter the seperate values for the color in the color picker or just paste the hex code into the Hex Tab of the color picker.:
    • Green
      • Red: 0
      • Green: 177
      • Blue: 64
        • or Hex: 00b140
    • Blue
      • Red: 0
      • Green: 71
      • Blue: 187
        • or Hex: 0047bb
  • Texture - Remember, we want as little noise as possible. Thus the texture has got to go. Click the wood texture and in the new window select "Blank".

It should look something like this:

setup1.png.d6b89489157d1e01271c4cab3e8a5e06.png

You've now got your fancy greenscreen. In case you're not familiar with how to move the object, you can select it and then either drag the arrows to reposition it or hold the CTRL (control key, bottom left usually) and then rotate it by dragging the circles. Should both fail, you can also manually tweak rotation in the Object Tab. You can rez this at any time you have got the rights to rez and if not, you can attach it to your avatar too! In this case, right click the new item in your inventory (pick it up first, maybe :P) and then select "Attach To >" and pick Avatar Center. Why the Avatar Center? Because that's the node of your body that isn't moved with animations and poses.

Setting up the Viewer

Alright, we're not done yet! Remember, we want as clean an image as possible and this needs a few more steps. The next steps aren't a surefire way as it's often a complex interlocked mesh of settings and it's sometimes hard to tell what is causing noise in your image or not. Luckily, in Firestorm you've got a Phototool for that purpose! You can click World, Photo and Video -> Phototools. Although if you're going to use it often, I recommend setting up your toolbar for it. In this case, click Avatar - Toolbar Buttons and then drag the icon for Phototools into one of the four corners of your screen to pin it there.

Now, which settings can cause noise? Most of them weee. Okay that's not helpful. Remember: You want as little noise in your picture as possible and almost all of the settings can introduce noise into your picture if configured in a certain way. However from my experience, glow and ambient occlusion are the biggest culprits there. Let me show you what I mean. For this I gave the greenscreen a glow value (don't do that) to demonstrate this:

setup3.png.20d7c5c86767e1c10784190d11bc5883.png

If you notice that the screen is bleeding into your avi like this, you will want to check for sources of glow or set iterations to 1 in the DoF/Glow Tab. Obviously if you rely on glow to make certain details pop (such as cybernetic lights and such) you'll have to tweak the settings here until you find one that doesn't bleed into your avatar. Likewise, Ambient Occlusion can lead to noisy fake shadows under certain conditions. If you notice odd visual artefacts or anything not uniform, do check your Ambient Occlusion as well. I wouldn't recommned turning either off, just... tweaking them as needed.

But first though, take the shot! If you can, try to take these at high resolution because the more pixels it has got to work with, the easier it will be in the end.

It's time to head into Krita!

What's Krita? Well, you know but someone else might not. It's a free graphics editor you can find here: https://krita.org/en/

Using Krita

From here on, we've got a few different options how we want to go about this.
First, there's a very good short video on this from Katverse, if you're the type that learns best with a video. You can find it here: https://www.youtube.com/watch?v=vp-zSFOnH0I

In case you're not, the method shown in the video works really well but has got a fundamental flaw. It's what's called destructive editing. Sounds dire but essentially means that you destroy parts of the image. In this case you destroy the parts you don't want - but it's generally a good idea to keep that around as long as you can and edit it in a way that allows you to always go back and tweak things. You can't do that with destructive editing. So, let's start!

Open Krita and select your image. It will probably look something like this:

setup6.png.b2178299c2a03b57929b1b85f22f9a27.png

Hi! What we are going to do is be a bit cheeky. First, on the right, see the Background Layer? Selected and blue? Right click it and select "Split Alpha" -> Alpha into Mask.

setup7.png.7685470efd745fa12855f36a6cbce21b.png

Masks work in a simple way. Every black will become invisible, everything white will be visible and the values inbetween are various degrees of transparency. You are going to need to get familiar with the colour selector shown here:

setup8.png.9caee9c827a3c4cfca9cdc272637091d.pngYou can go and experiment a little. Remember, dark colours turn that part of the layer transparent and bright colours make it visible again. From here on out, we're good to go. The basic workflow in this step is to switch back and forth between the Background Layer and the attached Transparency Mask.

We'll need this tool here: setup9.png.affaa1473c27e5ca939560c3ee1adcae.png

It allows you to select a color. You can now select the green and will have selected most of it. In some exceptions, you may need to tweak the settings of the tool. In which case, you will find them in the top right corner under Tool Options. It would go beyond this tutorial go go through all of them here though.

Either way, let's use it!

 

 

  • First - Select the Background Layer as that is where we want the color information from.
  • Second - Select the Color Selection Tool.
  • Third - Click any green spot.

setup10.thumb.png.c8cb6bfa564deed70780f89b07274530.png

Next, select the Transparency Mask on the right. Remember - every black in the transparency mask becomes transparent. Thus we now want to paint the selected area black, thus turning it transparent. You'll want the fill tool as a first step: setup4.png.62f539a4a9d71e70259df4c3884289d3.png Grab it. Top right, set the colour to black and then click any of the green areas.

setup11.thumb.png.0cfba15e84a43831427d6e7ea88bc05e.png

Keep clicking the green areas until you're left with little frayed areas.

setup12.png.effc52588ab2c781c7f44123b8257b42.pngWe definitely don't want that. Now some masochists might head out and handpaint every single strand and yah, sure you can do that. Or you can make it much easier on yourself. First. Make a new layer. Click the plus icon below the layer selection and you will get a Paint Layer. First, click this little α (alpha) icon on that layer so it looks like this:

setup16.png.55bb97e85a0757fc6155e29dec84112b.png

This means it will inherit the alpha from the layer below. Useful - because now we can grab a brush and paint over! Next, do you see where it reads "Colour" for me? It will say Normal for you. Click Normal while the Paint Layer is selected and pick Colour. With that we're almost good to go. Deselect your selection (right click, deselect) and then let me show you the final two tools we need.

 

setup14.png.c7afbe658bd68686a4ca1851a699e129.png Color Picker

setup15.png.6e451d015054836d0677527710739768.png Brush

Got it? okay! Let's roll. Select the colour picker and pick a colour next to the green areas. Then switch to the brush and while in your paint layer - just plain paint over it. You'll see something like this now:

setup17.png.a151f997ff84d1a098c234d3616fe9a7.pngGood but still looks like the dog chewed it up. Don't fret, this is why we're doing non destructive editing here. Remember how we created the transparency mask earlier and how - repetition, wee - black is transparent and white is visible? The chewed up effect here is because the selection tool was a bit overzealous. So let's head back to the transparency mask and grab the brush, pick white and set it to a smaller size with an opacity of something like 40% then... get painting.

You don't need a good eye, you don't even need to be careful because we can always just paint it back in with the inverse color. And... that's more or less it.

 

 

Et voilá:

 

lazyfinal.png.855f8cef12c6bb4738d16d2494e0efe3.png

Where's the rest of the damn image, Nina? Don't know. Sue me, I am lazy!

Questions? Shoot!

(Been at it for a while so if any part is a bit sparse in info, skips important steps or needs more details, please let me know and I'll fill it in).

Edit: A second part about how to continue from there will follow tomorrow or Friday, depending on time. Sorry, forgot to mention that.

Edited by ValKalAstra
  • Like 2
  • Thanks 4
Link to comment
Share on other sites

And here's the second part. How to make use of that isolated image because that's a bit of a science in itself. If you take your image and paste it into photo, you're immediately going to notice that it looks out of place and there are several reasons for that. The two central ones are:

  • The lighting is all wrong
  • Colours don't blend

So let's get to it! Although holdup, confession time. When I wrote the previous part of the tutorial I hadn't planned to do this part until a friend told me "yah and where do I go from here?". You see the picture I took last time works perfectly fine for a flat background like the forums. There's very little in the way of shadows - it's a pretty flat picture in terms of colors. The second you put that into a photo or something else, you're going to run into the trouble of having to hand paint lights and shadows and that's just a huge pain. Let's be a bit more efficient about it this time around.

So let's say you've already got a background in mind. For this example I am going to use a free photo from here as the base: https://unsplash.com/de/fotos/ein-feldweg-mitten-im-wald-kjFFsaexpGs

License checks out as: Free use, commercial and uncommercial use, attribution appreciated, can't resell without significant changes, can't be used on a competing image service. Give or take, losely translated - I'm no lawyer. Always read these on the og source yourself. Either way, sounds good for my purposes here. So you've got this absolutely beautiful picture and want your second life character to be in it.

Let's look a bit closer at the image:

setup1.png.212fac4ebc76a4b940b92f29ab176b8b.png

Most striking is a strong and warm light in the back. You can actually use the color picker I have shown in the previous post to get the precise information. Just click somewhere with typical light for the scene - and then in the top right, you can switch your colour selector to Tool Options and then read out the RGB values, like here:

setup2.png.6863f4cd2f78ae958b18c3d3ca2d3dd0.pngWe can already tell that we are going to need a strong backlight for this. Any object in the scene will have a strong light in the back, strong enough to cause a light halo around the trees. We can use that information in several places. For now, it informs us about where and how we want to light our avatar soon.

The shadowcasting is a bit hard to make out here but that's alright, because we already have got such a strong light source that it's kind of obvious from where the light is coming. It's a hunch but with the bushes so deep in shadow, this is likely cast from a sun close to the horizon and with the fog and haze present - this looks like a lovely morning scene. Don't worry if this isn't exact. Some images will naturally have much more pronounced shadows than others.

Yet still, we have got a strong light source and a vague idea that the light is coming from the image left at a low angle. This is information that we're taking into SL. I'm going to show you an alternative to using a strict greenscreen that will however follow the same basic principles. You can do this with the greenscreen just as well but why not use the chance to learn something new?

Alright, hello Second Life!

setup4.thumb.png.d428efc998db473c7d153aedd979b32f.png

 

 

 

 

 

 

 

 

 

You may notice that I am floating in the clouds and there's a reason for that. We're going to use EEP and personal lighting to prepare our avatar and this works best when you're somewhere unobstructed by anything that can cast a shadow on you. This doubles as a very cheap alternative if you don't have got the option of creating your own sets. Just fly up somewhere, load the pose and use personal lighting. setup5.png.e380e29e16fc8430507ca16e63c0c72c.png And click Personal Lighting.

In this case I have used above RGB code to give the Sun the right color and then positioned it close to what the target image has got. Almost immediately we're seeing a problem.

setup9.thumb.png.8866a7e29ab96717a7cd2e805dbce6c0.png

We're gonna need us some more light. We've got the highlights but one side of my avatar is obviously way too dark. There are now various ways on how to go about this. Some prefer to continue using the Personal Lighting and tweak the Ambient Color. I personally find that this quickly tends to drown out any details but others have great success with this. Give it a try, find your own balance there.

I suggest using a different approach. We're going to take four screenshots and we are going to use prim lighting.

  1. Normal
  2. Highlight
  3. Shadows
  4. Depth

So prim lighting is what happens if you create a prim like in the first part and then configure it to emit light. There's a whole lot you can do with this but in this tutorial, we're just going to use quick omnilights. Let's set that up first. Create three prim in a sandbox somewhere. Like in the first guide, right click, create and click. Give it a name and then head on over to the faetures tab.

setup11.png.cdd6cd2ef3a3798a972552fa2226f4ad.pngThe settings you want are at the bottom. Check [X] Light. Click the color and here you can set which colour the light will have. In the example, I have configured it to be the same type of light as we have in the image we want to put our avatar in. Since we will only be using an omni-light and not a projector, ignore FOV, Focus and Ambiance.

Intensity is how strong the light will shine. Radius and Falloff govern how far it shines and how quickly the intensity falls off. We're going to create:

  • One Light for the Sun
  • One Light for the Shadows
  • One Light to fill

Here's how I have set mine up for this example.

setup12.png.e7670d01c88ff10074bfc926647a41b0.png

 

One light in the back mimicing the direction of the sunlight. One light opposite it with a darker colour to simulate shadows. I've opted for a dark turquise color in this. The third light is a fill light. This is used to smooth out harsh shadows on the body and uses the same color as the light in the back just with less intensity. The resulting image will be our normal shot. Take a snapshot (Avatar -> Snapshot, Save As). Next, switch to a completely dark EEP like, say Phototools - No Light. Alternatively you can just set the sun color and ambient to black.

What we are goint to do now switch off all the lights except for one.

First the Highlights. For this, turn off the light that casts the shadow and the fill light. Take a snapshot like you would normally do.

Next, the Shadows. It may seem weird to do that because obviously, how are you going to capture the lack of light? But the reality is that shadows are rarely just black. There's always some bounce light bleeding in. That's what we simulate with the shadow light we made. So, turn off the prim for the sun light, turn off the fill light and then take another shot. The fourth shot will be of the depth map.

setup13.png.b85b92faf90a767b1b7c4f16c17776af.pngIn the Snapshot window, select the drop down menu with "Color" and select "Depth", then save this too. The reason we're saving the depth map as well is that you can do fancy things with it. In more complex scenes, you can actually use this to more finely control the depth of field effect via your editor. Our resident spring of sunshine, @Orwar, has made a cool tutorial for that:

https://community.secondlife.com/forums/topic/464058-a-crash-course-in-dof-editing-vs-viewer/

In our case, you may almost immediately notice that our avatar is completely black while the background is completely white and that's just one  step away from being an alpha mask in Krita. This is an alternate method if you can't whip out a greenscreen. That said, the more complex a scene becomes, the less likely this is going to work well. In this case it's us floating in the sky so we're good.

You should have something looking like that:

images.png.4af6d2ac066b5afaec38a4b95b55d617.png

And now the magic happens. Let's head into Krita. Load in the image you want to place your avatar in. Then you will want to load each of the four pictures, hit ctrl+a to select all and then copy paste it into the target image. All four of them. Then select all four layers and Group - Clipping Quick Group them. Order not important yet. The result should be something like this:

setup15.png.0ec1ce641ae27cc59d13c0406851f3f2.pngSo why have we done all of these steps?

First, we have taken seperate shots of the highlights and shadows, so that we can more easily tweak them in the end result. This gives us an easier way to adjust just the highlights or just the shadows. While you can always adjust levels in an image program, I find it much easier to do this seperately. Especially as you can adjust and paint more easily this way.

The depth image we can use for depth of field (not relevant in this case) but also - much in the same way as greenscreen. If you remember, it doesn't have to be green. Just a colour that isn't found anywhere else in the image. Thus all the techniques from the first part still apply, just you already have got your transparency mask. Kind of.

Let's set it up properly. Drag your depth image to the top of the pile, like in the image to the left. Right click your depth layer and click Convert -> Convert to Transparency Layer. Due to the way how Clipping Groups in Krita work, this will now apply the transparency mask to all the layers within the group. Thus any changes to the mask we make, we make to essentially of the images.

Useful especially if we're compositing the four of them into one result. At this point I have gone and ordered the layers in the following order.

  1. Depth (as Transparency Mask)
  2. Highlight
  3. Shadows
  4. Normal/Neutral

And now begins the tweaking. This is a time consuming process. In essence, you will use the various blend modes of the layers to blend together all these into one picture. For example, in my case I have set the Highlight Layer from "Normal" to "Screen" and, the Shadows layer to "Darker Colour" at a low Opacity. There's no one size fits all solution here. I suggest using both the Levels and Colour Adjustment Curves (Filter -> Adjust).

Still, there is one more element that's important to have and that's a shadow.

Right now, our avatar is just kind of floating in the picture and while getting the precise colour values right is a lot of experimenting, creating your own shadow is not. For this we will make use of your Transparency Mask. Do you see the tiny image next to it?

This here? setup16.png.fe0e6a237119e36e21fafad657dd7862.png The one to the left of "Transparency Mask" that's black and white? Good. Hold Control and click that. You will now see your avatar surrounded by the famous ant lines. That's the line that keeps moving around it - kind of like little ants. Create a new layer outside of the clipping group and while the selection is still active, select the fill tool, pick black as a color and fill selection. This gives you a completely black copy of your avatar. What good is that? Well, you can turn it, set the opacity quite a bit lower and would you look at that... a shadow.

shadownina.png.e9ac25c4a78cf38a57879dc06ad0e133.pngshadowednina.png.304a275bc00d556b3393a84c76de8cf5.png

Saves us a lot of time of handpainting it in and that's mostly it. The rest is a lot of busy work to properly blend the image. A lot of going back and forth, painting colours, adding elements from the picture such as light halos, further adjusting things like image warmth or adding some blur to the parts of the image that are further back. Here's what I came up with. Not perfect but I'll say it's good enough for a demonstration.

tutorialfin.jpg.ddd8da0a2489ddc4a0b8f14fb097ff13.jpg

Bonus points!

Nina, why are your hands so **weird**? Because I'm a dingus and forgot to lock animations and didn't notice until I was several hours into writing this tutorial. The hands are the result of the four images I took not having the exact same pose for the hand. Easy mistake to make and I left it in to show what happens and totally not because I really didn't want to trace back hours to retake the images and all subsequent ones. No sir.

Alright, that's me done for now. Like before, I've been at this for a long time and I'm also brushing against the forum software here. If I have skipped over important steps, please let me know and I'll expand on them and update the tutorial. With these two parts though, you should be good to go.

Bonus points part 2:

Anyone else not notice the yellow diamond traffic sign til now?! :D

trafficsign.png.a1e6cef22ce73c5edb052cc3548997ca.png

 

Edited by ValKalAstra
  • Like 3
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 213 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...