Adam Ferestad Posted August 11, 2011 Share Posted August 11, 2011 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? Quote Link to comment Share on other sites More sharing options...
Macha Posted August 11, 2011 Share Posted August 11, 2011 Hey Adam, it's a little silly but how about copy stamping a tiny square (=primitive) on each point, then attribute transfer the primitive attribs to the geometry and attribute promote (sum) the attributes. Quote Link to comment Share on other sites More sharing options...
Adam Ferestad Posted August 12, 2011 Author Share Posted August 12, 2011 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. Quote Link to comment Share on other sites More sharing options...
edward Posted August 12, 2011 Share Posted August 12, 2011 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)) Quote Link to comment Share on other sites More sharing options...
petz Posted August 12, 2011 Share Posted August 12, 2011 here´s another way with a little help of pyhton. hth. petz dens.hipnc Quote Link to comment Share on other sites More sharing options...
Adam Ferestad Posted August 13, 2011 Author Share Posted August 13, 2011 petz, that is doing exactly what I am looking for, unfortunately I have never edited Python in Houdini, so I am having some trouble seeing what you did. How do I see the python code? Quote Link to comment Share on other sites More sharing options...
zarti Posted August 13, 2011 Share Posted August 13, 2011 ... . How do I see the python code? > rightClick over the node > Type Properties .. > select Code tab .cheers Quote Link to comment Share on other sites More sharing options...
Adam Ferestad Posted August 14, 2011 Author Share Posted August 14, 2011 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.