Wednesday 10 August 2011

DirectX framework

i have now been able to finish my directX framework and while it is just a carbon copy of frank lunas framework i think it was important that i did this mainly due to i now have much better understanding of the framework so i can make use of the classes and there function easier as well include any extra functions in a specific class which it would be useful in. With this i can now start on producing my occlusion shadowing techniques although i have decided to not touch it this week to concentrate on other things which i need to deal with.

Tuesday 19 July 2011

Working with UNITY

i have recently finished going through one of the UNITY and now have a basic grasp of the tools setup itself. i can see that the tool is set up to be object based with separate scripts being written for different objects but are still capable of being connected. I found this at times rather jarring but i can see that the whole tool is extremely useful especially for producing multiple levels.

With my basic understanding of UNITY done i feel like moving back to working on DirectX programs so my next plan is to produce a DirectX framework (possible a multiply API framework later down the line) and then with the framework produced i want to start trying to produce a program to deal with occulsion shadowing as planned

Saturday 11 June 2011

Further work

The work for this honors project has finished and handed in and while i feel upset about the end results and grades for the honors project life must go on and i must continue to show off my capabilities in programming so i will use this blog as a way of keeping updates on my personal projects and thoughts of the work i'm doing. I as of this time working on my website but should soon be finished in producing it and later getting it hosted but after this is done i need a new project to work on. the following our some of the ideas of which i plan to do:

Improve previous projects: this as stated is basically to either polish and/or depending on the project included extra which was intended in the final result. in the case of the honors project the introduction of harmonic motion is necessary.

Advanced shadow mapping: one of my ideas for the honors project which i would like to continue. in this case i want to get the shadow of the object to be bound to the light source and the position of the light will affect where the shadow is positioned. This is the basic setup but further work would include the effects of the distance between the object and the light source which will affect the shadow. This means the shadow will contort stretch and fade depending on the distance between the light source and object position. I would also like to further this by adding multiple light sources which each have there own shadows which are drawn to the scene also with the multiple light sources i would like to get the light capable for canceling other shadows by there own light source. I'd try to do this using directX as i have a limited amount of work using directX and also older work involving shadows in directX.

Crazy snooker: This is a full game idea i plan to do this is basically a game of snooker with the same rules of snooker (first either spot or sprites need to be potted then the black) with different types of table shapes to play on. That is basic setup of the game maybe also introduce power ups not entirely sure yet. This would be produced on unity again due to lack of work based around unity that have done and also the possibility of selling this game on an android phone.

Monday 2 May 2011

finalised update

again an update on my work. i have decided to stop adding things to my project and work mainly on my dissertation. Since last time i have added in a basic user input (being able to move the object, change its radius and mass) and have inputted VBOs.

i still have some work to do with the program which needs to be fixed. The first problem is that while the VBOs work the grid isn't draw correctly this cause the indices used go line by line and not quad by quad which is the way the triangle strip way works. This needs to be fixed and also the text would be helpful but not all that necessary so if i can text working would be create as well. I will also need to comment and clean up most of the work.

Monday 18 April 2011

Object update

From previous updates i mentioned that i was going to attempt to get multiple deformations taking place at once unfortunately due to problems with writing the normals in the shader caused too much trouble to fix as of the time and will hopefully be looked into fixing later if times allows it.

Instead i worked on getting objects to fall onto my surface and then transfer the energy that they have accumulated to produce the depression in the surface. The values which were used to cause this depression was the radius of the object, the mass of the object and the velocity of which the object was traveling at when it hit the surface.

Both the radius and the mass of the object are constant values and thus isn't effected by the actions in the program. The velocity however isn't a constant and changes through use of specific equations dependent on what the object is doing. In the case of the program the object is being dropped from a specific distance and is effect by the following equation:

velocity = gravity * time

This is the standard equation to find the velocity of an object as it falls from a distance and the further it falls the faster it will go. In this project the surface and object is based in a vacuum so there should be no air resistance effecting the object what so ever.

Now that the depression of the surface is effect by the surface i need to get the reformation working with it as well as at the moment when the reformation takes place the center value of the circle algorithm is lost and the whole surface returns to its original state. this needs to be fixed. After that i may attempt to get the object to be thrown into the air by the elasticity of the surface or try to get multiple depressions working. I will also need to consider spending some time adding in some more optimization in the program so that it can have larger elastic surfaces and use less memory for its usage

Monday 11 April 2011

Kinetic energy implementation

As of now the program now has the depression of the surface effected by a mix of kinetic, potential energy, hooke's law and tension of a string. The way the equation is set up is that the basic equation of kinetic energy and potential energy are added together from the depression to find the total energy of the depression:

