BEVERLY HILLS, Calif. (AP) — Patrick Stewart was so inspired by the inventors and inventions being honored by the motion picture academy Saturday night that he offered a spontaneous recitation of a scene from Shakespeare’s “A Midsummer Night’s Dream.”

The venerable actor hosted the academy’s annual Scientific and Technical Awards ceremony, an untelevised dinner at the Beverly Wilshire Hotel, and he closed the evening by going off-script with Puck’s plea in defense of art.

Stewart was a gamely host throughout the more than three-hour program, calling the honorees “film magicians” and poking fun at his own lack of high-tech understanding.

“I have to tell you, I wouldn’t know the difference between a warp-core breach and a space-time continuum if they got into bed with me!” the 77-year-old actor said to raucous applause.

Stewart presented nine awards for hardware and software innovations, along with three Oscar statuettes.

Two of the Oscars went to the creator and developer of the Houdini visual effects and animation system, a collection of tools for computer-generated effects that has been used in more than 600 feature films. Mark Elendt and Side Effects Software each accepted an Oscar for their 25 years of work on the program. Four other Houdini collaborators received an academy plaque.

The third Oscar was the Gordon E. Sawyer Award, which recognizes extraordinary technological contributions to the film industry. Jonathan Erland became the 26th recipient to date for his decades of study, innovation and advocacy for the science of movies. Erland was a founder of the academy’s visual effects branch, co-founder of the Visual Effects Society and counts the original “Star Wars” and “Star Trek” among his film credits.

“I intend to work until I drop,” he said as he accepted his award.

He referred to film as an art-science, adding, “the ultimate goal and purpose of art is enlightenment.”

Other inventions honored Saturday included a rotating, helicopter-mounted camera that was recently used on “The Revenant” and “Dunkirk” and a waterproof, telescopic camera crane used on “Logan” and “Wonder Woman.”

Digital developments accounted for the rest of the prizes. Short videos illuminated the practical side of the various innovations; how these software programs help artists design and animate characters and move them in space.

Such advances “allow animators to work as the speed of their imaginations,” said an engineer on the Premo character animation system used in “The Boss Baby” and other DreamWorks Animation features.

The Academy of Motion Picture Arts and Sciences has singled out scientific contributions for awards since 1931. The Sci-Tech Awards have had their own dedicated evening since 1977.

“In cinema,” Erland said, “art and science are bonded together.”

Stewart said that as Erland accepted his award, “it occurred to me that another Englishman wrote something once which is perhaps appropriate for this event.”

“He didn’t know it would be, of course, because he lived 400 years ago,” Stewart said as he introduced the passage he recited from memory.

“If we shadows have offended, think but this, and all is mended — That you have but slumbered here while these visions did appear.”