the wii u has the main ram, and the gpu vram. The PS4 has 8 gb total, 1 gb for OS, and is sharing the remainder of the ram between graphics, data processing, phjysics, etc. So in essence, the PS4 doesn't have 7 GB to dedicate to just graphics, etc, but is sharing them amongst several areas. Thus, the Wii U can still perform a lot of the core functions, with less shaders, lower LOD, and so forth. It really just comes down to engine scalability. A good scalable engine can run the same game on 2 differently powered systems with little issue.
The Carnival of Shadows - Folk Punk from Asbury Park, New Jersey
http://www.thecarnivalofshadows.com