Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Greenscreens, Transparencies, and You.

Bob Bauhaus
Fictional being
Join date: 22 Sep 2004
Posts: 24
05-26-2006 14:36
Here's a neat little trick that acually is kinda cool. Wynx suggested I post it here. Hope you like it!

THE PROBLEM:
As you vending-type people know, it's fun and profitable to make images of the wares that you're selling. It's even better to do crazy transparencies with them. This is commonly known as greenscreening: To take a photo with a color background of such a tint that it can be manually filtered out. However, if any part of the item is transparent, or more still, the photo is antialiased, the greenscreen green causes a problem.

In the case of a transparent item, the green will show through the item, and tint it horribly if you use a really odd color. And even if something like white is used, there is no preservation of the transparency; It will be either fully opaque or not there at all.

If you have antialiasing on, the pixles around your subject will have some of the greenscreen bleeding over, and moreso, will have jaggies.

So what's an intrepid SLer to do?

STEP ONE: PHOTO SHOOT
Set things up as one typically does, posing and all that fun stuff. Currently, animations that constantly move, animated textures, and moving particles all cannot be included, for a simple reason: You want to take two photographs. One with a white "Greenscreen" and a second one with a black "Greenscreen". It is vital that nothing move between the two photographs. Unless you want to experiment.

For the same reason, don't use lossy compression like JPEG. PNG or TGA is the key here. These images are in jpegs just for older browsers, but the files are included at the end.




STEP TWO: PHOTO LINEUP
Photoshop, Paintshop Pro, Mad Max's Miracle Manipulator, any program that supports layers, doing a difference filter between those layers, and an alpha channel for a TGA image will do.

Bring these two photos, lined up perfectly, and have the program perform a "Difference" filter on the top layer. The result should be a purely black and white affair, looking like a silhouette of the subject. If the images are misaligned, the misalignments will appear as color.



White differenced with black is purely white. Same color differenced with itself is purely black. Places where things were transparent are neither white nor black in the two photos, nor are they the same color. This is why they show up as greys. Any portion that of this difference that is in color indicates something besides the greenscreen changed.

We actually want the photo-negative of this black and white image. That is, make white black and black white.

STEP THREE: PHOTO SHOP
Copy this merged image, and remove one of the layers. In our demo, we kept the white background, hiding the black background.

If some color insists on staying, you'll have to manually tweak the merged image, deciding what goes and what stays, as the photos didn't line up perfectly.

Make this image our alpha channel: In Photoshop, make a new channel, paste in the merged image, and invert it(The photonegative mentioned earlier). Save our resulting image, keeping the fourth channel as you save to a tga format.

VOILA! The resulting image!


Note the green cube and glass texture. Our transparencies were preserved.

You'll find this will be very powerful and useful. The only weak spot in this method is that transparent items come in much weaker in the final shot. A pure black item, 50% transparent will turn into a grey item, 50% transparent. More work is needed to see if there is any way to counteract this. In the mean time, happy primming!

White Background
Black Background
Differenced image
Finished TGA file
Nepenthes Ixchel
Broadly Offended.
Join date: 6 Dec 2005
Posts: 696
05-26-2006 17:21
Another tip:

Activate the debug menu (ctrl-alt-shift-D) and disable rendering of distance Fog. That way a full-bright coloured prim will have the exact same colour in each pixel, no slight differences for being further away from the camera. This allows you to use the magic wand set to tolerance 0 to select the entire background in one go; with distance fog on I found I often had to use tolerance 4 or 5 to get it all, risking selecting a bit of image my mistake.