Monday, November 21, 2011

Making Windows

Spent the weekend fixing the the conflict between column generation and building base extrusion. I ended up keeping the initial footprint as a polygon with no subdivisions and creating the columns and base as such:

  1. inwardExtrude to create the actual footprint the building will be generated from (this is to give "sidewalk space")
  2. Add subdivisions to the newly created footprint. Right now it's set to 10x10, but in the future this value can be pulled from the GUI
  3. Select the outer ring of faces for column generation.
  4. ShrinkPolygonSelection (this command took a while to find) to select the inner cluster of faces. I wrote a helper function called deleteSubdivisions to remove the subdivisions for the building base extrusion. The reason for removing subdivisions is keep each wall face clean, so there are no conflicts when I do need to subdivide each face according to how many windows there should be.
  5. Finally we can extrude the building body to the height of the columns to get something like this:

Moving on to the floor generation, the hardest part was to figure out how to select the faces I needed, and how to subdivide each face properly. I actually started this portion earlier this week, except the lack of documentation for polySubdivideFacet led me to believe that it wasn't possible to subdivide in only one direction (ie vertically). Coupled with the fact that maya commands in the actual interface are named differently than the ones in the documentation, I was running around in circles for a few days before figuring out that you actually can subdivide a face in one direction (I ended up trying the Add Divisions tool in maya and realizing it was indeed calling polySubdivideFacet).

That being done, the next step was to scale/extrude each cell to form the frame of a window. From looking through a bunch of other people's code, I learned that polySelectConstraint was the best way to isolate the faces I wanted (ie. all faces on the east side of the building). That being said, I ran into a bug stemming from the fact that I was running transformations on faces that were passed in. I hadn't anticipated the fact that when you iterate through each side face of a floor and subdivide it, you end up with more faces than you started with and trying to keep track of everything by explicitly naming faces becomes much more difficult. So somehow I ended up with this:

Lots and lots of windows
I'm pretty sure I know what needs to be fixed, so this should be good to go by tomorrow. The windows were the last step to the floor creation function, so once that's done I should be able to create a building by calling createFloor numFloor-many times.

Some takeaways:

I feel that the majority of my time up until now has been spent on overcoming the rather steep learning-curve of knowing which maya commands to use to do what you want. I've also become more aware the the flexibility we can get by switching between vertex, edge, and face perspectives (a lot of the helper methods I wrote this weekend utilized this). Previously I was a bit hesitant to post pictures, since I felt what I had was rather lacking given the time that had passed. However I've realized the ramp-up time I took was worth it, since I feel a lot more comfortable coding for maya now, and my productivity has gone up quite a bit.

Just for my own reference (in case all 300 of my tabs crash), here are the Maya commands I find myself using the most:

polyEval
polyExtrudeFacet
polyCreateFacet
polySubdivideFacet
xform
polyListComponentConversion (or just cmds.ConvertSelectionToFaces())
polySelectConstraint
polyChipOff
polySeparate

No comments:

Post a Comment