VSFX 319 - Project 3 - Isometric Neighborhood
November 2021  

Reference/Color Scheme: 

For this project, I used the first image as a reference for my model and then I went through 2 main color schemes. The blue/purple color scheme was used for testing since the colors were very bright and obvious. Then the more natural brown/orange/blue color scheme was what I chose for my final. I recreated it in Nuke with constant nodes to easily see/adjust the RGB values.

WIP Renders:

Model:

I kept the model simple and basic so that I could focus more of my time on the programming portion of the assignment. I combined different parts of the house together such as the windows and siding pieces and was able to name them in the outliner to where I could select each section, which I also specified for the user in my python comments. 

Project3_FirstModel_Wireframe.png
NamingGroupOutliner.JPG

Python:

I went through quite a few iterations in my python scripts before reaching the one that worked without errors. I also realized as I was going that it was getting confusing when each section wasn't broken down, so I commented and used lines to separate different sections in my final code (below). 

Basic Programming Steps/Outline I followed:
 

1. After modeling/naming the intial house, duplicate it to build the grid from (so that the original house doesn’t have attributes and you build the grid from the copy of the original).

3. Select the new house copy shape nodes and add attributes.

4. Create a grid from the copy and rename the pieces (use rc=True). 

5. Adjust visibility to turn off original houses to avoid overlap in the grid.  

6. Randomize house color with setAttr for each piece/section of the house that you select using shape node selection in a for loop. 


 

See more test code HERE. An extra usability feature that I added to my code is the ability to hide primary visibility of the original houses the grid is created from so that there's no overlapping geometry. To do this, I turned the visibility on to begin with, duplicated the houses, and then turned it off after the duplication was done. This allows the code to be re run as many times as needed without manually hiding/showing anything in the outliner. 
 

#Turn ON visibility of house_grp to start in case code is re run multiple times: 
def VisToggle(objName,vis):
    cmds.setAttr('house_grp' + ".visibility", vis)
    
if cmds.objExists('house_grp'): 
    VisToggle('house_grp',1)

#ADJUST VISIBILITY TO AVOID ANY GRID GEOMETRY OVERLAP 
        
#turn off visibility of original house_grp 
def VisToggle(objName,vis):
    cmds.setAttr('house_grp' + ".visibility", vis) 

if cmds.objExists('house_grp'): 
    VisToggle('house_grp',0)
    
#turn off visibility of house_grp_copy so it doesn't overlap in the grid 
def VisToggle(objName,vis):
    cmds.setAttr('house_grp_copy' + ".visibility", vis) 

if cmds.objExists('house_grp_copy'): 
    VisToggle('house_grp_copy',0)

OSL: 

Since my entire project was done with just one ai Standard Surface (named "ObjColor") for all the houses and I wasn't worried about any attributes except for color, I only needed to use OSL to point to my attribute name and kept the base code with just the name modification so that it would connect .

OSLHypershade.JPG

Screen Recording: Code Functionality

This recording was taken before I adjusted the final lighting & color, but the code functionality is the same. 

Overall Troubleshooting:

Overall, this project was a really big challenge for me. Since I haven't programmed since 2019 and haven't used Python for Maya before, I struggled a lot with learning the correct syntax and optimizing the overall code structure. 

Originally, I separated the code into 2 separate files, one for creating the grid and one for adding the attributes, but I later realized it was much easier to combine it into one script for everything. This made it much easier to re run, since I was able to delete house duplicates and recreate the grid in the same script that added the attributes to the new house copies.

While working, I created 2 folders called "Working Code" and "Tests" so that I could save scripts that worked and ones that didn't work and then combine the ones that I needed later on. I think if I went back though I would try to create a more cohesive naming convention, as it got very confusing pretty quickly which script was doing what. 

I also had a lot of issues with randomizing the color, since I tried to do it originally in the addAttr instead of the setAttr. Overall, learning when/how to delete the attributes was an issue for me for a while until I realized I could create a copy of my original house for the grid each time. 

PythonScriptFolder.JPG

Final Beauty Render: (1920x1080)

For the final beauty render, I added some color correction and depth of field in Nuke to emphasize it and make it feel more like a photograph of a set of miniature houses.

Project3_1080Render_comp_v002.png

Dramatic Horizontal Blur like the Witcher (fun Nuke test): 

Project3_1080Render_comp_v002_DramaticBlur.png