The setting is somber: A gray psychologist’s office, dimly lit and sparsely decorated. Kevin Bacon as Walter, a child molester recently released from prison, sits across a desk from Michael Shannon, who plays a therapist.

“By reflection we can derive a deeper meaning from our experience in life. We gain greater understanding about ourselves that can lead to making better choices in our relationships, our careers, and our goals,” Shannon says.

“Did you read that in the script?” queries Bacon.

Shannon stays in character and continues the scene, despite the chorus of laughter from writer-director Nicole Kassell and the rest of the crew.

It’s an uncharacteristically light moment on the set of “The Woodsman,” an indie production that examines the personal battles of a pedophile who struggles with both himself and society as he re-enters the world after 11 years of incarceration.

“Usually, when you start a movie, you know which days are going to be tough,” Bacon says later, sitting in his tiny dressing room next to the giant warehouse-turned-studio on the grounds of Philadelphia’s U.S. Navy Yard. “With this movie, every day is grueling. … For me, it’s less about trying to understand what (a child molester’s) experience would be than finding the depth of shame they feel.”

Bacon boarded the project after being handed the script while vacationing in the Caribbean last December..

“The script was so haunting,” continues Bacon, who immediately contacted “Woodsman” producer Lee Daniels (“Monster’s Ball”).

The producer touted helmer Kassell, who had co-written the script with playwright Steven Fechter. (Script, which is based on the eponymous play, won the Slamdance Screenplay competition in 2001.)

Bacon was hooked.

Cast — including Shannon, Kyra Sedgwick, Benjamin Bratt, David Alan Grier, Eve and Mos Def — and funding followed.

With a budget described as just north of “Monster’s Ball’s” $4.5 million, Daniels decided to assemble it independently by approaching Philadelphia financier Brook Lenfest and hip-hop impressario Damon Dash.

“It’s good for my career,” says Dash, whose production company, Dash Films, had already produced a handful of urban features. “It shows that I’m doing something other than just hip-hop films. For me, it’s the first time to do something like this outside of my culture.”

Philadelphia was chosen for the shoot, primarily because it’s Daniels’ hometown. And it didn’t hurt that the City of Brotherly Love is also Bacon’s hometown.

Production wrapped at the end of June after a 25 day shoot, and Daniels insists that no one outside of the production team will have a chance to see the film until it’s completed.

A fall target is set for a first cut, and the pic will be submitted to upcoming fests, including Sundance, where Kassell’s shorts have screened in the past.

Meanwhile, the filmmakers are pretty confident about the pic’s potential to hook a distribution deal. “We haven’t gone to the majors,” boasts Daniels. “They’ve come to us.”