another way to create an array of meshes?

imdingimding Posts: 16
edited August 2016 in Canvas Standalone

hello, I'm trying to do some exercises with arrays, so I made this stacking planes thing. but as I understand this is not really an array right? I don't have control over each individual plane (size, colour etc).

any tips on how I can achieve the same but with full control over every entry in the array? thanks!!

Edit: I don't resist coding, so if this is best shown with a few lines of code, please do :D

Best Answer

  • malbrechtmalbrecht Fabric for Houdini Posts: 752 ✭✭✭
    Accepted Answer

    Hi,

    each plane would have an index so I can control each plane's colour, scale, rotation etc...

    yup ... that you would not want to do "inside the mesh", but as an "abstract" (speak: procedural) approach. So you'd modify offsets and other data "outside" the polygonmesh (piping offsets into the Xfo) and use the polygonMesh as the "final destination container" that presents the conglomerate.
    Addplane doesn't need an empty mesh layer (as it simply adds geometry to a polygonMesh), but it needs a polygonMesh to add planes to. Doing that in a loop (is exactly what the addplanes-Xfo-array-based preset does) works, but you need to supply the same polygonMesh from the outside of the loop (as an exposed input port).

    Marc


    Marc Albrecht - marc-albrecht.de - does things.

Answers

  • malbrechtmalbrecht Fabric for Houdini Posts: 752 ✭✭✭

    Hi,

    well, you do have an array there - the Xfo "stack" is an array that you are filling with the offset coordinate (y) for the plane. You are merely merging the planes into a single mesh.
    In that respect ... what do you mean by "not really an array ... control over plane". You do have control over each plane, since you are creating each plane from scratch, just filing it (through the Xfo array) into a single polygonMesh.

    Maybe this helps:

    A polygonMesh is a container, like an "item" in some DCC. It is meant to contain polygonal data, made from points and connections between points (aka "edges", though Fabric does not know edges as entities).
    What you put into that container is up to you. You can even merge several polygonMesh containers into one (mergemeshclones), which means that the point and connection information from all containers (polygonMeshes) involved get copy/pasted into a single target polygonMesh.

    Therefor: You do have full control over every single point in a polygonMesh. You can read out the connections in that mesh, so you also have full control over, say, planes. Since you are creating the mesh content yourself, you can do to the planes whatever you want before you merge them down. If you keep track of the points created, say in another array of point indices, you'd also be able to change the planes inside the polygonMesh container after you merged them.

    Fabric's documentation is quite elaborate on that topic, just have a look at the polygonMesh topic.

    I hope this is of some help?

    Marc


    Marc Albrecht - marc-albrecht.de - does things.

  • imdingimding Posts: 16

    Thanks Marc, really appreciate you taking the time to help, I read your post on your particle system but that's way above my level XD

    Ah I see, I have an array of Xfo but not an array of planes, which I want to modify individually (for example map a sine function to their scale attribute so they appear wavey).

    I tried to make a counter and run AddPlane in a ForLoop, each plane would have an index so I can control each plane's colour, scale, rotation etc... but AddPlane needs EmptyPolygonMesh to work, having that in a ForLoop just don't give me multiple planes. regarding the documentation, I'm digging through it to see if I can do this in code (wish me luck).

  • imdingimding Posts: 16
    edited August 2016

    `require Geometry;

    dfgEntry{

    Xfo newPos=root;
    
    for(Size i=0; i<arraySize; i++)
    {
        this.addPlane(newPos, length, width, lengthSections, widthSections, setNormals, setUVs);
        newPos.tr=root.tr+(offset.tr*(i+1));
    }
    

    }`

    that was it, a modified addPlane node did the trick. Thank you Marc.

Sign In or Register to comment.