Material to Render uv coordinate for any object in scene

Hi, I need some help.
I need to create a material to render uv coordinate for any objects in scene. Like this example.

and the result is this

But this material is not right. There is still a lack of information for the mapping to be correct. Can anyone give any idea what to do?

I need something like Corona Render uvwcoordinate, This result is exactly what I need.

Does anyone have any idea how I can proceed?