< Back 

Fire and Ice

Responsible for FX, Modeling, Texturing, Lighting

Software: Houdini

Programming Language: Python

Fire and Ice was a project created to experiment with motion capture data in Houdini. Based on the data and base code provided by Professor Deborah Fowler, the python script I wrote takes the data and processes it into a series of text files usable by a Houdini script. Various pyro simulations and a rigid body dynamics system with the motion capture animation created this elemental showdown.

Simulations

A total of four pyro simulations and one rigid body dynamic system create the effects in the scene. The pyro simulation is sourced from the characters and swords, respectively, and uses a similar setup for each simulation.

Shattering the fire sword is created using a rigid body dynamics system and Voronoi fracturing node. A shift in textures from hot magma to solid rock aids the sword’s cooling and breaking effect.

An attribute transfer with a pyro burst sourcing creates the superheated steam bursting from the swords’ collision.

Character Creation

The data was split into various body parts when creating the character geometry. This division allowed greater control over the final look of the character’s body and resulted in more apparent animation overall.

A VOP network with worley noise creates the magma character’s body. The resulting displacement is mapped into the material’s emission parameters to make the character’s lava and hardened magma texture.

Python

#
#   mocapParser.py
#
#   Author: Nathan Huseth
#
#   Date: 5/22/2022
#
#   input: Text file with motion capture data
#   output: Multiple Text files with marker data
#
#   Description:
#   A program which processes motion capture data, splits frame data,
#   formats marker data to a new line and saves a corresponding text file
#
import os
import tkinter
from tkinter import ttk
from tkinter import filedialog
class ProcessMocap():
   
    # Initialize Class
    def __init__(self, outputDir = “output”):
        self.padx = 10
        self.pady = 10
        self.outputDir = outputDir
        return
   
    # Open files
    def openFiles(self):
       
        # Get files as user input
        self.files = filedialog.askopenfiles(title=“Source Directory”, initialdir=“.”, filetypes=[(“Text Files”,“*.txt”)])
       
        # Iterate each file
        for textFile in self.files:
            # Get name of file
            name = textFile.name.split(‘/’)
            name = name[1]
            name = name[:4]
           
            print(\nProcessing: “ + name + “.txt”)
           
            # Define output directory name
            if(self.outDirectory.get().strip() != “”):
                self.outputDir = self.outDirectory.get()
           
            # Process Data
            self.processFile(textFile, name)
           
            # Close file
            textFile.close()
           
            print(name + “.txt finished.”)
       
        print(\nAll files completed and waiting in /” + self.outputDir + ” directory”)
        return
   
    # Controls file processing
    def processFile(self, data, name):
       
        # Remove header line
        data.readline()
       
        # Create output directories
        directory = self.createDestination(name)

 

        # Iterate each line
        for line in data:
            splitData = line.split()
            result = “”
           
            # Iterate each value in line
            for index, i in enumerate(splitData):
               
                # Handle frame number
                if(index != 0):
                   
                    # Define result data, newline every third value
                    result += i + ” “
                    if((index1)%3 == 2):
                        result += \n
                else:
                    frame = i
           
            # Save output file
            self.saveFile(frame, directory, result)
        return
   
    # Create GUI
    def createGUI(self):

 

        # Setup window
        root = tkinter.Tk()
        root.geometry(‘380×190’)
        root.title(“Parse Mocap Data”)
        frame = ttk.Frame(root)
        frame.grid(padx=self.padx, pady=self.pady)
       
        # Output directory
        self.outDirectory = tkinter.StringVar()
       
        # Create button and instructions
        info = ttk.Label(root, text=“Use the button below to select text files containing mocap data.\nEach frame will be exported as a formatted text file with marker\npositions.”)
        outLabel = ttk.Label(root, text=“Output directory name.\nDefaults to \”output\” when blank”)
        outDir = ttk.Entry(root, textvariable = self.outDirectory)
        directory = ttk.Button(root, text=“Select and process files”, command=self.openFiles)
       
        # Layout elements
        info.grid(row=1, column=1, columnspan=2, sticky=“w”, pady=0)
        outLabel.grid(row=2, column=1, sticky=“W”, pady = self.pady)
        outDir.grid(row=2, column=2, sticky=“W”, pady = self.pady)
        directory.grid(row=3, column=2, sticky=“w”, pady=self.pady)
       
        root.mainloop()
        return
   
    # Save text file
    def saveFile(self, frame, directory, data):
        name = “out.” + frame + “.txt”
        newFile = open(self.outputDir + “/” + directory + “/” + name, “w”)
        newFile.write(data)
        newFile.close()
        return
   
    # Create directories
    def createDestination(self, directory):
        # Main output directory
        if(os.path.isdir(self.outputDir) == False):
            os.mkdir(self.outputDir)
       
        # Frame directory
        if(os.path.isdir(self.outputDir + “/” + directory)):
            return directory
        else:
            os.mkdir(self.outputDir + “/” + directory)
            return directory


No password? View my public reel

X