Tuesday 11 March 2014

Masters Project

Delaunay Tetrahedralization and its dual Voronoi Diagrams

The Delaunay tetrahedralization is one of the most popular and common method used for solving problems related to meshes. It is either used for generating a mesh or for breaking it up, as Voronoi diagrams, dual of the DT is a commonly used process for that. The main task of this project is to implement a robust Delaunay Tetrahedralization structure, with a set of points generated from sampling a given 3D Mesh.

Points within the volume of the mesh can be obtained by several methods. We present two such methods for Mesh Sampling : Ray Intersection and SDF(Signed Distance Field).


Mesh Sampling from Maria Vineeta on Vimeo.


These points serve as vertices for the tetrahedrons that are a part of the combinatorial structure DT.
In this project we have used Incremental insertion algorithm, has a complexity which is worst case-optimal. With this algorithm, every point is inserted into the DT one at a time. The tetrahedra containing the newlyadded point is partitioned and new tetrahedrons are created thus updating the DT structure.
By inserting each point one at a time, we observe that only the Delaunay tetrahedra local to the point is altered and not the entire structure. Whereas in the other two paradigm, divide-and-conquer and sweep plane, the entire structure is built in a single operation. Inserting a new vertex would result in computing the whole structure again. Hence, incremental insertion is mandatory when a dynamic spatial model is built. The insertion of a single point can be achieved with two incremental insertion algorithms
1) the Bowyer-Watson algorithm and
2) flip-based algorithm.
The idea behind Bowyer-Watsons very simple. Tetrahedrons that does not satisfy the Delaunay criterion when a point is inserted, are deleted. However, this method is prone to errors as it forms a ‘gap’ or ‘hole’ when the tetrahedrons are deleted and affects the overall topological structure as well. Hence, flip based algorithm is preferred over the former.

Interactive video showing DT construction using Flip based Algorithm 



Construction of a DT structure(A Step-by-step implementation) from Maria Vineeta on Vimeo.

Final DT construction using several Meshes


Delaunay Tetrahedralization(DT) and its dual Voronoi Diagram(VD) from Maria Vineeta on Vimeo.

Renderman Shader

Potato Shader

Primitive Shape of the  Potato 


BRDF Model

     
Potato without BRDF
Potato with diffuse implemented

   
Potato with specular highlights


Displacement shader with varying Layers of noise.



 Final Rendered Image Without Shadows



  Final Rendered Image With Shadows







Dynamism using MAYA


Car Model




To obtain a realistic crash sequence between two cars, I employed Maya's nDynamics technique. The car to be crashed acted as an nCloth while the other car was made the Passive collider. A new cache was then created to obtain the desired crash effect between the cars.I tried several collision objects to the car to make it look more realistic. The collission object had to be animated to create the shatter effect and it had a good effect when Motion blur was added to it during rendering. It took a lot of time to render, but once it had finished it had a pretty convincing shatter effect.

The exterior of the Car was modeled using the blueprints of a Nissan Car.The reference images obtained were then edited in Photoshop, to obtain the appropriate image proportions on all the images. Polygon box modeling was used to design various parts of the car separately and were combined together at a later stage.
The car's tyre was then modeled separately and animated, to achieve the motion blur effect and then imported into the original maya file.
The second red car was obtained by duplicating the first car and by changing its color to red.
For the fire explosion between the cars, the blast explosion from Visor is used.

Textures :


The car's texture is mia_car_paint under mentalray.
The image used on the car headlight obtained from car headlight image posted by Blinkenberg(2004),in which the color was edited in Photoshop to match the car's colour. 
The car's glasses has the chrome mia_material, and its attributes were altered to achieve the desired reflective effect.
The Bournemouth University background image (Universities News 2012) was used as a texture on a plane and altered to match the car explosion.

Lighting :


I used Image based Lighting to illuminate the scene so that the environments reflection would be visible on the cars windows.
I have used five area Lights.
One to illuminate the University nameboard and the other to illuminate the explosion of the cars.
Three more are used to reflect the explosion in the car's glasses of the two cars.
The output was finally rendered using mentalray.
I have done colour correction and added some blur to the image obtained from maya, using Photoshop CS6 to obtain a more realistic look to the image.


Final Dynamism Image created using MAYA




IOS Game

Unreal Development Kit

Developed this game using Unreal Engine, with a group of eight other members. 

I was responsible for developing the User Interface and HUD for the game.

UI DESIGN FOR GAME SHAFT 37_x25 :


This was achieved with the help of Unrealscript and Kismet.
The HUD was designed in Adobe flash. I integrated it with UDK using Unrealscript to make it interact with a custom trigger class named TriggerHealth.uc.
Inorder to make unrealscript communicate with the Flash file, ActionsScipt 2.0, the scripting language of Flash was used. FlashPlayer 8 and ActionScript 2.0 were the compatible settings for ios. The swf file was generated using Scaleform plugin that uses GFxMediaPlayer to generate that file.
Function calls were made from UnrealScript to Actionscript. Function activateTNT calls actionscript from Unrealscript whenever a trigger is triggered by the player. Similarly, ActionScript communicates with UnrealScript. Actionscript calls a function setOptionsInfoUScript using ExternalInterface.call.

