Jump to content

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


Azuril

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
Link to comment
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.

Link to comment
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
Link to comment
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)

 

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

  • 1 month later...

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
Link to comment
Share on other sites

  • 1 year later...

@domsewell  you can have some lists of choice in the UI  of your asset. you can construct this list by looking in a directory in python and offer the choice to the user to use a geometry or an other. and more, you can dynamically change the UI to offer to the user, some choice for each part you want.

Link to comment
Share on other sites

@chabis Hi thank you for your reply,

Although i do understand the concept that youre describing here im still totally lost in the woods in terms of implementing it. Is there any possibility you could provide an example of this method or perhaps a tutorial to start from?

Thanks again i appreciate it.

Link to comment
Share on other sites

@domsewell sorry, but i have no time to do a tutorial like this.

it's a complex process mixing a lot of vex and a few part of python .

it take more than three months to have a complete system (include load/save building's modification for all the stuff  ) not finish at this time (a long way is in front of me) but the "base" is here.

"it's not easy , but that's why we like that";)

bat.jpg

  • Like 3
Link to comment
Share on other sites

Congratulations! Looks really good and clean. How do you place the windows and doors etc?  How do you cut away whats behind the window? I see there is a double Edge where the windows are. Are those small Polys where you hide the ngon from cliping away the space for the Windows?

Edited by Drughi
Link to comment
Share on other sites

thanks,

at this time, door, windows etc.. are pre modeling (.obj) for some of them and for others (the simpliest) are builded directly in houdini. the rest is builded directly.

so the user could call his own collection of obj (door, windows,etc) regardless of the style he want

for each element to include (door, window...) there a specific size and a hollow in the wall, as deep than you can open the window for example

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...