Saturday, June 23, 2012

Photoshop Tutorial: Turn a scene from day to night

Day To Night in Photoshop

Hi folks. In this tutorial, I'm going to take you through how to make it look like a daytime photo was really taken at night. (Really, it's one of those tricks that you should really have in your Photoshop arsenal. Amazing how often the need for it crops up.) I'm going to be using this photo:  



which I took in Boston's North End, and which you are free to download and follow along with. I chose this one because it has clearly-defined borders between the sky and everything else, it has some windows where we can do some cool light effects later on, and the natural shadows give the image a lot of depth, which can be a problem when you're darkening lots of parts of an image. Like I said, feel free to use this particular image, or you can choose your own. If you're working with a different photo, try to choose one with good contrast and a clear sky. Also note that your mileage may vary on the settings I use for the brushes, etc. Do what looks good for your image.

Step 0. 

Import your image into Photoshop and make a copy of it. (You always make backups of your images, right? Right?


Step 1. 

Pick up the Magic Wand tool.


Using these settings:


select all of the sky area. Use the shift key to add areas that don't get selected from your first click.  Just make sure that you get every bit of the sky, otherwise you'll have weird artifacts when we start applying adjustment layers and stuff. If you're following along with this image, be especially careful where the lamp and the electrical wires meet the building. It's worth taking the time to make this selection a good one. This is the area you should have selected: 


We're going to use this particular selection a lot in this tutorial, so it may be worth saving it in the Channels palette for easy access. (or you can Alt-click on any of these adjustment layer masks. Just know where you can find it easily.)

Step 2. 

With your new selection, go to Layer>New Adjustment Layer > Levels. 



Name like so. 
Open the Adjustments tab (automatically pops up in CS 5.5) and use the settings below:



Step 3. 


Go to Layer>New Adjustment Layer>Brightness/Contrast. You should use adjustment layers whenever possible (rather than making edits directly on the layer in question) so that you can edit any change you've made at any time. Working non-destructively lets you avoid extensive re-dos by giving you a lot more dimensions of control.



Name like so

Bring the brightness down and the contrast way up. Don't go crazy with the brightness setting - you still want a bit of color left in the sky so it shows through later. We'll darken it up more when we add the stars.


Step 4. 

Add a new layer on top of the other layers and call it something creatively descriptive:


Step 5. 

Go to Edit>Fill and fill the entire layer with black. 


Step 6. 

Now we're going to start adding some stars. Go to Filter>Noise>Add Noise.


Bump the amount of noise way up (above a certain point it doesn't matter how much, but definitely somewhere above 200%. Make sure that the distribution is uniform and that you check the monochromatic box. Hit OK.


Note: If you're not happy with the noise level, you can do this step two or three times in a row to try and get a look you like. Play with the slider until you get a white:black ratio you're comfortable with. Obviously, more white will give you more stars, and more black will give you fewer, farther apart.

Step 7. 


The next step is to blur the stars a little and make them a little less harsh. Go to Filter>Blur>Gaussian Blur.


You can use a 1 px radius, but I think I'd recommend using a 2 or even 3 px radius. I'm using an image that's twice the resolution of the one I posted, and I think next time I'd use a bit more blur. Keep in mind that stars that are too blurry will look less realistic and more surreal. 


Step 8. 

Reselect the sky by Alt-clicking on one of the adjustment layer masks.


Press Ctrl+Shift+I to select the inverse. You should see the marching-ants selection line change subtly. Make sure you're still on the stars layer and delete the building. 

While you still have the stars layer selected, drop the opacity down to about 40%. Your layer thumbnail should look like this: 


Step 9. 

Now it's time to really make them look like stars. Go to Image>Adjustments>Curves (Sorry, no screenshot). Make sure that you are NOT using an adjustment layer this time...I know I said just a minute ago to use them whenever possible, and this time, it's just not possible. The effect just doesn't come out right - I don't know why. 

You should have a nice regular curve (because you gave your noise a uniform distribution, right?) and a 1:1 line superimposed over that. Adjust the line like so: 


It's ok to be approximate here. Check the "Preview" box so that you can see how the stars look, and do what looks best to you. 

Side note: for some reason, after I clicked OK here, the image on the canvas didn't match the preview image - there was a bunch of background filler that popped back into view, and I still don't know why. If that happens to you, it's fine - leave it, and we'll fix it later. 


Step 10. 


Select the sky again and make a Brightness/Contrast layer on top of everything (we're back to adjustment layers now). Bring up the brightness and contrast as below:


Step 11. 

This step will remove much of that mid-level noise and leave you with just the largest/brightest stars. You could leave more of the filler than I did to make a particularly star-filled sky (and actually, I like that effect - it would be great in some fantastical forest scene, but I didn't think it quite fit here).

With your stars layer selected, go to Filter>Noise>Dust & Scratches. Adjust the sliders to your liking. Here's what I used: 


I wouldn't use a radius greater than two pixels here, but you can adjust the threshhold levels as you like to increase or decrease the number of fainter stars you see. 

Step 12: Checking in. 

Take a look at what you have so far. It should look something like this: 


Yes? Yes. Onwards.

Step 13. 

Since we have sort of a twilight scene, where the sky is lighter at the bottom right and darker at the top left, we need to remove the stars from the lit area. We'll do that using a simple layer mask. Select the sky again and add a layer mask. 



Now, select the gradient tool with a simple black to white gradient. Choose the radial gradient style and click in the middle of the brightest area of the sky. Drag towards the top left. 

Gradient tool icon.

Use these settings:


(that's a black-to-white radial gradient, normal mode, opacity 100%, check Dither and Transparency)

You probably won't be able to get a perfect mask with just the gradient tool, so select your brush tool with these settings:


I would use an opacity of 15 or 20 percent and a ridiculously low flow rate. Anything with hard edges here is going to look weird. With black, paint on the layer mask until you're happy with how the stars fade into view. My mask looks like this: 


Step 14: 

We're done with the sky for now - there's some touch-up work to be done, maybe with clouds or a moon, but it's enough to give us a sense of nighttime and a color palette so we can adjust the buildings. To get the sky layers out of the way, I put them in their own group:


Step 15.

Now let's work on making the building, which is currently doing a great job of reflecting lots of sunlight, look like it's really only reflecting the last bits of a sunset. To that end: 

Select the Burn tool with these settings: 



(Brush 125px, 0 hardness, Range: highlights, exposure 51%, check protect tones)

Make sure that you have your background copy layer active. Select the sky again, then press Ctrl+Shift+I to select the inverse, which is the building. This selection will prevent you from "coloring outside the lines" and darkening the sky when you don't want to.

Now use the burn tool to darken the rooftop edges. Don't make it uniform. In the image below, the red arrows point out the edges where I was focusing, and the green arrows are where I tried to leave a bit more light. Corners and extreme edges should be more visible than long, flat stretches.


Step 16. 

Still with the Burn tool, switch from highlights to midtones and darken the area pointed out below.


Now darken the windows and ledges. You may have to flip back and forth between highlights and midtones to get the right effect. What you're aiming for is to tone down the reflected light on all those surfaces. To start, you can take the Burn tool at a very low strength, set it first to highlights and then to midtones, and with a very large, soft brush go over the entire left side of the building. Then go back with a smaller brush and do some touch-up work. 


Step 17. 

All that burning should have decreased the saturation significantly, which is good - night vision has very low color depth - but we need to bring the contrast back up. To do this, set the burn tool to focus on the shadows, bring the strength down to 1 or 2%, and deepen the shadows around the windows and under the roof edges.


Step 18. 

Now do much the same thing on the front and right sides of the building. Use a very light hand on the front of the building. There are some great blues in there that you don't want to get rid of. 

A good place to focus is those overexposed parts over on the right side. Use a brush that's the width of the panel you're working on, and use long brush strokes to dim the brightness.


When you go to darken the shadows, make sure that your exposure is set very, very low. A little goes a long way here.



Step 19. 


Still with the building selected (as the inverse of the sky), use the Burn tool on the highlight setting to remove that weird neon glow around the lamp.


Feel free to go back and do any touch-up work on any part of the building after this. Since we're editing the layer directly, it's better to use a light hand and do edits later, since you won't be able to Ctrl+Z your way out of anything you do here after a while. (Also, you are taking snapshots of your work along the way in the History palette, aren't you?)



Step 20. 


Now that the building looks suitably dark, it's time to put in some lights of our own.

Make a new layer for the new light. Title it something like "Bottom light top pane".

Press "P" to select the Pen tool


and make the following shape over the front bottom window:


Still with the pen tool selected, right click and say "Make selection." You'll get this window: 


Put in the settings above. (Your feathering setting may vary depending on your resolution. If you're using the original image from here, note that the copy on the website is half the size I'm using right now to make this tutorial. Remember that when you're setting everything here and in the layer styles below.) 


Step 21. 


Select the gradient tool.


I forgot to take a screen grab of this, but make a radial gradient from #fcea56 to #fef89d. With the window still selected, put the center of the gradient in the middle bottom pane and drag upwards until you hit the edge of the glass, and let go.

Step 22. 


Drop the opacity of the layer down to 50 or 60% so that you can see where the individual panes of glass are.

Press "E" for the eraser tool and use the following settings:


(Brush size 7, 100% hardness, brush mode, opacity 26%, flow 23%)

Carefully erase the gradient so that the struts between the panes of glass show through. If you're using a touch-pad, I'd recommend hunting down a mouse. If you're using a mouse, I'd recommend hunting down a tablet. Just try to get something steadier than what you're currently using. 

If you can't do that...just go slowly, and remember that Ctrl+Z is your friend. 



 Step 23. 


Now we get to use my favorite part of Photoshop, layer styles. If you can ever accomplish something with a layer style over something like a brush, jump at the chance. Layer styles are exact, repeatable, and eraseable, something that not all actions in Photoshop are.

Make these changes on the windowpane layer:


Step 24. 

Make a new layer for the bottom piece of the window. 

Again using the Pen tool, select the bottom screen. 

Right click and say "Make selection". Here you can fill the shape with a gradient or just a solid color - I used #faffac. 




Finally, bring the opacity of the layer down to about 25%. 





Step 25. 

Now apply these layer styles: 




Step 26. 

I used the same technique to light up two other windows. Keep in mind that the layer styles settings will be slightly different for each one. I also changed the colors - I wanted to keep the window in front the warmest, so the other two have colors that are closer to white. 

It's also probably best to keep each pane on its own layer so that you can apply layer styles to each one individually. When you're done with all the lights, put them in a group so they're out of your way.


Step 27. 


Part of the reason I didn't go crazy with removing the highlights on the right side of the building was because I was planning on cheating a little bit and using the lamp as a light source instead.

Make a new layer and use the pen tool to make the following shape.

Fill it with a radial gradient from #fdea4c at 100% to #fdfac2 at 60%. (Sorry no screencap.)



Step 28. 


Resize the light as you see fit - I had to poke at it a few times before I was happy with the shape. Don't be afraid to use the Perspective and Distort transform functions. They're very helpful when you have a regular shape (like a rectangle) being viewed from an oblique perspective.


Step 29. 

Apply these layer styles: 



I didn't show it here, but I also turned the opacity of the whole layer down to 68%. 



Step 30: Touch-ups.

Almost there. There's a bit of touch up work to do, especially around here: 


And here: 



First, select the buildings and use the burn tool to get rid of that (very persistent) neon glow. Go all the way around the edge of the building to get spots that you may have missed before.

Next, select the blur tool. Using a medium-sized soft brush, go over any pixelated or rough edges where the magic wand may not have made the best border. Be careful not to lose any detail, like around the wires, but do try and get rid of any rough edges. 

The last thing I did was to blur the stars a little more. I used a Gaussian blur of 1.7 pixels. 


The finished product: 










What I learned today: June 23, 2012

How to nail Golden Hour*, the respectable way:

  1. Become a photographer. Or:
  2. Become a meteorologist.
  3. Spend 40 years in the business.
  4. Learn from experience how to predict Golden Hour accurately.
How to nail Golden Hour, the cheap and lazy way:
  1. Go to this site and put in your city.
I KNOW, right? 

*For those of you who don't know, Golden Hour is a magical time just before sunset when God turns up the world's "Fairy Tale" setting and it is physically impossible to take a bad photo. True fact. 

Thursday, June 21, 2012

File under: Boring but helpful

The word on the street is that the way you become a good blogger is by blogging often, with lots of pictures, clear insight, and original content. In pursuit of that goal, I have blogged....not at all in the past three weeks. So with the same reasoning that makes McDonald's outsell Per Se, I'm going to try a series of "What I've Learned Today" posts: content that's not especially well done, but damn if it's not prolific.

Delicious cardboard-y content.

To really outdo myself, here's the only thing I can remember that I learned today:

To find out what version of Quick Books you have, press F2. The window that pops up will have "Quick Books yyyy - ABCD" at the top. The ABCD is your version number. 

That's right, folks - no screenshots, no nuthin'. Just something that I wish I had been able to find a little quicker when I was trying to figure it out today. 

How to update Quick Books without it failing at the last minute is a little trickier. I'll let y'all know when I figure it out. 

Saturday, June 9, 2012

Gardening Update


Well hello, woefully neglected blog. Can I just say that learning stuff and writing about learning stuff are two totally different things? I have what I call "Birthday Candle Syndrome", which I've just now made up and defined thusly: it is the tendency to equate putting on the finishing touches with completing all of the work that should precede them. Example: you're making a birthday cake, but didn't have time to frost it, but you slap some birthday candles on it anyway, and voila! You're done. The finishing touches are there, so you must be done. You're done, right? So instead of carefully documenting all of my new exploits for the blog and posterity, I'm rushing through to the finished project, because that's always more interesting.


I'm considering a "What I Learned Today" series to try and counteract that. For example, today's entry would include:
  1. How to insert a title into an Adobe Premiere sequence.
  2. How to (start to) add a SATA port to a ten-year-old Windows XP machine.
  3. How to do frame-hold cross fades between separate video clips in Premiere.
  4. How to make sure that when you water your potted plants after shamefully forgetting to do so for three days, that the water actually gets absorbed by the soil and doesn't just run over the sides.
  5. How to make strawberry mango paletas (ok, this one wasn't today).
  6. What ECC memory is. 
Since five of those require screen captures and/or more photos than I'm willing to take, I'll go with the gardening one, maybe a bit embellished. 

Gardening Tips from an Amateur Windowsill Gardener

  1. If you've forgotten to water your plants for a few days, don't just dump water in when you actually do go to water them. Dig a little trench in the middle of the pot/planter so the water pools in it before the dry soil starts to absorb it. The top layer of soil can't absorb water that fast, so if you just pour water in, it'll all run down the sides (and into your guinea pig's cage, if you're me). 
  2. Don't be afraid of thinning out. Let your seeds sprout, then when it looks like they're not going to die from the tiniest breeze, choose your favorites (pick a number that you'll keep based on how much space you really have), and ruthlessly pluck the rest. Crowded plants don't grow well.
  3. Consider an un-manicured look. A windowsill herb garden that's a little overgrown and bushy not only provides more herbs, it looks pretty darn good, too.
  4. Remember to pinch back your plants to make them bushier. It feels cruel, but pick off those little leaf sprouts every once in a while, and your plant will pick a new (less dangerous) place to put its new leaves.
  5. Seedling pots are just that - for seedlings. Your average vegetable will not enjoy being grown in a 4" pot. (I'm looking at you, alliums!)*
  6. Be realistic with yourself regarding how much space you have to grow. My eggplants will wait til next year because I can only handle one indeterminate plant in my apartment at a time.
What are your windowsill gardening tips?

* I will say that my indoor tomato plants (six in the planter that you see above, three - three! - in a 4" seedling pot) are doing just as well or better than the one I have outdoors in a five-gallon bucket. Go figure.


Saturday, May 12, 2012

DuoLingo: Language for and from the masses

I make no secret of the fact that I am a bit of a language nut. It's one of those systems that hits all of the right buttons: internally consistent, infinite in output but not in input, etc., etc., not to mention that it makes the world go round. I'm a big fan of the democratic ideal of language - i.e., it's not anyone's job to tell you how you should speak, although it could be someone's job to describe how you speak. People have been trying to impose rules on language for as long as they had people to impose on, and it never, ever works.

In short, democracy is the only way language has ever and will ever work, which makes it a lovely thing when a service like DuoLingo pops up. DuoLingo started late last year as an offering from the same professor-grad student team that brought us reCaptcha, the web device that turns an anti-bot timesuck (proving you're human by typing in the wavy letters in the box) into something actually useful that harnesses the aggregate computing capacity of millions of human brains every day (digitizing books by crowdsourcing the translation via CAPTCHAs). So, these very cool and clever people bring us another translation service: a free, web-based language instruction program that simultaneously crowdsources the translation of the web.  It was launched in beta in November of 2011, and Wikipedia claims that their waiting list is 300,000 plus as of March of 2012.

I requested one invite to learn Spanish and one to learn German back in March, and I just got both of them this past Friday. For anyone who hasn't gotten their invite yet, or is considering signing up for one, here's a quick overview of the software.

This is Duo, the irresistibly adorable owl who's the mascot of this whole project. Note that, as it says here, this is not an activity that you want to undertake in the library or around roommates. You're going to be both listening and speaking, and you're going to end up sounding like an idiot at some point, so maybe leave this one for a time when you've got the apartment to yourself.


You have the option of not activating your microphone, but I don't know if you can get through the whole program without actually speaking any of your new language.


After a quick training session, you're taken to your new homepage. The backbone of your program is the decision tree/pathway that takes up the left panel. I thought that the layout was really pretty good, actually. It allows you some flexibility in which lessons you do and when, but it makes sure you don't go jumping into third-year language on your second day. The program also puts a star by the program that it recommends for you next. I haven't gone far enough in either of mine to see if the recommendations are worth anything, though.
Your homepage allows you to follow other language learners on the social media site of your choice, track your progress in a variety of ways, and navigate the curriculum. 

You can hover over any of the lessons and see the content, new words, and prerequisites. I liked this bit because it reminds me of the science advisor's  panel in Civ 3 (I spent hours at that game figuring out the bare minimum of prerequisites that would let me build the space shuttle. Geek out!). In my opinion, any time you can turn studying into a game, you're already leagues ahead of those poor souls huddled up in the reference stacks of your local university library.

When you click on a lesson, you're taken into a ten-to-twenty step training program that consists of translation back and forth between your native language and your chosen language, as well as some speaking and listening. New words are highlighted for you, and you can always hover over them to see their translations.
Just one of the types of training exercises. There's also basic conjugation, speaking, listening, and translation in the other direction.

For every correct answer, you pass on to the next question. If you make a minor mistake (typo, forget an umlaut, whatever) you get a little warning like this:



If you make a larger mistake, like I did here, it tells you what your mistake was and knocks off one of your four hearts at the top right corner. Those are a way to grade yourself on every lesson. At the end of every lesson, you get bonus points (coins? something) for every heart you have remaining - three hearts left equals three coins, etc. You accumulate coins to level up.



Verbs get special drop down menus of their own: you can over over to see the translation, and within the drop down, you can click to view a conjugation table. I'll admit that this isn't the best conjugation table that I've ever seen - I'd like to see them grouped into number (plural and singular) as well as person.



When you finish a mini level, you see this screen:


And when you finish a block, you see this:



You can go on like that as far as you like, following the lesson tree however you want. There's always the option to go back and practice lessons for extra coins. However, the real purpose of DuoLingo really isn't to teach you a foreign language; it's to translate the web. You'll notice a "translate" tab up near the top. Clicking on that brings you to your translation homepage. Here you can find snippets of text collected from all over the web for you to try and translate. You can click through a set of related sentences and try and translate them. The hover ability still works here, so you're not entirely on your own, but the fun is in using what you've just learned on real-world examples. The beauty of the program is that it doesn't matter if you're horribly wrong in your translation - the theory of crowdsourcing bets that the cumulative knowledge of hundreds of thousands of people will zero in on the best answer, and your wrong one will be lost in the noise. (Or your correct one will lend weight to the answer that will prevail). This is probably my favorite part of the program.

There's a lot more to talk about, but I think I'll leave that for another time. A few notes on the program after one day of use in two languages:


  • If you have never had formal language instruction in the language you choose (like me and Spanish), one pass through a particular lesson is probably not enough. I had to do three passes through the first basics lesson before I thought I could get the verb conjugations straight for just "I", "you (inf.)", and "he/she/it". 
  • The speech recognition software is not very good at all. About half the time, it makes you repeat what you said (not a bad thing, but still). Also, I deliberately said the wrong word a few times to see what it would catch, and it passed me on all of the wrong answers. Don't count on this software to improve your pronunciation.
  • If you have had formal instruction in a language before (like me and German), the first few levels are ridiculously easy, as they should be. I don't know yet if there's a way to test into a higher level. Certainly there's a way to test out of your level once you reach a certain point, but I don't know if there's a way to skip, say, two years worth of German in one go. 
  • I come from a school of thought about language instruction that says that translation (which DuoLingo does a lot of) is really not very effective in teaching usable, conversational language. While I do still agree that translation is not the best vehicle for language instruction, I will say that 1) it's better than nothing and 2) the reliance on translation here is probably due to what the program actually is: a means to teach a whole bunch of people simultaneously via the internet. Without great speech recognition, you're sort of stuck with translation (although there's a company called Alelo that does great language training games - hardly free ones, though.)
All in all, I am very excited about DuoLingo. It's not the best language software out there, but it might be the best free one, and it's definitely the only one that puts all that brainpower out there to good use. Get thee to the waiting list!