Ian McKellen found performing in front of a greenscreen for the first Hobbit film, An Unexpected Journey, so demanding that he almost quit acting.

The revelation was contained in comments McKellen made on the extended edition of The Hobbit: An Unexpected Journey, recently released on DVD and Blu-Ray.

Forced by the exigencies of director Peter Jackson's visual-effects-oriented shoot in New Zealand to work in isolation for long periods, McKellen said: "I felt pretty miserable … and thought perhaps, has the time come for me to stop acting altogether if I can't cope with these difficulties?"

McKellen's particular problems arise because his character, Gandalf the Grey, is supposed to tower over most of the other, shorter characters, both Hobbit and dwarf. To create the false perspective, he had to be filmed separately, on a greenscreen set, and the backgrounds and other characters added later in the editing suite.

"It was so distressing and off-putting and difficult that I thought 'I don't want to make this film if this is what I'm going to have to do'," McKellen added. "It's not what I do for a living. I act with other people, I don't act on my own."

Jackson, however, says he noticed McKellen's unhappiness and encouraged him to keep going despite the isolation. "He truly had such a miserable time on the first day or two of the shoot. We felt sorry for him being dumped in greenscreen land."

The crew also staged an impromptu "Gandalf appreciation day" and cheered up the actor by decorating his tent with props from the Lord of the Rings films.

The actor stuck with the film and returned for the second Hobbit instalment, The Desolation of Smaug, which is due for release in the UK and UK on 13 December, and on Boxing Day in Australia.

• The Hobbit: The Desolation of Smaug trailer

• Ben Child: Peter Jackson's Hobbit philosophy - more is better