Two years of planning, surfing, filming and songwriting will come to fruition tonight when Switchfoot returns to the grandstand at the San Diego County Fair.

Jon Foreman, lead singer and songwriter for the 17-year-old San Diego alt-rock band, said the show will feature a sneak peek of songs from “Fading West,” a surfing-themed band documentary that will be released this fall with a companion soundtrack album.

The 80- to 90-minute film will premiere next month in Encinitas at a preview party for the ninth annual Switchfoot Bro-Am surfing tournament and concert, which takes place July 13 at Moonlight State Beach in Encinitas (construction on the Moonlight parking lot pushed the tourney back from its usual June date). When the band tours later this year, the movie will replace an opening act.

The film and soundtrack were a dream project for band members, Foreman said, because surfing is a shared passion, and they all draw inspiration from the sea and the environment for their music and charitable advocacy.

“Our goal with the album was to make a record that was inspired by the ocean and parts of the world that we love to visit,” Foreman said. “We wanted to go to Australia, New Zealand, South Africa and Bali and be inspired to write music by what we saw and heard.”

One example is “The World You Want,” a new song about the harrowing toll of AIDS in South Africa.

“We’re so used to living our comfortable middle-class Southern California existence, but when you’re face to face with these beautiful kids who have lost their mom or dad to AIDS, it’s a shock to the senses. The song is a simple question about what kind of world do you want, because you’re making it every day you’re alive,” he said.

Traveling around the world, surfing and playing music with a film crew was exhilarating, exhausting and sometimes invasive. Cameras captured what Foreman described as “the worst month of my life” in March 2012, when the band canceled its Australian tour so he could fly to the side of his young daughter, who was briefly hospitalized with an undisclosed illness.

“Making the film was a blast, but it also included some challenges we never faced as a band,” he said. “We try to keep our personal lives out of things, but we decided to keep that part in because it was honest.”

Tonight’s show will feature songs from “Fading West,” old hits and surprise guests. Foreman calls the annual concert his favorite of the year. “We love it because it’s a hometown show and because we can see the ocean when we play. That’s about as good as it gets.”