I’m new to using nuitrack and was wondering if it is possible to do something like this
Ive gotten to changing a color of a quad based on its depth value but am facing the issue of not knowing how to tell unity that certain areas are lower than another and to change the area accordingly
So ive managed to get to this point but now i am facing a new issue where the color stays after leaving the depth zone as shown in the video, is there a way to remove the coloring if the player leaves a certain area to not cause overlaps?
Heres a better visualization of the goal i have in mind, right now it only works with a single color but i want it to do the same but with different colors on different layers
This can be done by normalizing the depth for each pixel and matching this value with the gradients of your colors.
If you use the Point Cloud tutorial as a starting point, then you need to do the following:
Change the texture format for depth Texture to
depthTexture = new Texture2D(cols, rows, TextureFormat.ARGB32, false);
Add fields for gradient and maximum recognizable depth.
[SerializeField] Gradient depthGradient;
[SerializeField] float maxDepthSensor = 8f;
Use the conversion of the depth value to color via a gradient.
depthColors[pointIndex] = depthGradient.Evaluate(depthFrame[i, j] / (maxDepthSensor * 1000));
Adjust the gradient to your liking.
However, conversions to Point Cloud are not optimized and will heavily load your system. We will develop the most productive solution and offer it to you later.
Thanks alot for the solution it worked perfectly! One more thing to add would be instead of the display being pixels is it doable for solid colors instead to make the object and background be a smoother look
Yes, of course, you can change the gradient colors and make a smooth transition as you require.
We have prepared an optimized CPU solution for you.
Your question prompted us to improve the depth map display module and soon, methods for obtaining a depth map with arbitrary coloring will become part of NuitrackSDK.
Thank you for using NuitrackSDK!
As for the smoothness, what I was thinking of was instead of it being pixels adjusted to color could it be a solid color instead
This can be easily done by switching the gradient mode to Fixed.
If you need one color of different tones, then it can also be adjusted using a gradient by setting the necessary color keys. This is a very flexible system, experiment.
As for this package I am currently using unity version 2019.4.29f1 and it says the package was built for a newer version is there a way to get it to work for my version or do I have to update?
I use 2019.4.29f1 as its more stable with less bugs
Check out this package built for Unity 2019.
NuitrackSDK latest version is aimed at Unity 2020.3.1f1 and higher. Using earlier versions may cause errors and unstable operation.
We use this version as the most stable and tested for NuitrackSDK.
We recommend that you use 2020.3.1f1.