Question to Photoshop users: How to select stuff?

Started by InCreator, Fri 26/09/2008 21:30:35

Previous topic - Next topic

InCreator

The title of the thread is pretty descriptive.
How to select something from a photo, yet maintain clean edges and not go nuts during this?

I'm making a 3D game and for foliage texturing, grass and leaves specifically, I gained a load of photos.
Problem is, it takes a millennia to gather even one plant from a photo, clean it so only plant remains and not the background. I tried acquiring photos as trouble-free as possible, often put something single-colored behind the plant or took a picture where ground is totally different color than grass lump, etc.

Still, there's loads of little bits of background between reeds and grass/plant/branch shapes are way too complex to manually select. It takes ages using magnetic or polygonal lasso tool, and outcome isn't still good. I tried to select by color range, but it works in ways of inhuman knowledge, I couldn't select grass greens so it wouldn't horribly antialias edges and make large loads of green color semi-transparent. Of course, magic wand tool wouldn't help here either, I could cut grass out, but all edges would be like little bugs had a big feast eating grass - full of little holes. Going manual to fix this would be more trouble than it's worth.

How would you cut out a really complex shape easily in Photoshop (CS2)?

I recall seeing a demo version of some kind of PS plugin that processed image, finding all similar colors and dividing whole photo into single-color portions for easy selection, and it worked like magic!
...but I can't recall name... maybe someone knows it or something similar? The link I saw was most likely here, at AGS, but it was long time ago.

Help me, please.

PS: of course I did Google for tutorials and plugins. Fact is, all selection tutorials are for much, much simpler cases and plugins, well, didn't find anything that would ensure me that buying this would solve even half of the problem.

Ryan Timothy B

There are quite a few ways of doing this, this is how I do it (explained in idiot mode for anyone to understand :P):

The image I want selected, make sure you paste this image on a transparent background:


I then do a quick lasso selection (much easier to do with a tablet) around the object to be selected:


Right Click then Select Inverse then Delete:


Take the Eraser and make sure it's selected on Brush and not Pencil.
The Brush - Eraser will leave alpha channel type transparency around the image outline.
The Pencil - Eraser will be rough and jagged around the image outline - similar to you using the Lasso tool.
The bigger the brush size, the less time it will take.  Just make sure when you have detailed areas you decrease the size of the eraser, or just press lightly with the tablet.


This took no longer than 2 minutes:


Now for this step it will all depend on what you are doing with this image.

If the image is to be placed on another hi-res image, just copy it as is and paste.  The alpha channel transparencies will blend the edges of the selected image to the image it's pasted onto.  Of course you would still have to tweak the selected image brightness/etc.

If it's for AGS, you could always just leave it as is and use the alpha channels with PNG and 32 bit graphics.

If it's for AGS and you don't want to use 32 bit graphics and alpha channels, there are a few things you could do.  I would suggest either using the Eraser - Pencil at the beginning step OR this:

Place a layer behind the image, flood fill with the color the image will be against (that way there isn't a dark or light silhouette around the image when it's against the opposite color), Flatten the image and voila.



Of course it looks like crap on a background like this without tweaking the brightness/colors etc.

Hope this helped.

Domino

Great Post Ryan.  This is very helpful to myself as I am still learning how to use Photoshop.

Thanks.

MrColossal

http://www.photoshopsupport.com/tools/plugins/fluid-mask.html

I think this is the plugin you saw?

http://www.ononesoftware.com/detail.php?prodLine_id=4

I also found this when googling for "photoshop mask selection plugin"

looking at this tutorial, http://www2.indigorenderer.com/joomla/forum/viewtopic.php225 (of course it starts from already having this image to begin with]

I saw this image
and I wonder if you are painting a similar color behind the grass, this could help to get rid of the "little bugs"

There is also Maya Paint FX which I really want to try out but it has a bunch of presets and such for painting organic things like this [from what I understand]



Which you then render out, getting shadows and overlap and all that

can you post a picture you took that is causing particular problems so we can do some tests?

The only other solution I can think of is just paint these parts straight into photoshop or whatever program you use. You could spend 5 hours getting a photo to look good or 2 hours painting it from scratch or nearly scratch.
"This must be a good time to live in, since Eric bothers to stay here at all"-CJ also: ACHTUNG FRANZ!

zabnat

I don't have fancy pictures illustrate what I do but I try my best to explain. Actually I cut objects from photos as a part of my job. The way I do it is what I belive most of the print people do, make a cutout path. Of course I usually have an image with a nice white or gray solid background, but sometimes objects I photograph are larger so I can't use an A4 or A3 sheet of paper as background :). So basically I draw the outlines with the pen tool. You just draw the points and edit them as you go (I assume you know what pen tool does and how to use it and how to use ctrl as a hotkey to edit the path as you go). Then I just mark it as cutting path and it won't appear on print. But ofcourse it's different when you're making an alpha map. So how I would make it is I would first draw the path, as I feel that is pretty fast to do and I will have great control of nice long curves as I'm drawing some bezier curves, then select the path and delete the background from the layer. Then I would use eraser tool and here's one tip for that: use a solid color layer under the layer you are erasing as at least I feel it looks totally different when you have some color underneath it versus when you only have that default checkerboard that represents nothingness. I would think you will be needing the eraser tool with different brush settings if you are to cut up some foliage. Well that's pretty much how I would do it, I know it's not as easy as magic wand ;D. I'm sure there are some tools you've mentioned and if you remember their names I would like to try them also, but my fear/prediction is that they won't for all cases :)

