From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Name

Daniel Stokes

Email / IRC / WWW

My email is kupomail@gmail.com
My IRC nick is kupoman, and I can be found in the following channels: #gameblender, #blender, #blendercoders, #bgecoders
I have a blog that mostly has posts from last 2011's Summer of Code that can be found at kupoman.wordpress.com

Synopsis

Many of today's game engines feature some form of cloth simulation. The Blender Game Engine's current support for cloth simulation is quite limited, relying mostly on Bullet's soft body simulations. While Bullet's soft bodies work for simple cloth simulations, such as flags or curtains, however it lacks features needed to make it useful on characters, such as pinning vertices. Rather than introducing a new system, this project aims to make use of the cloth simulation currently used by the Blender Renderer. While Blender Renderer's cloth simulation is more feature rich than Bullet's soft body simulations, it lacks in performance. Fortunately the cloth simulation was already written with multiple solvers in mind, meaning a faster one can be added for use in the game engine. This project also needs to modify the Blender Game Engine to make use of time based modifiers, and supply a way to setup efficient collisions with the cloth simulation.

Benefits to Blender

This project will allow end users to setup more usable cloth simulations for their games without relying on external resources, such as python scripts. By reusing existing cloth simulation tools, documentation is already in place to allow Blender Game Engine users to quickly understand their newly gained tools. While this is a Blender Game Engine project, it also benefits the Blender Renderer as well, by providing a faster cloth solver and new cloth collision tools.


Deliverables

  • Support for the cloth modifier in the Game Engine
  • Verlet solver for faster cloth simulations
  • Sphere and capsule collision objects for faster cloth collisions
  • Support for force fields on non-cloth objects
  • Game Engine Python interface to force fields
  • Documentation of new features on the wiki


Project Details

For getting the cloth modifier working in the Game Engine, there are several options. The first option is to simply remove some restrictions on the modifier deformer to allow it to work with specific time based modifiers, such as cloth. Alternatively, a cloth deformer can be created to handle cloth simulation instead of the modifier deformer. By giving cloth its own deformer, it offers the Game Engine more flexibility in dealing with the simulation with out adding special cases to the modifier deformer.
Once the cloth modifier is working in the Game Engine, some further changes will be needed to make the modifier useful for real time use. The current cloth solver is written with accuracy in mind rather than speed, whereas real time usage requires speed instead of accuracy. To address this a new cloth solver will be written based on the Verlet Integrator. This solver will exist along side the current solver, with the choice of which one to use being available to the user. Ideally the same settings will be usable with both solvers to achieve similar results, allowing the user to switch between the two depending upon the situation.
To handle cloth collisions with other objects, the cloth modifier currently relies on the collision modifier. With the cloth modifier getting its own deformer, it should be possible to make the collision modifier work in the game engine as well, at least for cloth simulations. However, the mesh based collisions that the collision modifier offers are not ideal for performance. For real time cloth, collisions are commonly handled with simple shapes such as spheres or capsules. It is unclear how to best add this kind of feature into the current cloth user experience. It could potentially be added to the collision modifier. However, this would require the user to have a mesh that may not represent the collision bounds in order to make use of modifiers. Alternatively, a simple collisions force field could be added so that empties can be used to specify the positions of the spheres/capsules.
Force fields should be simple enough to get working on cloth simulations in the Game Engine. However, it would be nice if those force fields could affect more than just the cloth simulations. To this end, this project will add support for force fields on dynamic physics objects, as well as providing python access to force fields to allow users to make further use of them. This new Python API will consist of a way of managing force fields, such as adding and removing force fields, changing force field settings, and moving the force fields. Furthermore, it should allow a user to supply a point and determine the effects of all force fields on that point, making the API useful for things such as particle systems.


Project Timeline

  • Create a cloth deformer for the Game Engine to use the cloth modifier (2 weeks)
  • Add a new solver using verlet integration (2-4 weeks)
  • Add a method for using spheres and capsule collision shapes (2-4 weeks)
  • Add support for force fields on dynamic objects (2 weeks)
  • Create a Python wrapper for force field objects (2 weeks)
Once the initial goals of the project are met, builds with the changes will be made for the community to test the new features. The remaining time can be used to act on this user feed back and research ways to improve the cloth simulation for use on characters.
The last day of my academic school year is June 14th, meaning I will be able to jump right into the project after the introductory period. I currently am not planning any large vacations for the summer.

Bio

I am a student studying at Eastern Washington University (located in Cheney, Washington, USA) to earn a Master of Science degree in Computer Science. I have been doing Blender development for a couple of years now, and participated in 2011's Google Summer of Code in which I worked on various bug fixes and minor features for the Blender Game Engine. After completing the Google Summer of Code I began contributing in the Harmony branch in which I did work on implementing shadow support for sun lamps, reworked the shadow panel for BGE users, and added support for changing the shadow's color. These changes have all made their way into Trunk. The current iteration of Harmony I am working is focused on increasing user control over the rendering pipeline as well as adding support for inferred lighting. A considerable amount of this completed and usable, though some features are lacking and stability needs to be improved. I have an understanding of design patterns and principles which allows me to make well thought out changes to the code base.