M. Night Shyamalan’s new film Glass may possibly be something unique in the history of cinema—a sequel to two seemingly unrelated films. It follows on immediately from the events of his last movie Split (2016), which, apart from its Philadelphia setting, seemed to have nothing whatsoever to do with Shyamalan’s 2000 movie Unbreakable. At least, it didn’t until the coda, when a frowning Bruce Willis made a sudden unexpected appearance, to suggest that something further was in the works from this most devious of storytellers.

Glass is a high-risk project: understanding it depends on your retaining the essential information from a 2016 movie, and retaining anything at all about a film now 19 years old. Many people will rush to Wikipedia before watching Glass, although I was warned not to: the Unbreakable entry apparently contains plot spoilers. So unless you’re a hardcore devotee of this director, prepare to be at least a little bemused. Still, you have to admire the nerve of Shyamalan for attempting something like this—and indeed, for choosing Glass as the title for a film so unashamedly non-transparent.

One thing he’s never lacked, of course, is nerve. One of the characters in Glass is a psychiatrist who specializes a very particular delusion of grandeur: she studies people who think they’re superheroes. Is there such a thing, clinically speaking? You’d be surprised if there weren’t, in an age when the Marvel Cinematic Universe seems to be rapidly taking on more solidity and plausibility than many of the familiar realities of our own world. You wonder whether this condition is related to the common delusion whereby reasonably talented filmmakers think they’re visionary auteurs.

But look, I admire Shyamalan. Some of his films have been shockingly bad, not to say pompous, but when he’s on form, there’s a palpable sense of someone inventive taking risks and having fun. Even if the kind of fun he pursues in Glass is of a neurotic, rather arid sort—akin to the pleasure someone might derive from devising a super-difficult sudoku—Shyamalan is definitely doing things his own way.

Returning from Split is protean menace Kevin Wendell Crumb (James McAvoy), aka the Horde, a man with an extreme case of Dissociative Identity Disorder. When he’s first seen, terrorizing the shackled cheerleaders who are his latest captives, it’s in a skirt and sensible jumper in the guise of Miss Patricia, a prim English den mother to his various selves, which also include gauche 9-year-old Hedwig. Often, we get a whole stack of McAvoys in one scene: at one point, he launches into a breakneck fugue of personae, from flirty Jade to a brash Irish gabbler to a nervy Latino (with Spanish subtitles). But, as they say, you wouldn’t like him when he’s angry; when Crumb’s shirt is off, his neck starts to bulge, his muscles go whipcord-thick and he starts rampaging on the ceiling, as the furious incarnation of Id known as “the Beast” (not to be confused with the character in X-Men, although the copyright lawyers must have worked late nights on that question).

Hoping to stop the Horde is a shadowy crime-fighter in a rainproof, known in the media as “the Overseer.” He’s none other than the character played in Unbreakable by Bruce Willis—David Dunn, a man who discovered that he was gifted with telepathic powers, and unbeatable except when wet. Now grey-bearded and grizzled, Dunn—a glum vigilante senior—tracks down the Horde’s hiding place and goes mano a mano with the Beast. But both of them are apprehended by the authorities and incarcerated in a mental institution under the care of Dr. Ellie Staple (Sarah Paulson, playing it hyper-detached, with strangely mask-like features). She’s more than prepared for their arrival: she places Dunn in a cell fitted with water cannons, and Kevin in one equipped with a battery of “hypnosis lights” that force him to switch personae when they flash. This is the film’s big visual gimmick: in one scene, the lights flicker so wildly that Kevin starts switching identities at the pace of an old-school Las Vegas impersonator going for the land speed record; you want to stand up and give McAvoy a round of applause, and you just hope he had a good long lie-down afterwards.

Staple’s mission is to make her two patients accept that they’re not really super-powered, just deluded: this is Shyamalan’s latest pitting of faith against rationalism, and we know how fuzzily he tends to come off in favor of the former. But the doctor is also attending to the institution’s other star inmate Elijah Price, the self-styled Mr. Glass, played by Samuel L. Jackson—Unbreakable’s comics-obsessed character with osteogenesis imperfecta, or brittle bone disease, who turned out at the end of that film to be a real-life supervillain of the evil genius variety. For the first 70 minutes of Glass, Jackson’s character says nothing: he simply sits motionless in a wheelchair, glaring, unperturbed and impassive, but crackling with a muted frequency of intense malignity (it’s at once Jackson’s quietest performance, and among his most full-on). But sure enough, Price is cooking up a fiendish master-plan, and no defenses can stop him. He’s the latest incarnation of the “man in the glass box” species of villain: like Hannibal Lecter, or the captive Magneto in the X-Men movies, he’s imprisoned, immobilized, and in full view, yet capable of moving mountains by mental power alone.

