Scattering points onto geometry with normals

   14818   4   1
User Avatar
Member
23 posts
Joined: Nov. 2007
Offline
I received some good answers to my first question on “Converting primitive normals to points with matching normals”, so I thought I'd ask another similar question.

When scattering points onto geometry with the Scatter SOP, how do I then get the scattered points to adopt the normal of the primitive onto which they were scattered? Essentially I'm trying to copy sub-geometry onto non-planar parent geometry, and I want the sub-geometry to orient itself to the parent geometry's primitives. I thought that transforming using template point attributes (on the Copy SOP) would be the way to go - but I can't figure out how to ‘rotate’ the scattered points (i.e. assign the appropriate normal) as appropriate to the parent primitive's normals.

Any thoughts?

YBM
User Avatar
Member
27 posts
Joined: Feb. 2009
Offline
Here's an example file that I think should answer your question.

a few things to note:

-the node “do_scatter_pre_copy” is a switch node. Set it to “1” to do the scatter before the copy, “0” to do the scatter after the copy.

-in the copy node called
“normals_overriden_by_template_normals_on_attribute_tab” you'll see the normals have been copied over from the template normals and are overriding the normals from the “sub geometry” Note how you can set normals, multiply normals, add normals, and subtract normals. In this case the normals are being set using the template geometry and applied to the “sub geometry” points.

Attachments:
scatter_normal_example.hip (215.9 KB)

User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
The key to getting the new points normals to be aligned with the surface is to just make sure the points on your sphere have the proper normals before scattering. If your surface has point attributes, these attributes will be interpolated for the scattered points. In the attached file each primitive is given Unique Points to separate them from each other so that when applying point normals all the normals for each primitive are all exactly the same as the surfaces normal. When scattering these values are picked up and the new points will have the same normal as the surface the point is being scattered on.

Attachments:
scattered_points_with_normals.hip (204.4 KB)

Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
23 posts
Joined: Nov. 2007
Offline
Thanks to chopstix and graham. Both solutions answer my question, although as I can see from the solution files, graham's is more elegant, using the built-in functionality of the Scatter SOP to adopt point normals provided that vertices are made unique and their normals are recomputed. I did not realise that this procedure was necessary to use the scatter SOP in this manner.

Thanks!

YBM
User Avatar
Member
27 posts
Joined: Feb. 2009
Offline
Ah, I didn't realize that's what you were asking. I thought you already had your normals from your primitives on the points and wanted to know how to transfer those normals to your sub geometry in a copy. Glad you got the answer you were looking for.
  • Quick Links