Jump to content
Azuril

Building a relatively simple building facade system for placement of premade modular pieces.

Recommended Posts

Hello,

I am relatively new to houdini - I have used it years prior for some things but now I have just acquired an indie license for development of my unreal game. At the moment I am making a building facade system that will place premade modular pieces depending on a few variables.
I was hoping that perhaps some guru's could peruse this little plan i have drawn up for how i envision it to work.

at the moment I am trying to workout step 4 by using bounding boxes made from the original geo to select the new resampled walls and place them into sections. I want to bound them and in the groupSOP name the sections per iteration of the foreach node they are inside. finding the correct syntax for this has been a problem so any help would be greatly appreciated.

Ill be keeping this thread alive over the course of my findings.

Cheers
Az

buildingfacades.jpg

BuildingGenerator.hiplc

  • Like 1

Share this post


Link to post
Share on other sites

Ok, so looks like the trusty facet with cusp polygons enabled gives me the sections! *so simple*

Now I am trying to do step 7 - randomly picking pairs and triplets of faces and grouping them, leaving the stragglers as 1x pieces..

any ideas let me know.

Share this post


Link to post
Share on other sites

Here is a possible solution for step-7.

Using custom code in detail mode of a wrangle. Here a random number is generated 0-2. Then each primitive is skipped for that amount of primitives and then added to a related group. After processing three groups are available. typeOne, typeTwo, and typeThree. Then you can proceed to step-8 processing.

untitled-1.jpg

ap_BuildingGenerator_STEP-7.hiplc

Edited by Atom
  • Like 1

Share this post


Link to post
Share on other sites

Thats fantastic thanks @Atom!

Im using it now, but am trying to change it so that sections of 1 will show up more often. It seems extremely rare. maybe its just the nature of the algorithm that you get 1's bunched together because they skip past the prims that have already been allocated?

On the note of this, how do I go about then detatching the primatives by group? I can easily enough make all new groups using a partition.. but ideally I would want to break off the edges seperately (done using a group by edge angle, step 6 ) then copying that group back to the sectioned prims (step 4) so then i am left with the correct sections, but an attribute on the edge boundaries.

Now I am looking to separate all of the different parts by edge and type (1/2/3 width)

 

Share this post


Link to post
Share on other sites

I did notice that section 1 were not generated that often. I guess it is because there is no need to implement the counting step if you have one section. Just add it directly to the group and reset for the next possible section count.

int panel_count = 0;
int panel_match = -1;
float rnd_seed = ch("rnd_seed");
vector rnd_Cd = set(0,0,0);

for(int i=0; i<nprimitives(0); i++) {
    if (panel_match==-1) {
        // Time to randomly pick a new count to match for the next set of primitives.
        panel_match = int(fit01(rand(rnd_seed+i),0,2));  
        rnd_Cd = set(rand(rnd_seed+i+801),rand(rnd_seed+i-311), rand(rnd_seed+i+512));
        setprimattrib(0,"Cd",i,rnd_Cd,"set");
        panel_count = 0;
        if (panel_match==0) {
            setprimgroup(0, "group_typeOne", i, 1, "set");
            panel_match=-1;
        }
    } else {
        // We are in the middle of a count, time to increment.
        panel_count += 1;
        if (panel_count > panel_match) {
            // We have matched our count, reset so we can pick a new count  on next loop.
            panel_match = -1;
        }
        setprimattrib(0,"Cd",i,rnd_Cd,"set");
    }
    if (panel_match==0) setprimgroup(0, "group_typeOne", i, 1, "set");
    if (panel_match==1) setprimgroup(0, "group_typeTwo", i, 1, "set");
    if (panel_match==2) setprimgroup(0, "group_typeThree", i, 1, "set");
}

 

Edited by Atom

Share this post


Link to post
Share on other sites

5a8e83fa5c75c_pointsortissue.thumb.jpg.6e201f5c912ae69584cff5ff55b84a49.jpg
O
K! step 8. I have a way to extract the lowest point and make a new one to be used as the copy stamp position for switching out modular pieces - almost there!

The last 4-5 hours or so Ive been banging my head around trying to sort out how to sort these points so they are ALWAYS the lowest in the bottom left corner (when looking from the front)
The way in which I would like to do this, and have been searching around an answer for - is to use the sort by vector, and have the vector at 1,1,0 assuming the normal is 0,0,1

How one goes about this though is a complete mystery to me. perhaps packing the pieces, rotating them to 0,0,1 - doing the sort then unpacking and returning the original rotation could be an option?

How would one go about this? Otherwise if there is a more elegant solution I would love to know...

Thanks

BuildingGenerator.hiplc

Edited by Azuril
added hip

Share this post


Link to post
Share on other sites

hi,

 

all that is very interesting.

that's funny because i'm working on something very similar.

i've not choose exactly the same way, but the idea is the same .

now, i'm at time to create switch to replace ramdomly (or choosen by user) each part.

 

mytry.JPG

Share this post


Link to post
Share on other sites

some news: i have ended my first try:

 

@fenolis... what is your question ?

 

 

first_end.jpg

Share this post


Link to post
Share on other sites

Ah. I was replying to a comment >2 months old regarding the point sorting order. I thought perhaps sorting by uvs would cause the smallest number to always be in the same position.

Edit: Cool model, by the way. Missing proper normals on the windows but I like the style!

Edited by Fenolis

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×