Recreating surface from blury depthmap.

Hello,

Im new to shader programming but im trying to do the following:

I have a Kinect and want to scan the height of a surface.
The scanned heightmap is passed to a shader, which is applied to a plane-mesh.
This vertex-shader moves the vertices in y-Direction, depending on the value of the heightmap and calculates the normals to replicate the surface scanned by the kinect.
The fragment-shader only renders a texture.

This works fine but i have 2 Problems:

Problem 1:

I want to display my surface like it is displayed with the diffuse-shader with shadows. Writing my own shader caused my object to be rendered without lighting. Do i have to write my own lighting now?

Problem 2:

Because the Kinect-heightmap is very noisy i want to apply a gaussian blur to smooth it a bit.
I was trying to do this in the vertex-shader but it seems like i should do it in another vertex-shader which is called before, because im already calculating the normals in the current one. But the normal-calculation only works after the heightfield is finished. I read a bit about passes but a pass seems to render to the display.

It would be nice if someone could help me out.

Problem 1: no you can do this with a surface shader which will let you use any of Unity’s built in lighting models, look at the manual it has examples.

Problem 2: you might try capturing the kinect scan to a lower resolution or blitting it down before passing it to your shader, thats a cheap blur. If that won’t work you just need to sample the map and offset it several times then average all the samples, you should be able to find several simple examples of this by googling around.