It’s a nice triangle: one villain who barely moves a muscle, another who’s in a constant state of physical and mental ebullition, and between them a hero who mooches around ruefully, waiting for something to happen. If Glass resembles any of its characters, it’s the twitchy Kevin, because the film is so restless itself. You find yourself wondering whose story Glass is telling: one moment we’re following David, then we seem to be settled in with Dr. Staple, then with David’s son, believer, and accomplice Joseph (the likeable Spencer Treat Clark, reprising his Unbreakable role as an adult), the next it’s Casey (Anya Taylor-Joy), the captive liberated by the Horde at the end of Split. This constant shifting feels distracting in a feature film, although it wouldn’t in a TV mini-series, or indeed a graphic novel, and arguably it does lend Glass an authentic touch of comic-book fragmentation.

All the while, of course, Shyamalan is cooking up his own fiendish masterplan. I won’t say too much, except that it’s a trick of misdirection: he sets us up to expect an extraordinary bells-and-whistles payoff, then pulls back to remind us that no, this is not that sort of movie—he just fooled us into thinking that it was. Some viewers may feel bitterly disappointed; Shyamalan might argue that the disappointment is part of the fun.

As far back as Unbreakable, which followed his inspired breakthrough The Sixth Sense (1999), people were complaining that the twists—the already recognizable “Shyamalan touch”—had become mechanical. Shyamalan went one step further in The Village, piling twist upon twist—in a way that some resented, but for others was a inspired feat of exuberant bravado. The multi-twist in Glass is rather different. Here, Shyamalan is like a conjurer who fears his audience might be getting bored, so tugs on our coats to insist we stick around to see one more trick—then, when that wears off, tugs again and again until there are no more tricks to play.

The supreme trick in Glass consists of stuffing two entirely different rabbits into one hat and trying to convince you that they were parts of the same big super-rabbit all along. You wouldn’t think that setting two different films in Philadelphia necessarily meant that they belonged to the same fictional world, but then again, why shouldn’t Unbreakable and Split prove to fit together more than expected? Given the continuity of style between Shyamalan’s films, these two turn out to dovetail together more comfortably in Glass than all the diversely styled films that make up the Marvel Cinematic Universe. Marvel apart, I can’t think of many attempts in film to show different stories featuring different characters overlapping in the same overall world, the way that a huge cast did in Balzac’s 19th-century novel cycle The Human Comedy: Kieslowski did it in his Dekalog, although that was conceived as a self-contained series of episodes, and Jacques Demy briefly tried it in several films of the ’60s. In Glass, Shyamalan has done something comparatively modest here, and it still involves an outrageous degree of contrivance (and some crafty recycling of clips from Unbreakable).

He’s also, of course, playing one genre against another—the superhero movie against the ostensibly realistic psychological thriller—and watching their conventions (or you might say, their belief systems) clash. To pull this off, he more than once has his characters getting sudden bolts of insight while visiting comics stores or overhearing fans discuss traditional plot tropes. (I was only disappointed that the film didn’t make more of Kevin’s alter ego Mr. Pritchard, an expert in Japanese cinema: what a nice touch it would have been to hear him object, “This is not the way things would have played out in a Naruse movie!”).

Extreme contrivance apart, there’s a distinct pleasure in the simplicity and modesty of Shyamalan’s undertaking. He’s a very clean, no-frills filmmaker, perhaps not paring down his style as much as, say, David Cronenberg, yet fairly ascetic in his flashiness. Narratively and visually, he gives us the essential—and makes it very clear that we’re not going to get any more than that. He and DP Mike Gioulakis, returning from Split, provide some spare visual pleasures—from the austere images of run-down industrial Philadelphia to the unusual purple-hued scene in which Dr. Staple confronts her three patients. And, like very few filmmakers in Hollywood today, Shyamalan pursues his storytelling with ruthless application; he’s a believer in the slow burn, working up a gradual accretion of detail that all plays its part in the whole (no matter how absurd that whole turns out to be). And he believes in simple effects: not in wham-bam spectacle, which the film is adamant about denying us, but simple stuff, mostly in the form of McAvoy’s performance (one little touch, simply rubbing his feet together in one scene, is quite staggeringly creepy).

The question remains: does Shyamalan have a sense of humor? He seems to want us to think he does: the film is full of self-referential winks, and he contributes another of his over-stretched and superfluous cameos. But his humor is that of a rather earnest practical joker, a plotter of laboriously meticulous practical jokes. Mr. Glass—nothing if not a perfectionist movie director—at one point chuckles over the workings of his latest fiendish oeuvre: “I truly am a mastermind!” It’s Shyamalan’s little joke on himself, but also a piece of humblebragging that’s meant to distract us from what he really is—not a mastermind, just a talented charlatan who’s always willing to try a little harder.

Jonathan Romney is a contributing editor to Film Comment and writes its Film of the Week column. He is a member of the London Film Critics Circle.