“Hidden Figures” is a fairly entertaining gloss of a docudrama elevated by its cast. It takes place mostly in 1961 and early 1962, three years into the life of the National Aeronautics and Space Administration, better known as NASA.

At this point “computers” were people, by and large, not machines. With Russia's successful launch of Sputnik, America had to play catch-up in the space race. Based on Margot Lee Shetterly's nonfiction account of the same name, “Hidden Figures” focuses on three African-American female mathematicians working behind the scenes, and behind a long wall of white colleagues, at a stubbornly segregated NASA in Jim Crow-ruled Hampton, Va. This was the site of the Langley Memorial Research Lab, and the collective mission of the fledgling NASA was simple and near-impossible: propel John Glenn into orbit and bring him home safely, thanks to the proper mathematical trajectories.

Taraji P. Henson takes the lead here as Katherine G. Johnson, who worked in the group labeled “colored computers.” Her co-stars, playing friends and co-workers: Octavia Spencer as Dorothy Vaughan, the matriarch of the group; and Janelle Monae as Mary Jackson, the third lead mathematician. These three are such strong and easy screen company, the movie directed and co-written by Ted Melfi (“St. Vincent”) becomes a matter of tuning out the contrived, Hollywoody treatment of a great true story and tuning into what the actors do to authenticate it as they go.

Johnson is assigned to work with “space task group” head Al Harrison (Kevin Costner, effectively low-key), whose starchy, all-white staff is in no mood for integrating the ranks. Jim Parsons and Kirsten Dunst embody two shades of casual prejudice. Moment to moment, “Hidden Figures” feels half-true and half-phony. Did Harrison, for example, really have no idea that Johnson, his key numbers whiz, was required by law to use the “colored only” restrooms in another building? The character's surprise and outrage seems engineered expressly for the benefit of 2016-era audiences without much historical reference.

The script by Allison Schroeder (“Mean Girls 2”) and director Melfi gathers steam as it goes, however. Henson activates every scene she's in, and her byplay with “Moonlight” standout Mahershala Ali, who plays her dreamy suitor, is as sweet as pie. Do we believe the relationship as presented? Sort of, sort of not, but the actors find their own truth. Melfi favors storytelling and editing rhythms that work better with broad comedy than with earnest drama, and “Hidden Figures” offers a little of both and plenty in between. The bigotry and sexism these women endured cries out for a tougher-minded movie. But there's no doubt that many will respond to this easygoing picture and be grateful for something that at least deals with subjects overdue for some of the space-race glory.

Michael Phillips is a Tribune critic.

mjphillips@chicagotribune.com

Twitter @phillipstribune