Playing Kinect in Unity: How to Remove Background

I am trying to create a Unity game that uses the Xbox One Kinect (V2).

I followed the instructions in this tutorial: http://www.imaginativeuniversal.com/blog/2015/03/27/unity-5-and-kinect-2-integration/

There are two scenes in this zip file: (1) KinectView and (2) GreenScreen.

When I run the first sample (KinectView), the image looks distorted, just like the right side of the screenshot below:

enter image description here

When I run the second sample (GreenScreen scene), I get a Null frame error:

enter image description here



Now I'm not really worried about the warping issue in the first scene (KinectView). I'm interested in the "Background Removal" function in the second scene (GreenScreen). All I need to do is see how I crop the custom background.

Can anyone help me figure out how to fix this NULL MSFR Frame problem?

I have uploaded the zipped project in case anyone is interested: https://www.sendspace.com/file/j2ftqz

Many thanks.



Update:

I fiddled with some of the Shader parameters in the Inspector and noticed that all shader parameters work except DX11 \ GreenScreenShader. Some of them look like regular video capture; others are better lit (add / multiply / alpha blend / etc).

Why is the DX \ GreenScreenShader option the only one that doesn't work and instead displays no more than a pink square.

Screenshot below.

enter image description here

+3


source to share


1 answer


Open the corresponding shader in your favorite text editor and change these two lines:

1) Line 15.from Texture2D _MainTex;

toUNITY_DECLARE_TEX2D(_MainTex);

2) Line 59. from o = _MainTex.Sample(SampleType, i.tex);

too = UNITY_SAMPLE_TEX2D( _MainTex, i.tex );



Updating the shaders as shown above will fix the problem you are describing.

Secondary link / source: https://forum.unity.com/threads/kinect-v2-0-sdk-green-screen-demo-for-unity-3d-not-working-why.467687/

0


source







All Articles