Currently i'm doing some image processing on depth map (using OpenNI and XTion)
My depth map size is 320x240 (cannot make it 640x480 due to performance issue since we're developing a game)
The image processing should be real-time so it's fully written in fragment shader.
I generate normal map using simple cross product of 8 neighbouring pixels

Since the depth is noisy, i do a hack, so i calculate the 8 pixels like this
[source lang="cpp"]float step = _range/512.0; // 512.0 is tex sizefloat4 top = tex2D(_SubTex, float2(i.uv.x, i.uv.y - step));float4 right = tex2D(_SubTex, float2(i.uv.x + step, i.uv.y));//and so on....[/source]
i can adjust the _range variable and looking for farther pixels
Here's the result (raw depth map, now prepocessing at all)

2nd result (5x5 bilateral filter is applied first)

My approach to estimate normal is kinda stupid and i need suggestions to do it in a better way
And also i'm considering to apply 5x5 median filter (i've tried 3x3 media filter but it's too small to remove noise) but it will be difficult to use such a huge 5x5 window due to implementation and performance issue

Find content
Not Telling