These functions were used for Options menu and Pause menu, where the option set has to be communicated with UDK as shown in Figure . This is handled through Kismet Event OpenGFxMovie which gives UDK the control to access the Flash file.
Similarly, button clicks are communicated to Kismet using the FsCommand node.
The integration with UDK was done by using a demo game. Integration consumed a whole lot of our time and was not easy as we thought it would be. Finally, the design of all the pages was done and integrated into UDK. 





Monday 10 March 2014

Physics Simulation

Rigid Body Dynamics


Rigid Body Dynamics deals with the linear and angular motion of non-deformable objects in 3D space. Detecting a collision when two or more rigid bodies come in contact and the way they respond to the collision are crucial to simulate a realistic motion.
A very basic rigid body simulation is implemented in this project. Though, a very simple collision detection method is used, the impulse method used to resolve collisions is quite powerful as it handles response to collisions quite effectively. But, there are several areas in this project where improvement can be made to achieve better results. Though lot of work is to be done to improve this project, it was a really good experience working on rigid body simulation and helped gain an understanding to the way physics works.



COLLISION DETECTION


Collision detection is an important aspect in physical simulation. Rigid objects freely moving and rotating in our rigid world, will have to collide with each other at some point in time. There are several collision detection algorithms used for accurately calculating the collision between different objects. The complexity of the algorithm depends upon the shape of the rigid bodies.
For computational efficiency, bounding volumes are most commonly used to detect collisions. The whole object or mesh is enclosed within a closed volume. A simple shape like sphere or cube is chosen to enclose complex objects to improve efficiency of geometric operations. In collision detection, when two bounding volumes do not intersect, then it is concluded that the objects do not intersect as well.
For our simulation, since we are dealing with simple objects and to keep the collision detection simple, we are enclosing all our rigid bodies within a sphere.

Bounding Sphere


Bounding sphere is one in which the objects are enclosed within a sphere. It is represented by a centre and a radius. Collision detection between bounding spheres is very quick and easy to implement. Hence, this method is chosen for our simulation due to time constraint.
A collision is detected if two bounding spheres intersect each other. The intersection is detected if the distance between their centres does not exceed the sum of their radii.

The flip side in using bounding spheres is that it has more wasted space than a bounding box. Using them can give less accurate results during collision. The two objects detects collision when the bounding spheres touch each other, but when in reality the objects actually doesn’t touch each other.

During collision, contact information is calculated and stored in ContactData class (Figure 4). The data calculated consists of :
Contact normal    –  the normal direction along which the colliding objects has to move after resolution.
Penetration depth – the distance along contact normal, to move the objects so that they don’t intersect each                                 other.
Contact point        – the point where the objects intersects.

COLLISION RESOLUTION


Once a collision is detected and contact data calculated, the collision has to be resolved to obtain appropriate simulation. According to Millington, when two objects encounter a collision, their direction of movement after collision can be obtained from their movement before collision. He terms this as Collision Resolution.
When a collision occurs between two rigid bodies, a collision impulse is calculated. This impulse prevents interpenetration by changing the velocity of the colliding objects instantly. Impulse can be thought if as a huge force integrated over a really short period of time. As force changes the velocity over time, impulse changes the velocity instantaneously. Impulse can be calculated and applied at the point and instant of collision. Since rigid bodies have rotation to them after colliding angular velocity too has to be calculated along with linear velocity.

To calculate the impulse magnitude and direction we use the collision model called as “Newton’s Law of Restitution for Instantaneous Collisions with No Friction.”. This model assumes that the collision process takes no or very small amount of time. At this time, non-collision forces like gravity are not taken into account though they exist before and after collision.
Newton’s Law of Restitution introduces another new quantity, the coefficient of restitution(e). The speed at which the objects separate after collision is controlled by this parameter. Its usually between 0 to 1, differs according to different materials involved in collision. A material with high bouncing effect like ball will have high coefficient of restitution, whereas clay or snowball will be almost zero.
This collision model assumes there is no friction, hence there is no tangential impulse and collision is entirely in the normal direction.

Few problems occurred when the above collision resolution equations were implemented. The main problem was interpenetration between colliding objects. It was quite complex to find the exact time at which two objects touch each other without penetration. Hence, to solve this easily a small amount of penetration is added to impulse to push the objects apart. This handled the resting contact as well, that is when objects come to rest.
Another complication is multiple contacts. To resolve this, separate Contact data is stored for every colliding object, thus handling it.


Houdini Digital Asset

City Generation


Screenshot 1 : Image based map using dummy buildings



Screenshot 2 : Voronoi based map using actual buildings




Video