create nodes at points

   2404   7   1
User Avatar
Member
5 posts
Joined: Oct. 2014
Offline
Hello everyone I'm a new user and I'm having quite a hard time doing something that i thought would be relatively simple.

I have a height map that i'm placing on a grid and the final result is that i need to export each individual primitives projected texture information individually.

currently I am creating another grid that encompasses the source asset and creating center points for each primitive on that grid. Then creating a new grid node for each point and placing it at each points position via an expression.

ex. point(“/obj/Terrain_From_Image/MASTER_GRID”,6,“P”,0)

I've been trying to make a shelf tool that will,

“for each point in MASTER_GRID create a new grid node”

and for the life of me i'm having a terrible time trying to get this to work.

the MASTER_GRID and the new grid nodes need to be in the same network because i'm using attribute transfer to get the height map info and then the uvpointcloud qLibs to extract the color to a texture.

If anyone has a better way i'm all ears as well.
Please help this noob Thanks in advance!
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
I think I can help, but I am not sure I understand what you want to achieve. Could you maybe post a file or elaborate on what you have and and what you want to do with it?
User Avatar
Member
5 posts
Joined: Oct. 2014
Offline
essentially outside of houdini I have a “tile system” for terrain that i'm working with and for better fidelity the tile size can be dynamic.

I'm trying to use houdini to make a procedural solution for cutting up a height map into tiles of a given size so that I can use houdini to process the height map and then export each tiles information separately to be used in the other tool.

I am creating and mapping the processed height map to a grid of the same dimensions and row/column density as the height map.

I then have made an asset that you tell it the tile size you're wanting to work with and feed it the COP out of the processed height map and it makes a grid that is evenly divisible by the tile size.
my expression for the tile size in X:
ceil(max(res(chsraw(“../imageOutputPath”), 0),res(chsraw(“../imageOutputPath”), 1))/ch(“../tileSizeX”))*ch(“../tileSizeX”)

I am feeding this grid tool into a point wrangle SOP with this expression to create points in the center of the primitives:
addpoint(0, @P);
removeprim(0, @primnum, 1);

and then… i'm currently manually creating grids to the defined grid size and setting their positions to the original grids center points.

I am then using the attribute transfer SOP to transfer the information from the height map geo to my new grid tiles that were hand placed.

and using the uvpointcloud tools from qLibs to take the cd values on each tile and turn them into a texture with the uvpointcloud COP counterpart for export.

Originally I used the copy node for placement but couldn't figure out how to export the transferred information per copy. so if there is a way to do that i would love to know. also if there was a way that I could export by primitive that would also be awesome to know :p


I would love to know how to access the points of a given object from a level outside of a SOP node, example: from a shelf tool, and say,
for each point in grid1:
createNode(new grid)

from there I can do the node connections and network building.
sorry no file but it's for work
User Avatar
Staff
3455 posts
Joined: July 2005
Offline
can you make a simple example
a 10x10 heightmap etc…
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
I suggest using a ForEach setup. For each new tile, take the original geo, process it and merge all iterations.
Look into the clip SOP. Also, you can transfer attributes based on proximity and or UVs with attribute transfer SOP or with VOPs (check out this thread: https://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=30235&highlight= [sidefx.com] )
- You can go creative with this stuff and store height values in a new attribute, flatten the object, transfer the height attribute to a flat gird and deform that grid based on the height attribute…

Maybe this gives you some ideas.
User Avatar
Member
5 posts
Joined: Oct. 2014
Offline
thanks for responding everyone!

So i'm sorry for the confusion, but I have this all working manually, but I'm trying to automate the creation of the actual grid nodes based on the number of points of another grid.

I would like to do it in python and use it from a shelf tool, but I have no idea how to access the number of points of a grid node that already exists.

Thanks again for your patience.
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
You don't need to make a python shelf tool. You can just make a digital asset (pretty much your own SOP node) and place it when you need to do this thing again with different parameters.
User Avatar
Member
5 posts
Joined: Oct. 2014
Offline
len(yourNode.geometry().iterPoints())

will give you the number of points of a given geometry node.

Thanks for all your help! I really mean it
  • Quick Links