Jump to content

attribPromote???


Adam Ferestad

Recommended Posts

I am trying to use a scatter node with the ptarea turned on to generate a density function on a tile that I have put together (I made a nice hexagonal grid system). I want to use this information to place buildings on each tile, but I am having trouble getting the ptarea attribute to promote onto the primitive. It is more of a learning exercise in trying to use random distributions to control structural elements of copied geometry. Anyone have any ideas how to figure out the point density on a given prim?

Link to comment
Share on other sites

hmmm... I am not sure that will do what I am trying to do. Basically, what I am trying to do is extrude a primitive based on how many points are scattered onto it. Once I have that mechanic worked out, I can do more of what I am trying to work thorough. is there any way of counting the number of points on a primitive? I have a feeling that I am simply missing an expression or something.

Link to comment
Share on other sites

It can be done, but in a very roundabout way. I hope someone can come up with a better way. :)

- Append AttribCreate SOP (to your grid) to create the primitive attribute named "prim" that is set to use $PR as its value. (NOTE: I'm assuming that you're scattering onto polygons)

- Append Facet SOP to compute normals on your grid

- Append Scatter (etc)

- Append Point SOP, with positions set to $TX-$NX, $TY-$NY, $TZ-$NZ (ie. offset the points in the reverse direction of the normals)

- Append Ray SOP, with the second input set to the Facet (aka the input of the scatter). Turn on "Import Attributes from Hits". Move the * from Point Attributes to Primitive Attributes. You now have for each point, the primitive number that it belongs to.

- Append Partition SOP (name it partition1), set Entity = Points, Rule = g$PRIM

- Go back to the Facet and branch out an AttribCreate. Set it to create a Primitive attribute with the value expression set to argc(pointlist("../partition1", "g" + $PR))

Link to comment
Share on other sites

OK, that looks really simple and strait forward, elegantly so. now I just have to figure out how to get those numbers pushed back onto the points. I am really rough with coding in general, but I think I have a feel for what the line would look like. I am assuming that I would have to make a list of the points and pull the dens attribute from the nearest prim? Unfortunately I am still rough on the syntax for doing that. This is a great learning project though, and I think it will help me get my head around Python a bit once I get it figured out. Thanks for the help guys.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...