Houdini Environment Project for Crowd Simulations

This is a quick update recording some of the assets that I have been working on in Houdini that will act as set dressing and ground cover for my environments. My goal is to build realistic sets that I will use as backdrops for my crowd simulations. Houdini height fields have been a lot of fun to explore, but like everything in Houdini shading and texturing has become a challenge. 

Houdini Assets for Environments

Megascans and SpeedTree in Houdini

Bringing Megascans into Houdini has also been fun. UVs have always proven a challenge for me in Houdini but this project has helped solve that. Working with the organic shapes forced me to up my game in order to make sure the textures fit correctly. 

Houdini Forest

Houdini Forest Test

Speedtree in Houdini with Mantra

Megascans Ground

I have also been working on building a ground terrain that will not look patterned on the large height fields in Houdini. They tend to look good up close but once they are implemented into the scene they are no longer seamless. I have written a shader to work as the ground while try to solve the problem.  

Python Procedural City

Introduction

This is a project that will procedurally generate a city.  The focus is to use Python inside Houdini to create an application that can assist in city creation without having to individual place all the structures.

Bounding Box Layout of the buildings

Test of the Buildings

Generate a City Map

The first step is to create a map that can be imported into Houdini. I found a website online that can generate random city layouts called the Medieval Fantasy City Generator. After making a layout that works for the design, I bring the image into illustrator, clean it up and rasteurize it. 

Convert to Geometry

Import the map as a Adobe .ai file, or an .eps file then convert it to geometry. At this point I manually select the blocks to be designated as commercial buildings and assign the primitive numbers to a group that will separate the blocks by color. 

Code to assemble the individual blocks and assign the building type.

Python Code Block 1

Import City Blocks and Sim Clusters

importBuildingCode.JPG

Code to import buildings and create the nodes that add the bounding box and the attribute parameters that will be passed through to the clustering simulation. 

Cluster the Buildings

Pop Attract is used to pull the buildings into the center so they can be placed over the individual blocks before being transferred to the main simulation. The left image shows the buildings scattered onto the points of a grid, the right image shows the buildings after the first simulation is run. The clusters are then stored in Null nodes where they will be randomly pulled and placed into the simulation.

Generate the City Blocks

The clusters are called and placed over the block shapes where they are filtered based on location. Buildings outside of the shape are removed, while buildings inside the shape are pulled to the outside of the shape using another Pop Attract. The buildings are now sorted as inside or outside the block space. Outside blocks are deleted and the space that remains in the center of the shape is then filled with smaller commercial buildings.

The Main Simulation

Block Shapes receive more filler buildings based on the offset space remaining in the center of the block. When the simulation is run, each block shape recieves a cluster of randomly selected buildings. The final output is a point cloud for each block that holds the reference number for each building that has been assigned. 

Import the Assembled Block Point Cloud 

Python is used again to import and create the file nodes that were written during the simulation. The original block position is recalled and the blocks are reassembled in their original positions. The blocks are then sent to the final section where the buildings are copied back onto them and the city is assembled. 

Crowd Environment PreVis

Introduction

For my senior project I am interested in exploring crowd logic and interactions. Both Golaem and Houdini will be used to produce crowds out of agents that are made by myself or Mixamo. I will also be using my own motion capture along with a mix of Mixamo animations. 

Houdini Crowd Test

Thanks to the awesome people at Golaem, I have received a year of access to their crowd simulation plugin. These are some very early tests. It will be fun to compare the similarities and differences between the software capabilities.

White Walker Crowd Sim

Process

The concept will include agent interactions with not only the environment, but also props such as arrows and other agents. My goal is to also place them in a realistic environment using Houdini Arnold and Redshift. The Hero shots may not be up to photo realistic standards due to the limitations of the textures. I may have to recruit some help in that endeavor.

The environment will be grasslands with rugged  hills and wooded areas. The following photos are some of the early pre-visualization renders that I have been building as I begin to set up the individual shots. The trees will be modeled in Speedtree and the environment will be a mixture of Terrigen and Houdini heightfields.

grass11.jpg

Agents

The agents will be rigged with Mixamo and prepared for baking in Houdini. The motion capture will be cleaned up with Vicon Blade and Motion Builder prior to being incorporated into Houdini.

brutecrowd.jpg

Sierpinski's Gasket - Houdini and Mantra

DESCRIPTION

The purpose of this project was to write a Python script that would generate points in 3D space using the fractal algorithm for Sierpinski's Gasket. The intention was to make the script  renderable in several 3D rendering software packages.

ALGORITHM

Sierpinski's gasket is created by defining the vertices/points of a tetrahedron, choosing a random point within the tetrahedron, picking a vertex/point of the tetrahedron at random, finding the midpoint between that random point and random vertex and then storing that midpoint in a list. This process is done over and over again in order to create the fractal.

1. Pick a random clocation

2. Define a seed point

3. Collect points (vertices) from a list of 4 to generate the Sierpinski Fractal

4. Find the mid-point of 1 and 2

5. Save the mid-point

The Sierpinski triangle, also called the Sierpinski gasket or the Sierpinski Sieve, is a fractal and attractive fixed set with the overall shape of an equilateral triangle, subdivided recursively into smaller equilateral triangles.

The Following Code Was Modified For Houdini And Rendered With Mantra:

Python Code:

node = hou.pwd()
geo = node.geometry()

# Add code to modify contents of geo.
# Use drop down menu to select examples.

import random
#import math
#import socket

# Procedure halfstep returns a midpoint between two
# user-defined points
import random, math

def halfstep(p1, p2):
        a = float(p1[0] + p2[0]) / 1.5
        b = float(p1[1] + p2[1]) / 2
        c = float(p1[2] + p2[2]) / 2
    
        result = [a , b, c]
        return result

def pickpnt(pnts):
        result = random.choice(pnts)
        return result        
#------------------------------------------------

triangle = [ [0,0,1], [1,0,-1], [-1,0,-1], [0,1.5,-0.2] ]
seed_pnt = [0,0.5,0]
point_list = []

for n in range(25000):  
        vert = pickpnt(triangle)
        seed_pnt = halfstep(vert, seed_pnt)
        point_list.append(hou.Vector3(seed_pnt[0],seed_pnt[1],seed_pnt[2]))

geo.createPoints(point_list)

Modifications To Midpint

def halfstep(p1, p2):
    a = float(p1[0] + p2[0]) / 2
    b = float(p1[1] + p2[1]) / 1.3
    c = float(p1[2] + p2[2]) / 2
    result = [a , b, c]
    return result

Through Manipulating The Initial Definition You Can Create Variations Of The Design.

def halfstep(p1, p2):
    n = random.randint(1, 10)
    a = float(p1[0] + p2[0]) / n
    b = float(p1[1] + p2[1]) / n
    c = float(p1[2] + p2[2]) / n
    result = [math.sin(a) , math.cos(b), c]
    return result

def pickpnt(pnts):
    result = random.choice(pnts)
    return result