velocity = 1/2*mass*speed^2 + mass*gravity*height

with the total energy found the equation now needs to find the tension of the surface. To do this the surface is set up like a array of strings with its own set of strings having tension working against the energy placed on the surface. With this the equation becomes:

1/2*mass*velocity^2 = 1/2*mass*speed^2 - mass*gravity*height + ((2*tension)/(2*length))(2*sqrt(height^2 + (length/2)^2) - 2*tension)^2

This equation will find the velocity of the object been pushed upon the surface. The problem with this equation is that the program already has the velocity of the object hitting the surface. Instead what is necessary is the speed as of the time of the object which was hitting the surface. With that in mind the equation needs to be changed to get out a wanted result:

speed = velocity + sqrt(2*gravity*height) - 2*(sqrt(((2*tension)/(2*length))*(2*sqrt(height^2 + (length/2)^2) - 2*tension)^2)/mass

With this the speed of which the depression goes at can be found. After this is found the value of speed is added to the overall height to find the depth of the depression.

There was only a few problems with the implementation all really mainly based around the values of the constants used for the equation needing to be change so that the deformation had a more of a realistic look or more depth to its depression. The main problem with the height of the depression usually ended up to large for real use. this was attempt to be sorted by dividing the value found by 100 but this cause the depression to continue without stopping due to the value just continuously being added together to make the depression much larger. This was by making the value used to change the surface and the height used in the equation separate values with the the surface height just the height value divided by 100 thus not effecting the end result or the next result from the equation in ways which did not produce unwanted results.

With these values effectively placed in i plan to after this try and get multiple depressions happening at the same time as my next marker to aim for for my project and after that if there is still enough times to implement actually have objects falling onto the surface and have them effect the depression of the object

Note to self: in dissertation increase explanation of the tension of the string and the energy placed onto the surface and explain each of the values used in the equations. Include visual representation.

Monday 28 March 2011

changes made to the deformation and reformation

for the past week i have been working on getting my deformation and reformation to real more realistically at the start of the week i was able to get the reformation working the way it should without took much hassle. only a few values used in the program needed to be changed to get the reformation working more realitsically

the defomration though caused alot of troubles. i originally intended to use the equations of an ellipsoid but this caused a problem with the deformation with the values throughout the whole surface being effected making the surface slanted and when made to deform cause the surface to stretch but not deform the way its suppose to do. With some thought the method has been changed to use the circle algorithm used to produce terrain. This works exceedingly well although it needs some teaks to get it working properly.

The ray intersecting has yet to be properly implemented and this needs to be seriously considered in the comming days and gotten to work as it is inputted.

Tuesday 22 March 2011

update

right first update in a month. from the previous update the deformation has been placed in but hasn't been changed and reformation has been also placed in. this at first only worked as an inverse of the deformation but has later been changed to work with the bottom part of the reformation returning first and it slowly receding back to the start of the surface. ray/triangle intersection has also been implemented in but hasn't been properly introduced to work and run with the program.

I at the moment am working on getting the insecting traingles work to run and do what it suppose to on the program by allowing the user to select where the deformation taken place using a mouse. I am also looking into changing the deformation to a more realistic shape. this most likely would be a ellipsoid shape. After this i plan to work on the limitations of the deformation by making it dependent on the amount of kinetic eneergy placed on the surface and the tension of the surface working against the deformation of itself.

ellipses and elipsoid research

http://home.windstream.net/okrebs/page61.html
http://home.windstream.net/okrebs/page62.html
http://mathworld.wolfram.com/Ellipsoid.html
http://www.mathworks.com/help/techdoc/ref/ellipsoid.html
http://www.lighthouse3d.com/opengl/terrain/index.php3?circles

Monday 28 February 2011

Deformation

A late submission for an update but as of this time i now have the surface deform correctly. This means it slowly goes deeper the longer the depression has accumalted. It has of this time forms more of an traingluar like deformation and so at later dates i will have to look at the equation and change it so that it can produce a more realistic outcome. The next thing that is planned to be added in is ray tracing so the user can choose the location of the deformation with much realitve ease. I hope to get this done quickly and move straight onto the reformation of the object itself.

I also need to consider my next objective after getting in reformation should i continue adding in new and better equations for the surfaces deformation or should i move on to tryin to get the object optimised to a reasonable standard so that it can loaded in with easy use into other programs.

Thursday 10 February 2011

Working shader

The shader which is to be used for deformation is implemented and running. It does what it is intended to do but does not give out the wanted results of a surface deformer instead moving the entire surface with each iteration. This is most likely down to the way of which the planes are drawn with mine being built differently from the example which i found. I could try to fix this but i have decided to skip it and just continue on into making a mesh deformer using the shader given. I will do this by first chosing a position of which pressure would be applied onto the surface then with each increase in pressure on this position will create a further depression of the surface. a limit will be necessary so that the end result return realistic enough. this will need to be smoothing so it less jaged

Wednesday 26 January 2011

Proposal

Introduction

The overall aim for the project is to research and experiment into different methods of deforming meshes in real time while making the deforming meshes seem realistic. The program needs to be also optimised so that it doesn’t take a lot of memory to run and can be placed as minor effect file into a larger program. It must also have force working against the deformity to make sure that the deformity will be realistic and not force the object to deform completely and then later be able to return to their original state.

Motivation

The reason behind wanting to do this is because it relies heavily on the physics side of programming which is something I enjoy working with. Due to alot of the forces acting on the object means that there will be multiple equations necessary to get the object to behave like it should in real life situations. The project is also based around the manipulation of the object’s meshes which is something I have very little practice in doing and so it will be interesting to see how I can possibly work with manipulating meshes of the loaded in objects.

I can see this being an interesting project to others as it will be based around the manipulation of objects this itself is something not used often in games and if I can make the program run at a good optimised rate then it could possibly be used within an engine to simulate the changing of objects shapes and size.

Issues

The issues of which I wish to address are based around the use of deforming meshes in games. This means that the meshes must be capable to being deformed in a realistic manner and the object must not be capable of deforming the mesh into something which cannot happen in real time terms. Due to the need for user input on the object, the meshes must be capable of being changed wherever the user interacts with the object and be able to take multiple deformation of the object at one time. The object must also be affected by the forces so tension must work against the users input and a coefficient used to base the equation around the different effects of different materials of which these objects will be based around. This also means that specific objects must be capable of reforming itself after the user has removed any force placed upon the object. The project must also be capable of being introduced into a larger product and not take up too much memory so that the program can run other items based around the game itself. Thus this means that the program must be optimised as much as they possibly can.


Research question

Is it possible to produce an optimized program which can allow the user to deform a rendered object and that object to return to its original state in real time?

Addressing the question

To answer this question research must been done into the different methods of changing meshes in real-time in a program. As of this time I have already found multiple methods and from the ones of which I have found so far the Jacobin matrix shader method seems the most suitable for what I am trying to produce. While this method would be useful for producing my product it does not have any sort of interaction with the user which is something which I want to include in my end product. This means that I will need to look into the different equations used to find the forces which affect the object when pressure is placed onto it. These equations must also be flexible so that the coefficient in the pressure placed on the object can be changed.

Although there are things already needing to be looked into, experimented with and implemented into a working product. There still multiple ways of furthering answering the question at hand by introducing different effects and methods into the product. The first of which is by being able to change the texture of the object of which is being pushed on. This will have a different effect on the forces placed onto the object and thus the possibility of different outcomes (i.e. shattering the mesh instead of deforming). This means that to allow the program to work I’ll need to look into the creating a setup where the textures of the objects can be chosen and the values of these will affect the outcome of the forces placed upon the object. I will also need to look into splitting meshes which will be complicated and while close to the wanted objective of this product is too much unnecessary work when the wanted product can be produced using easier methods. These ideas are possibilities of furthering the product and giving a better depth into answering the question asked for this product.

I will also need to experiment around with the methods for multiple reasons. First of all I will need to use trial and error to understand how the methods work and how I can change the program to fit to my criteria’s. The next thing I will need to experiment on is in ways of which pressure can be applied to object and the effects it has on the object. The force and pressure applied onto the object must act as realistically as possible and so I will need to test the equations to make sure they are producing a realistic outcome. Finally I’ll need to optimise the program so that the program could be easily implemented into another program and not take up too much memory while producing its effect. This means that certain lines of code will need to be taken out or changed to run smoother and optimising techniques will be needed to be implemented. These techniques need to be tested beforehand to make sure that they will affect the fps the way that I want it to.


Progress

I have made a lot of progress in the research of my project. At the moment I have found three distinct ways of reproducing the process of deformity in the meshes each have their own advantages and disadvantages to them in reproducing the end product which is necessary.

The first method which could be used to reproduce the end results necessary would be the radial basis function method. From the research I have looked into I can see that the radial basis function works fairly similar to that of Bezier curves. This means that the methods uses control points in specific places and will change the formation of the object depending on where the controls points are. This is by the far the easiest to implement and to obtain the wanted required results out all of the methods of which I have found but it has some major problems. This mainly being that the deformation of which this method is capable of deforming is too limited to the amount of deformation that will be necessary for the end product and it is also the most memory consuming of the methods I have found.

The next method of note is the finite element method. This method by far seems to be the most effective method that I have found so far as this method is capable of splitting any object and also allow said object to merge with other meshes to create one object if necessary. This method is also capable of affecting multiple meshes at multiple times without too much of an effect on the processing speed of the program itself. Unfortunately this method is extremely complicated and needs the use of multiple different equations and methods to get working and with the amount of time available to produce our end product means that this method is not possible to be reproducing to give a good end result. It has also been recommended that I stay away from this method due to the level of mathematics necessary to produce the end result.

The final method which I will most likely be using to produce the end results is basically a midpoint between the two previous methods. This method is the Jacobin matrices shader method. This method makes use of the geometry shader which is available in the directX 10 software development kit (SDK). The way that the geometry shader works is that the shader will take in the necessary data on the objects mesh and then differentiate the values into a grid and then smooth out the value to create the deformation more realistic. The end result of this is different from the wanted result so a lot of experimentation will be necessary to achieve this. The method here is very similar to what is needed and it is also shader based, meaning it can easily be implemented into multiple different projects and allow them to run easily without too much change to the necessary code, needed to deform the mesh. It should be noted that due to the fact that XP does not use directX 10 could make things much harder than necessarily need to be.

It should also be noted that I have had a quick look into the necessary equation which would be used to find the elasticity of an object but as of this time I have not had that many breakthroughs with the elasticity equations and will continue to look further into these equations

Resource requirements

I will need a compiler to run this project preferably visual studio C++ and I will also need an application programming interface (API) to write my program. I will probably write my program in openGL but will also take directX into context as well. Using these I will be able to produce my final product.

While I have an overall idea on how to make my meshes deform I still need to do a lot more research into the subject. To do this I will most probably need the use of multiple books to find out some of the necessary equations needed to make the deforming of the meshes as realistic as possible. I will also need the internet to find tutorials on specific problems or to find scholar papers which are relatively close to my own project so I can further my research into the methods of which can be used to achieve my goal and thus either find a better method in getting my end result or improving on the method which I at the moment plan on using.

There are also other things which could also help with the production of the end product. These being mainly objects of which the program plans to imitate. The first which would be imitated will be a stress ball so it would be best if I get hold of stress ball. By using the stress ball as an example I can then test the program to make sure that the program is doing what it is supposed to be doing by comparing it to its real-life object. This will allow me to easily produce a more realistic end product.
References and Bibliography

(Chris Wojtan 2009, Guinot 2006, Noe 2009, Goc 2005)

Chris Wojtan, N. T., Markus Gross, and Greg Turk. 2009. Deforming meshes that split and merge. [online]. SIGGRAPH. Available from: http://www.cc.gatech.edu/~wojtan/topo_goop/topo_goop.html [Accessed 29th September 2009].

Goc, R. 2005. Elasticity: Physics. [online]. Physics Tutorial by Roman Goc. Available from: http://www.staff.amu.edu.pl/~romangoc/M10-elasticity.html [Accessed 26th November 2010].

Guinot, J. 2006. oZone3D.net Tutorials: Mesh Deformers in GLSL. [online]. oZone3D.net. Available from: http://www.ozone3d.net/tutorials/mesh_deformer.php [Accessed 29th September 2010].

Noe, K. 2009. Computer Graphics Lab: Noe's tutorial on deforming 3D geometry using RBFs. [online]. Alexandra Institute. Available from: http://cg.alexandra.dk/2009/08/14/deforming-geometry-using-radial-basis-functions/ [Accessed 29th September 2010].

Tuesday 25 January 2011

Jacobian matrices shader

from the research i have done into the Jacobian matrices shader method i can say that the method works by effecting the y value of the object being deformed. This causes a ripple effect in the object of choice dependent in the coefficient between the distance of the values and the height of which the ripple is suppose to be.

This method could work to my advantage by allowing the surface to be easily manipulated with a few equations. While this could be easy for a flat surface it maybe problematic for a spheroid which is to be used. This could be fixed by making the program work with a flat surface of the spheroid when calculating the changes in the surface and then changed with further equations so that the object is drawn as a spheroid instead of a flat surface. The method would also need to be changed so that the ripples act in a negative fashion instead of a positive so that the object is affected by pressure on it and not continuously create ripple effects on the surface but is affected by user interaction. which means that the depth and length of the dip created needs to be affected by the amount of pressure placed on the object.