Actor Robin Williams, star of the film World's Greatest Dad, poses at the film's premiere in Los Angeles, California August 13, 2009. REUTERS/Fred Prouser

Yes, you want to have a great screenplay and a talented director, but no project ever gets made until a star's attached.

You simply can't make a movie without somebody to play the lead and having a star is going to help if you're looking for financing or distribution.

Case in point: World's Greatest Dad, which opened Friday in New York to a modest $10,300 and comes to California on August 28. Written and directed by Bobcat Goldthwait, it's a thoughtful but outrageous comedy starring Robin Williams as a troubled high school poetry teacher and single parent.

After the accidental death of his insufferably nasty teenage son (Daryl Sabara from Spy Kids) he suddenly finds himself with the fame and fortune he's always craved. Only question: Can he live with knowing how it came about?

Although the role fits Williams like a glove, it wasn't written with him in mind. In fact, Goldthwait told me, he didn't even plan on asking him to read it.

Robin and I are old friends and he really liked 'Sleeping Dogs Lie,' he explained, referring to his 2006 drama that also screened at Sundance. I really wasn't trying to hit him up to be in the movie.

So what happened? I was at dinner with him and another friend and I was telling him the new story and he was like, 'Well, can I read it?'

Moreover, Goldthwait added, I really wouldn't have written the movie for Robin as a poetry teacher if I had him in mind because I think he covered that pretty well already in 'Dead Poets Society.' So I was really shocked when he wanted to be in it.

On the other hand, poetry be dammed -- this was such a good fit for these two friends. I think the character is a little bit based on life lessons that Robin and I had to learn as adult men.

Williams (to Goldthwait about a week into production): Oh, I get it. I'm playing you and me.

The payoff: He said it's the most comfortable he's ever felt on a set, which I believe is true because he and I are friends. It wasn't like we would do a scene where you would go, 'Okay, we'll do one. And now we'll do one where you ad lib.' We would keep trying different things, but it was very collaborative.

Goldthwait wrote Dad about two years ago. To write he just goes off to a hotel and works around the clock. I wrote this one in about five days. My detractors would probably say I should spend another day or two on it!

Attaching Williams definitely accelerated getting Dad made. He and Goldthwait wanted to be sure they did the film with the right people and avoided the temptation to make it a zany comedy.

What they had in mind from the start was that the film wasn't going to try to exploit Robin's name and wouldn't be marketed as a comedy with a very silly trailer. We wanted to make sure people kind of got the humor of it.

It was the folks at Darko (Entertainment) who financed it, he said. A company founder, Richard Kelly, directed Donnie Darko and is a producer of Dad.

Magnolia Pictures got involved after seeing Dad at Sundance and here, too, Goldthwait found himself working with a friend: Eamonn Bowles, who runs Magnolia, is actually an old friend of mine because he hangs out in a bar that my friend runs in New York. Eamonn's always been very supportive of what we're doing.

Asked what Dad's budget was, Goldthwait replied, I don't know if Magnolia would be too happy with answering that. My guess is it probably would be about two days of shooting on Night at the Museum (in which Williams played Teddy Roosevelt).

Shooting got under way about a year ago for five weeks, a lot less time than Williams is used to.

Williams (at the time): Is this going to be eight or nine weeks?

Goldthwait (laughing): I guess if I were doing 'Lawrence of Arabia' yeah, but it's about four or five weeks.

They shot in the Seattle area, but not only for the tax benefits.

Acknowledging that this sounds really pretentious, Goldthwait said he's a fan of Harold and Maude with its big pine trees. Even though he knows it was shot in northern California, thinking about those trees subconsciously prompted him to want to film in the northwest.

As for casting Williams' difficult son Kyle, Goldthwait said, Daryl came in and was supposed to audition for the role of Andrew, the sweet boy, who's Kyle's only friend. He just lied to me and told me he was there for Kyle.

Despite liking Sabara's audition, Goldthwait wasn't sure about hiring him, worrying that he might really be a bad kid because he stayed in character.

Calling around to check him out, he laughed, I heard people going, 'Daryl? He's a really nice guy. What are you talking about?' As much as I wanted someone to do a good job on the role, I didn't want to hang out with someone who really was like Kyle.