söndag 29 maj 2016

Deformation in the Nation

Hello again!

This post is about one major update and two minor ones. The minor ones are that the red color now fades to black when the fire burns out, instead of just instantly changing color. Also, we limited the number of warmth pulses an object can emit to once every 120 frames. The limit is set through a “reload” system common in shooter games, where a variable is set to 120 and reduced by 1 every frame. When it hits 0, a pulse is sent out and the variable is reset.

The major update is that meshes are now deformed! It took some work (a few failed attempts are shown below), but we eventually got it to the point we wanted. After being burnt, a vertex gets moved a bit in a random general direction of its reverse normal, resulting in a nice, randomly shrunken mesh. Next time, we’ll try to incorporate different materials and fire properties! 

screen_can_still_burn.pngscreen_constant_deformation.png

screen_deformed.png

torsdag 26 maj 2016

Becoming Airborne


The only possible step to take after successfully making the fire spread to nearby vertices was of course to make it also spread to nearby objects. This proved to be fairly straightforward, as we could use the same system of warmth pulses to ignite vertices on other objects. However, as we couldn’t access individual vertices of other objects the way we could access vertices of the same object, we had to tweak the system a bit.
We did a raycast from the burning object to all objects within a specified search radius bearing the “flammable” tag. At the point of intersection, a warmth pulse is sent out, similar to as if we had clicked on the object. Initially, the raycast was made from and to the center of objects, but that didn’t make for a very realistic spread. Fire would start to spread to nearby objects long before it was close enough. We tried to come up with a better way, and eventually decided to cast the ray not from the center of a burning object, but from the center of the fire itself - that is, the burning vertices. In each frame, we calculate a sort of bounding box for each pocket of fire in the scene, and cast rays from the center of that box. The result is a much more realistic spread.


screen_spread.png

måndag 23 maj 2016

Great progress, triumph abound; It’s alive!


screen2.pngscreen4.png
Fig 1.                            Fig 2.

Today was a good day.

We managed to achieve a controlled spread across an object, starting from the point on the mesh you click on. Bursting with confidence, we went shopping at the Unity Asset Store and got ourselves a nice particle effect for our fire. Adding the effect to the system was a simple matter of instantiating a particle effect at each burning vertex. Above, you’ll find two images showcasing the fruits of our efforts. We decided to keep the red and black colors, since they’re both great visual tools for debugging, and we also think they add to the effect. Tune in next week, when we (hopefully) get the fire to spread between objects!

fredag 20 maj 2016

Working under unfortunate conditions

Last night, we found ourselves stranded in a peculiar situation: we only had a single computer at our disposal. Starting out from the tutorial mentioned in our previous post, we attempted to reconfigure the force and deformation towards a color change within the vertices. By default, materials / shaders in Unity are not able to follow color change in vertices. Scouring the net we found an alternate shader which allowed for the change of colors at our leisure, unfortunately this disabled the use of textures.

Our approach towards the spreading of fire was borrowing the force system from the tutorial, creating impulses with dynamic intensity dependant on the distance.This meant that we had to loop over all the vertices once and apply an intensity. Each burning vertice would have a possibility to “spread” by creating another impulse at its position.

Another approach we thought of was creating a network of neighbors related to each individual vertice, meaning that the system might be more controllable. Unfortunately, the task of sorting neighbors into arrays was demanding and we didn’t understand it enough to make any significant progress.

We managed to get the colors to change depending on the mouse’s position over the object (see fig 1.), but when it came to spreading the color, it was uncontrollable. See you next time when we will escape this dire situation!


Fig 1.

torsdag 19 maj 2016

The Initial Spark


Hello everyone! We are Marcus Ahlström and Karl Andersson, and our project is about simulating the spread of fire over objects. We just had our first meeting where we outlined our goals and expectations from this project. Here they are:

  1. Get devouring flames to behave realistically
    1. Spread the fire from a singular point on the surface of an object
    2. Jumping between objects depending on distance, wind and/or heat
    3. Fire being able to burn out depending on the material
    4. Having different properties depending on material and weather conditions
    5. Changing the material of the object to create a charred look
    6. Taking local terrain into account
    7. (Optional) Distort meshes to show that the material has been burnt
  2. Learn more about Unity
  3. Efficiently manage the work distribution and collaborate in the same files
  4. (Optional) Create a dll which is usable in Unity

Attentive readers might have noticed we mentioned Unity, the game engine. It is indeed the game engine we chose to use. During our initial research, we searched for ways of controlling the mesh and vertices of any model. We found a tutorial about "Mesh deformation" which proved useful as a starting point:

http://catlikecoding.com/unity/tutorials/mesh-deformation/

In it, we learned how to access individual vertices in Unity and change them on command, making Unity a suitable program to work in. The team's experience with Unity was another major factor. Next time, we’re going to fire up Unity and get started for real!