Hello all,
I hope someone knows the answer to this.
1: I have a horizontal line aligned to Z-axis.
2: I create a tube out of it using the polywire node.
3: Using mountain sop using the defaults I create some noise on it(almost looks like periodic noise) and I just reduce the frequencey
of noise by increasing the Element size parm, nothing fancy.
4: Using points from volume node, I scatter some points inside this noisy tube.
5: I calculate the near distance, from the line to the point cloud like so:
int nearpt = nearpoint(1, @P);
vector nearpos = point(1, ‘P’, nearpt);
f@near_dist = distance(@P, nearpos);
6: Now that I have the distance, what I want to do is normalize this distance. Which means creating value of 0(from the horizonatal line) to 1(outer edge/periphery of the noisy tube).
7: To “normalize” this value of f@near_dist I use the fit function, fitting f@near_dist from its min_value to it's max_value to 0-1.
This here is the problem. I don't seem to get proper distribution of values from 0-1 within this point cloud. The value on the outer edge of the noisy tube is anywhere from approx 0.1-0.98. I need those values to be 1 so that the point cloud has values from 1(from outer edge) progressively decreasing to 0(which is the core of the point cloud/line). Imagine if you take a cross-section of this tube in any section, the value should always go from 0(in the center) to 1(outermost radius), no matter where the cross-section is.
I also tried using sdf's. But I can't have an sdf so high-res as to give me an accurate gradient within the point cloud.
So my question is what is the way in which I can achieve this normalization of the f@near_dist?
Looking forward to your answers, I have attached a file for your reference.
Cheers!
How to normalize distance within a point cloud?
2443 1 0- MrReedSmith
- Member
- 49 posts
- Joined: Sept. 2013
- Offline
- animatrix_
- Member
- 4698 posts
- Joined: Feb. 2012
- Offline
Hi,
That's because you are normalizing across all points. You need to normalize each cross section separately. I made some changes to achieve that. Unfortunately Attribute Promote can't promote point pieces separately, they have to be primitives. So you have to loop through each cross section or write some VEX code to do the promotion (slow).
That's because you are normalizing across all points. You need to normalize each cross section separately. I made some changes to achieve that. Unfortunately Attribute Promote can't promote point pieces separately, they have to be primitives. So you have to loop through each cross section or write some VEX code to do the promotion (slow).
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
-
- Quick Links