#Kinect Help Thread
1 messages · Page 1 of 1 (latest)
hiii
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;
}```
Here is the KinectManager
Hey, I'm going to bed soon, so let's try make this fast
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
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
yea dont look at it LOL sorry
Paste in substitutions
yea so i subtted it in
and this is the output:
so the bodies aren't filled in but the bg is
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
Well there's your issue
??
How are you going to get depth from a video
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
ooo than kyou
so essentially im trying to send it it's colorDepthTexture
but clearly it's just the color
image
yea
/// <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.
Yeah found that, no script reference though so essentially useless
Weird
Anyway, that should sort you out mostly
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
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
🫣 '
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
No worries, always happy to help
I ask for help a lot here
and it's annoying to be stuck on something
q.q you're so kind thank you!!!!!
How'd it go?