I think it's a bit of both - his game improved a bit - mainly his serve got back to normal after the awful 2010 & then his confidence just soared after Davis Cup 2010 and Aus Open 2011. Beating Nadal in those finals also helped his confidence - if he'd lost Indian Wells or Miami I don't think we'd have seen quite the dominance from him - as Nadal might have had a different attitude in the clay finals for example. It's clear that for players like Nadal & Djokovic their mental state and confidence affects them a lot - they've said as much in interviews...
But it's also a bit to do with Fedal declining - Novak had no chance at RG & Wimbledon in 2008 - Fedal (or mainly Rafa at RG) too good, in 2009 he had chances & should have capitalised on Nadal losing early in RG but didn't & in 2010 his serve was terrible - that's not bad luck. If he was facing 2006/2007 Federer or 2008 Nadal would he have been as dominant as he was last year? No. Doesn't mean he's not playing fantastic - after all 2008 Nadal didn't face this Novak; but to say his lack of GS wins was to do with luck is silly - he had good draws, was no. 3 in the world yet failed to win a slam or even reach a final for nearly years. For a player of his calibre to take another 11 slams to get to a final after winning the Aus Open 2008 was a waste of talent and no one's fault but his own.
The only thing you could say he was unlucky about was to keep falling into Roger's half at the US Open - if he'd been in Nadal's half he'd have got to the final again before 2010....
Anyone that has followed Nole going back to beginnings knows that he didn't improve, he always had the same capabilities but just matured and stopped being bothered by outside influences. His forehand/backhand and everything else is the same now as it was 5 years ago. There were lots of things happening outside the court that influenced his decline from 2008-2010 and finally he stopped being bothered by it and concentrated on playing .
He was losing to so many different players and even winning some difficult games because he was not in it mentally. He wasn't losing to Federer/Nadal but to Roddick, Tsonga, Kohlschreiber, old Haas, Safin and many others. It's a wonder and a testament to his talent that he stayed relevant during that time.
Now I don't know how that lull is going to influence him in his future. Obviously those times were lean times and he remembers them and stays hungry or he could be hit by short term success and never win again.