#Kinect Help Thread

1 messages · Page 1 of 1 (latest)

delicate sparrow
#

Kinect Help Thread

strong pier
#

hiii

delicate sparrow
#
fixed4 frag (v2f i) : SV_Target
            {
                // sample the texture
                fixed4 mainColor = tex2D(_MainTex, i.uv);

                float2 flippedUv = float2(i.uv.x, 1- i.uv.y);
                fixed4 depthColor = tex2D(_DepthTex, flippedUv);

                //float mainLuma = (0.299 * mainColor.r) + (0.587 * mainColor.g) + (0.114 * mainColor.b);

                float depth = depthColor.r; // maybe this is enough, maybe we need to average the rgb components?
                
                return depth;

                int _DepthThresholdMm= 1000 * _DepthThreshold;  
                //True means second
                //false = first

                //depth <= 1000 && depth >= -1000
                bool zCheck = depth <= _DepthThreshold*1;

                fixed4 maskedColor = lerp(_BackgroundColor, mainColor, zCheck);

                return maskedColor;
            }```
strong pier
delicate sparrow
#

Hey, I'm going to bed soon, so let's try make this fast

strong pier
#

Essentially from it I just get the sensorData as a texture

#

oops sorry

#

is the code you sent me the one i sent or with changes
Sorry can't tell

#

ok nvm

delicate sparrow
#

Yeah this is thousands of lines but I can't imagine there's much useful in it shader wise anyway

#

And yeah my code is new

strong pier
#

yea dont look at it LOL sorry

delicate sparrow
#

Paste in substitutions

strong pier
#

yea so i subtted it in

#

and this is the output:

#

so the bodies aren't filled in but the bg is

delicate sparrow
#

Okay that officially makes 0 sense

#

New test

#
          fixed4 frag (v2f i) : SV_Target
            {
                // sample the texture
                fixed4 mainColor = tex2D(_MainTex, i.uv);

                float2 flippedUv = float2(i.uv.x, 1- i.uv.y);
                fixed4 depthColor = tex2D(_DepthTex, flippedUv);

                //float mainLuma = (0.299 * mainColor.r) + (0.587 * mainColor.g) + (0.114 * mainColor.b);

                float depth = depthColor.r; // maybe this is enough, maybe we need to average the rgb components?
                
                return depthColor;

                int _DepthThresholdMm= 1000 * _DepthThreshold;  
                //True means second
                //false = first

                //depth <= 1000 && depth >= -1000
                bool zCheck = depth <= _DepthThreshold*1;

                fixed4 maskedColor = lerp(_BackgroundColor, mainColor, zCheck);

                return maskedColor;
            }```
#

Also nvm what I just said

#

i sent you bad code

#

Try that, send me a quick ss

strong pier
delicate sparrow
#

Well there's your issue

strong pier
#

??

delicate sparrow
#

How are you going to get depth from a video

strong pier
#

OH that it's giving me the entire image

#

instead of JUST the depth?

delicate sparrow
#

I'm assuming it has it's own depth image it creates from it's infrared sensors etc

#

You're either passing in the wrong one, or I'm not sure

strong pier
#

ooo than kyou

#

so essentially im trying to send it it's colorDepthTexture

#

but clearly it's just the color

#

image

delicate sparrow
#

Who wrote this kinectmanager thing

#

are there docs

strong pier
#

yea

delicate sparrow
#

        /// <summary>
        /// Gets the depth image texture.
        /// </summary>
        /// <param name="sensorIndex">The sensor index.</param>
        /// <returns>The depth texture.</returns>
        public Texture GetDepthImageTex(int sensorIndex)
        {
            KinectInterop.SensorData sensorData = GetSensorData(sensorIndex);
            return sensorData != null ? sensorData.depthImageTexture : null;
        }

        /// <summary>
        /// Gets the infrared image texture.
        /// </summary>
        /// <param name="sensorIndex">The sensor index.</param>
        /// <returns>The infrared texture.</returns>
        public Texture GetInfraredImageTex(int sensorIndex)
        {
            KinectInterop.SensorData sensorData = GetSensorData(sensorIndex);
            return sensorData != null ? sensorData.infraredImageTexture : null;
        }```
#

These two methods looking promising.

strong pier
delicate sparrow
#

Yeah found that, no script reference though so essentially useless

#

Weird

#

Anyway, that should sort you out mostly

strong pier
#

yea so the reason i choose :

sensorData.colorDepthTexture

is because it essnetially should output:

#

like if I just use the sensorData.infraredImageTexture

then i'll get a weird clipping Like it's a hexagon since that's how the sensor works

whereas if i use the colorDepthTexture it'll give me a full image

#

i just thought i wasn't thresholding correctly from it

delicate sparrow
#

I say just mess with getting different textures from your kinect manager until you find one that works for you, or that matches what you expect

#

And yeah this is why we start simple

strong pier
#

🫣 '

delicate sparrow
#

you try do everything at once you don't know what's wrong

#

I'm lucky I displayed the depth texture first, could've not discovered that for an hour

#

In any case good luck finding the texture you want, let me know if you need further help debugging once you've found it etc

strong pier
#

thank you!

#

sorry to bother you right before you sleep!

delicate sparrow
#

No worries, always happy to help

#

I ask for help a lot here

#

and it's annoying to be stuck on something

strong pier
#

q.q you're so kind thank you!!!!!

delicate sparrow
strong pier
#

I wasn’t able to look at it since we spoke, but yea you were right! I have to use a different data type since the input is wonky.

One thing I did want to do though is actually chromakey the video so that it’s transparent

#

Let me send that when I get back