hiya,Iam a vvvv beginner.
I am trying to use Depth (Kinect Microsoft) and a “VectexData.fx”(which refer to @herbst)to display the pointcloud.
But now the obtained results are as follows.
It is obvious I have failed.
Hope someone can help me to achieve the pointcloud with vvvv.
thanks
//@author: vvvv
//@help: draws a mesh with a constant color
//@tags: template, basic
//@credits:
// --------------------------------------------------------------------------------------------------
// PARAMETERS:
// --------------------------------------------------------------------------------------------------
//transforms
float4x4 tW: WORLD; //the models world matrix as via the shader
float4x4 tV: VIEW; //view matrix as set via Renderer (EX9)
float4x4 tP: PROJECTION; //projection matrix as set via Renderer (EX9)
float4x4 tWVP: WORLDVIEWPROJECTION; //all 3 premultiplied
//texture
texture Tex <string uiname="Texture";>;
sampler Samp = sampler_state //sampler for doing the texture-lookup
{
Texture = (Tex); //apply a texture to the sampler
MipFilter = LINEAR; //set the sampler states
MinFilter = LINEAR;
MagFilter = LINEAR;
};
//texture transformation marked with semantic TEXTUREMATRIX
//to achieve symmetric transformations
float Amount = 0.1;
- define ArrSize 20
float2 Noise[ArrSize](ArrSize);
float4x4 tTex: TEXTUREMATRIX <string uiname="Texture Transform";>;
//the data structure: "vertexshader to pixelshader"
//used as output data of the VS function
//and as input data of the PS function
struct vs2ps
{
float4 Pos : POSITION;
float2 TexCd : TEXCOORD0;
};
// --------------------------------------------------------------------------------------------------
// VERTEXSHADERS
// --------------------------------------------------------------------------------------------------
vs2ps VS(
float4 PosO : POSITION,
float4 TexCd : TEXCOORD0)
{
//declare output struct
vs2ps Out;
//get the color in the texture
float4 texColor = tex2Dlod(Samp, TexCd);
//offset the z coordinate
PosO.z += texColor.r * Amount;
PosO.xy += Noise[TexCd.x * (ArrSize-1)](TexCd.x * (ArrSize-1));
//transform position
Out.Pos = mul(PosO, tWVP);
//transform texturecoordinates
Out.TexCd = mul(TexCd, tTex);
return Out;
}
// --------------------------------------------------------------------------------------------------
// PIXELSHADERS:
// --------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------
// TECHNIQUES:
// --------------------------------------------------------------------------------------------------
technique TSimpleShader
{
pass P0
{
VertexShader = compile vs_3_0 VS();
PixelShader = null;
}
}
pointcloud of kinect.zip (6.4 kB)