InCreator

#5
Thank you so far.

Excellent tutorial, Ryan, but this is what I referred as "simpler case". Like most of PS tutorials out there - alligator is way other color than rest and shape is quite simple. It's still helpful though!

Zabnat:

Yeah, manual.
I know what print people do, I'm one of them "print people".

...as a packaging designer (engineer would be more exact) and I see that hell of pathmaking in Adobe Illustrator every day. I don't do it much personally, though, but what my point here was, manual mode is way over my head on this case. See lower images to see why.

Also, I suck at vectors overall. And Adobe somehow ignores all intelligence about graphical user interfaces learned by mankind so far making its every program so goddamn horrible to use.

Photoshop is supposedly #1 graphics editor in the world, and yet - fuck, how do I draw a line? click here? and hold this key? and not forget turn this off? and that? what? Back to mspaint, damnit.

So I'd avoid all kinds of pathmaking/using as much as possible.

MrColossal:

Yeah, first link probably is the one. Thanks, I will check it out tomorrow! Actually, any plugin that would actually do what I want would work. But most plugins out there have very little to show, no demo and still cost too much for just one tool.

Quotecan you post a picture you took that is causing particular problems so we can do some tests?

There's about 30 pictures of "particular problems". I want some variety in my foliage, many different grass/plants, and all trees need branches too... :D

Well, pictures. A simple(simpleR) case is like this:



As you can see, going manual and making selection paths/using lassos, whatever, ...is POSSIBLE, but really uncomfortable and takes way longer than probably-never-to-be-finished game deserves.

Well, since rocks are different, color range selection should do the trick, right?
Wrong. Turns out like this or even worse, whatever I try:



This is what I meant by "bug feast". Magic wand gives about similar results.
To hell with them holes! I can patch them up! But... what's not so well seen from second image is that much of the green is actually transclusent, not 100% opaque. I have no clue why Photoshop does this. This is so stupid.

Of course, I'm using photos about 3x the size I posted here, but it doesn't help much.

But since summer is over and there's not much grass left for more photos, I have to use what I could get. And some of it looks like this:



And here, I still have no way to get a clean shape at all. Even not for enough varied portion to make my own lump.
I really don't know what to do here.

But I'll make sure to try those plugins!

PixelPerfect

Tried to do the first one with just color range. Before applying color range added some saturation to greens to make them stand out more. I copied the result 3 times and scaled it. Added some dirt and sky. Maybe enough resolution for a probably-never-to-be-finished game?


InCreator

#7
For a photorealistic 3D-texture?
Sorry, not really.

VERY early screenshot of what I'm doing:
http://www.increator.pri.ee/i/rpg/ss013.png

See how jagged grass looks? I want atleast the quality I have on tree leaves.

Mantra of Doom

Have you tried changing the tolerance of the magic wand tool? Turning up the tolerance a little might solve your rock issues and take all the gray bits from the green bits. Also, you might want to run a soft blur on the grass, if it's going into another picture, that might get rid of some of the stray pixels or even help it blend into the background a little. This is especially good for grass that is further in the background.

If the transparency bothers you a little, you can make a new layer under the grass, select the grass that you've "cleaned up" and fill the layer underneath it with a greenish-white. That should take care of that.

Hope that helps you a little. Cleaning up around grass and hair is hard... I think I had a magazine that explained how to get "perfect selections" once, I'll try to dig that up.
"Imitation is the sincerest form of imitation."

Ryan Timothy B

Quote from: Domino on Fri 26/09/2008 23:10:32
Great Post Ryan.  This is very helpful to myself as I am still learning how to use Photoshop.

Alright so another thing I do (this is the better approach -- this won't help you InCreator, unless you spend lots of time on it).


Open your background image into Photoshop:

           
Place the image you want over the background:

They don't have to be the same size of the background either.





Then click on Add Layer Mask while you have the top image selected:

           
Select the mask (not the image - you want to draw on the mask so you don't damage the image):


A mask allows you to edit how you see the image without actually altering it - you can delete the mask anytime and the image will stay intact.

A mask uses two colors.  Black to erase and white to unerase.

To save yourself time, quickly Lasso around the image.  Right click then Select Inverse.  Make sure the background color is set to Black. Delete.



           
Then you can use the Brush tool with the Foreground color set to Black and start drawing around the image.
You'll notice whatever is drawn black on the mask will let visible the background image.


That was pretty easy.


The best thing about using a mask for this, is that you can always use the white brush to bring something back.
Or you can play around with gradients (just remember - white and black.  You can also use grays if you want to go advanced.)! :)


Andorxor

#10
Quote from: InCreator on Sat 27/09/2008 01:10:10

Here is my try,it isn't realy clean and i forgot to select the darker greens at the base but i only needed 1 minute for it:

And here is what i did:
First i switched to the green channel and used the colorrange selector.Than i switched into maskmode and raised the brightness until i had everything.
 

dasjoe

What about Knockout and other such software?
... it's quite easy being the best.

InCreator

Ooh, this is GOOD. I could eliminate rest of the noise with vertus fluid mask (thanks mrcolossal!) plugin...

Thankyou--

SMF spam blocked by CleanTalk