Jump to content

# Point Cloud Normals

## Recommended Posts

Hi!

I have a problem that is really stumping me. I have a large point cloud that comes from a 3D-scanner and I want to copy small boxes onto the points. But for this I need point-normals and i can´t figure out how to calculate the normals without primitives. If someone have an idea I would be deeply grateful.

Thanks in advance!

#### Share this post

##### Share on other sites

Try converting the point cloud into a volume (with large enough contribution from each particle), and then taking a volume gradient sample from the volume.

#### Share this post

##### Share on other sites

I guess you've already tried this, but doesn't the point sop work in this case? add normal should do it, right?

#### Share this post

##### Share on other sites

I guess you've already tried this, but doesn't the point sop work in this case? add normal should do it, right?

The question I guess is not to add normals (you can always do that), but how this normals should look like. Volume Gradient will compute local density change at the point cloud border, so normals could point "outside" the point cloud.

edit: wouldn't be natural to just skin them, and transfer normals from skinned version back? Volume from a thin layer of point cloud might goes wrong...

Edited by SYmek

#### Share this post

##### Share on other sites

you you want to make sure your mesh is consistent use particle fluid surface instead of iso-offset/pointcloud

#### Share this post

##### Share on other sites

hi,

Base of what Icarus said, here a hip file with a point cloud (from brekel kinect) where I transfer normal from a particle fluid object node to the points.

have fun

Thomas

NormalTransfert_v1.rar

#### Share this post

##### Share on other sites

you could do this by estimating tangent planes to your pointset. just calculate a covariance matrix and search for the eigenvectors with the lowest eigenvalue.

its fast and robust. the only drawback is that there is no way to define if the normals are pointing inside or outside for a general set of points. you could dot product the normals to the vector(camera - P) or use the centroid of your pointcloud to find the wrong oriented normals but this doesn´t work for all cases. and if it does not you´ll have to check normals of neighbouring points and reorient them.

hth.

petz

EDIT:

increase max_points to something around 100 in the example file!

normals1.hip

Edited by petz
• 5

#### Share this post

##### Share on other sites

thanks petz! I've never thought you can actually compute covariance in VEX... arrays make a difference!

skk.

#### Share this post

##### Share on other sites

wow petz, far away to my mathematical skill !!

thk it opens my mind !

Thomas

#### Share this post

##### Share on other sites

very nice example petz

I've just added visualization node for normals, to see the effect

normals1_vis.hip

• 1

#### Share this post

##### Share on other sites

hey it's me, what handsome guy, even though a little spotty

when we compare the lighting visualization with your scene Anim, between "transfert normal from particle fluid" and the "covariance matrix", the covariance's method gives much better results !

have fun,

Thomas

Edited by papicrunch

#### Share this post

##### Share on other sites

WOW! Thank´s to everyone who has responded. This thread is the answer to all my questions I was going to ask.

Thank´s to Papicrunch for the file. I was on the way to do it like you did but could not get it to work. And thank you Anim for the idea to preview the points as particles.

And a big THANK´S to you Petz! You provided me again a solution that does exactly what I was looking for and again I don´t understand not a bit of it.

The best thing is that your example solves two problems for me. First off, it gives me the normals. And second: all these small steps and irregularities in my pointcloud are smoothed out if I use the "project_point" toggle.

Thank you very much!

Edited by resonanz

#### Share this post

##### Share on other sites

WOW! Thank´s to everyone who has responded. This thread is the answer to all my questions I was going to ask.

Thank´s to Papicrunch for the file. I was on the way to do it like you did but could not get it to work. And thank you Anim for the idea to preview the points as particles.

And a big THANK´S to you Petz! You provided me again a solution that does exactly what I was looking for and again I don´t understand not a bit of it.

The best thing is that your example solves two problems for me. First off, it gives me the normals. And second: all these small steps and irregularities in my pointcloud are smoothed out if I use the "project_point" toggle.

Thank you very much!

you´re welcome!

petz

#### Share this post

##### Share on other sites

thats some wizardry math right there, pure wizardry

#### Share this post

##### Share on other sites

I had a need for this recently and fixed some tiny vex issues in Petz file so it works with H12 in case anyone wants it.

normals2.hip

• 3

#### Share this post

##### Share on other sites

Sorry for raking up this old topic but I am again in a situation where I need to calculate point normals for a huge 3D-scan dataset. This time it is very important to have the normals ALL pointing outward, what is not possible to achieve with this method (AFAIK). What would be the best way to get normals with consistent orientation?

Thank´s in advance!

#### Share this post

##### Share on other sites

well, it depends on the data. assuming you have a rather smooth pointcloud you could recursively check normals of neighbouring points and reorient them if necessary. it´s easy to implement and quite fast (hdk) but not always usable for more complex datasets. another option would be to mesh the pointset using a surface reconstruction algorithm (most probably power crust) this would be alot more work to implement, though...
however, since you need to code it in the hdk anyway you might want to take a look at pcl  (point cloud library). it does everything you need, and if i remember correctly, it is available even precompiled on their website.

petz

#### Share this post

##### Share on other sites

Hi all, just want to point anyone looking to solve this problem to this blog post by Jake Rice: https://jakerice.design/2018/09/19/Covariance-and-Principal-Component-Analysis/, which uses the covariance approach and some other fancy stuff to compute accurate (or close to accurate... how do we determine accuracy again?) normals.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

×
• Donations

• Leaderboard