Friday, 22 April 2016

Scripting and Dynamics - VII


This is my last post before the submission, I have been working on the tool and polishing my script.

Here’s a screenshot of the final tool:


It is divided by separators in three sections:

·         General Settings: this section allows you to configure the size of the grid and the cell.

·         Make Fire Collider: this section allows you to make an object an active fire collider, whenever the object touched grid cells it will apply X intensity per tick on them until they burn out.

·         Apply Material Properties: this section allows you to mark an environment mesh with fire properties, all the cell that lie beneath this one will inherit the properties specified in the tool.


At the end of the project, I have to say I am quite satisfied with how it behaves; the project could still be improved both in terms of performance and look. 
The particles used at the moment are hardcoded but a better way to manage their look could have been exposed.
Performance proves to be an issue with bigger grids, I didn’t have time to experiment with it but I believe that alternative ways of detecting collisions could have improved the end result in that regard.

Wednesday, 13 April 2016

Scripting and Dynamics - VI

This week has been very exciting as finally everything is finally coming together! As previously mentioned I’ve been working on detecting collision events in order to create fire events. 

My test scene consisted of a sphere affected by gravity that falls into the grid; my goal was to have the sphere trigger a fire event on each cell touched by it and then let the simulation handle all the details about fire spreading around.

In order to implement this I had to research how to create passive rigid bodies procedurally for each grid cell.Once I had this setup working I tagged the sphere with some custom attributes and then added some logic on the collision handling routine to check for the attributes to know the intensity of the fire event.

As of this week I finally have a working version of the whole simulation, but I still feel it is not user friendly enough so before wrapping the project up I’m going to add a small UI tool to manipulate parameters rather than forcing the user to fiddle with custom attributes hidden somewhere in the hierarchy of objects.


Stay tuned!

Wednesday, 6 April 2016

Scripting and Dynamics - V

Last week I managed to create a fire grid and did some tests with hard coded fire sources, the result was satisfying already but there are still improvements to be made.

So for this week I decided to take a deeper look into raycasting: the idea is that the user will build the environment and then add fire simulation on top of it, so I wanted to create something that allows the user to click on environment meshes like rocks or grass and let those meshes specify the behaviour and parameters of the cells below them.

After looking extensively at the documentation I found a way to implement raycasting with Python in Maya: that is achieved through the use of the OpenMaya. 
This module provides a function called closestIntersection which performs raycasting on a specified mesh and also returns the intersection point.


By using this function I managed to implement custom parameters based on the mesh lies on top of the grid: the only missing building block to enable a fully procedural simulation is now the fire collision events so stay tuned for more progress on that!

Friday, 25 March 2016

Scriping and Dynamics - IV

As I mentioned in the previous post, I have been working on fire grids and I wanted to post some updates on my progress.

To start things off I created two main classes: FireGrid and GridCell; a fire grid is simply a 2D array of GridCell instances that also provides utility methods to get a specific cell from a coordinate or to get the neighbours of the provided cell.

I will be using an expression to simulate the logic and I decided to structure my code so that everything happens in steps: those are going to be calculated and executed every frame through an expression that calls some python code and that’s where most of the logic is going to lie.

In order to test things out I create a polyCube instance for each Cell and I have added some global variables to regulate both the cell size and the grid size: those will be exposed later on by the tool I will be writing to allow the user to tweak the simulation based on how big the scene is going to be.


For the next week my plan is to research and find a way to specify a material for each cell, one of the methods I have in mind to solve it would be raycasting but I would need to research this further and look at the documentation to find out if it’s possible to do so.

Friday, 11 March 2016

Scripting and Dynamics - III

I started working on how to implement things for this module and since my coursework is going to be script heavy I decided to take my time and plan the features and the design of this small piece of software.
I identified three major problems to solve:
  • How to represent the grid in Maya
  • How to enable the user to edit the material of each individual cell
  • How to create an “active” item that starts spreading fire once it collides with a cell

My plan is to implement the grid first, and I will experiment with basic polyCubes for now to see if they can be also used to detect collision programmatically.

Stay tuned for updates on how this evolves!

Friday, 19 February 2016

Scripting and Dynamics - II

I have been looking for examples of advanced fire implementations in existing games and so far I've found two good examples of fire in an enviroment: 



As I was looking deeper into these games I managed to find an article from one of the developer of Far Cry 2's fire system with tips on how to implement something similar within a complex open world game like Far Cry, here's a link to it.

This approach seems very interesting, and since the feedback week is coming I think I will be focusing on shaping up my learning contract towards this topic.

My idea would be to add fire spreading simulation within Maya by creating areas that can be burnt and setting properties based on some environmental meshes.

Friday, 12 February 2016

Scripting and Dynamics - I


Welcome to the first blog of a series about a module I am studying at university: Scripting & Dynamics.

This module will cover advanced Maya concepts regarding dynamics, animations rendering and scripting: we will be exploring a lot of techniques that are widely used for visual effects in both the game industry and the film industry so it definitely sounds interesting!

I've always been interested in how fire is rendered and behaves inside and enviroment so my first goal is to research how those effects are achieved in games and how to replicate them inside Maya.

As you might have guessed, my specialisation is going to be computer games since this is my main field of interest; I believe that exploring how fire behaves and finding out ways to integrate it more realistically into the enviroment would be a very stimulating topic and I can't wait to do more research and post about it in the following weeks.

Since I feel stronger in terms of scripting I will mainly focus on that and I will probably look into particle tweaking if I have enough time left, so stay tuned for some posts about python scripting in Maya!