The naysaying about “Hidden Figures” had already begun on social media before anyone had even seen the film.

“That story never happened,” said someone after watching the trailer. “Three black women were responsible for the success of NASA? Give me a break,” said another, who either had no idea what the movie was about, or was just your run-of-the-mill racist.

OK, no, three black women were not “responsible” for the success of NASA’s Mercury, Gemini and Apollo programs.

But the story in “Hidden Figures,” filled out by a bit of dramatic fictionalization, did happen.

The trio at the film’s core are Katherine G. Johnson (Taraji P. Henson), Dorothy Vaughan (Octavia Spencer) and Mary Jackson (Janelle Monae).

Real people. Engineers, mathematicians, computer whizzes. One happened to have expertise in analytic geometry, just what was needed at NASA at the time, right in the midst of its space-race heyday. Go ahead, Google them.

This is their story, and it concentrates on the contributions they made to NASA in the early 1960s. But it’s also the story of the overwhelmingly white male workers around them, all incredibly bright, some racist, some threatened by the fact that women were becoming part of their workforce.

Chief among them, in two strong performances, are the demanding NASA director (a composite character based on other directors) Al Harrison (Kevin Costner) and the fictional NASA engineer Paul Stafford (Jim Parsons).

After a brief 1920s prologue, in which elementary school-age Katherine Johnson is humorously shown to be the smartest kid in the room, the film jumps to 1961, when the U.S. government and its space agency are concerned that the Russians are getting ahead of them and are likely putting spy satellites in orbit.

This isn’t one of those tales where someone is plucked from obscurity, then goes on to save the world or, in this case, win the race. These women were already at NASA.

In fact, a lot of brainy black women were at the Langley Research Center in Virginia, working in the Colored Computers Room. (Note: I learned from the film that the people crunching information on those newfangled IBM machines were actually called computers; they computed.)

Segregation was still a way of life back then, so along with that computer room, there were, for instance, also white-only and black-only bathrooms, and everyone just kind of dealt with it. But NASA, at least, also noticed and acted on people’s talents and good ideas.

Dorothy Vaughan was free to run that computer room, and did so (albeit at pay below that of a supervisor), with complete confidence. Katherine Johnson, known for her skills with numbers and ease with complicated equations, was accepted by Al Harrison as someone whose ideas might just allow them to catch up with and bypass those pesky Russkies. She was the smartest person in that room, too.

There are peeks into the private lives of the three women, some time spent with their families on those rare moments when they weren’t co-workers toiling late into the night at Langley.

Director Theodore Melfi (“St. Vincent”) also packs the film with actors playing soon-to-be astronauts Alan Shepard and John Glenn, as well as archival footage of John Kennedy praising the early work of NASA and hinting at a moonshot down the road.

The film’s tension starts to build when a radio announces the news of cosmonaut Yuri Gagarin becoming the first man in space; it threatens to boil over when deadlines for the first American launch get nearer; and it goes full throttle when, late in the film, after all of that hard work results in American lift-offs, there’s life-threatening trouble with a capsule’s heat shield way up in the sky.

This is an exciting, fast-paced movie (even when we’re seeing people writing on chalkboards) that tells of a fascinating time in our country’s history, when space exploration was just getting going.

That it also happens to be about a racial divide that turned into racial equality is an unexpected and welcome bonus.