Real-time Cloth and Hair

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
CloakWorks01
Gnoblar
Posts: 13
Joined: Sun Aug 01, 2010 12:56 am
x 1

Real-time Cloth and Hair

Post by CloakWorks01 »

Hi all,

I just wanted to share the middleware technology we're developing at CloakWorks, and get some feedback about the level of interest from the Ogre community:

http://www.youtube.com/watch?v=W2rJ0zOWojM
http://www.youtube.com/watch?v=PHUQdq1kUFY

The 3D viewport in the tool is using Ogre, and you can specify Ogre material scripts for the objects in the scene. File import uses the FBX SDK, so it supports FBX and Collada. GUI uses Qt (Thanks QtOgre!)

Joe
Last edited by CloakWorks01 on Sun Aug 01, 2010 2:14 am, edited 2 times in total.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Real-time Cloth and Hair

Post by jacmoe »

Awesome! :D

I visited your site when you registered and noticed that you are creating something really cool using Ogre.
(I do check most new registrations due to the massive amount of people trying to spam us - so I was just waiting for you to post)

I'd love to hear more about your product.

Must be fairly easy to integrate with Ogre, since you've already done that for the viewer! :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Real-time Cloth and Hair

Post by jacmoe »

Use the Flash tag for the videos :)

Code: Select all

[flash=480,385]youtube_url[/flash]
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
CloakWorks01
Gnoblar
Posts: 13
Joined: Sun Aug 01, 2010 12:56 am
x 1

Re: Real-time Cloth and Hair

Post by CloakWorks01 »

The tech is really the culmination of several years developing animation and procedural animation technology for console games. I was fortunate to be in a position that allowed early access to the current-generation hardware, a mandate to make the best-looking tech in the industry, and a the freedom to meet those goals as I saw fit. Along the way I become very familiar with what these machines are good at, and what to avoid. When I applied what I had learned to cloth and soft body simulation, I came up with a way to run the simulations so that the hardware is really able to achieve its full potential. When I realized how much faster these methods were to conventional methods, I founded CloakWorks to turn it into a product.

Perhaps because of my animation background I was biased, but I decided to approach the creation and use of cloth from an animators perspective, rather than a modelers perspective. Making environmental cloth (flags, awnings) isn't too complicated or exciting, its attaching it to characters where the real value lies. So that's where I put my focus.

Integration with Ogre is fairly straightforward: it provides you with vertex and index buffers, and you just need to refresh the position, normal, and tangent buffers each frame with the new pose from the simulation. Lock, memcpy, unlock, done.

The API is modern C++, and you can use it with any rigid body physics engine you like. Any decent collision system will have a mechanism for notifying you when rigid bodies enter a given volume, so you can trigger events. Each frame the simulation calculates the AABB of its current shape, which you can then add to the collision system of your rigid body engine. When you receive a notification that a rigid body has entered the volume you can then add the shape of the object to the cloth simulation's world, then remove it when it leaves the AABB. I've shipped games using these scheme with Havok Physics.

You'll be able to plug in your own thread scheduler, and can change the settings for the next update while its simulating the current update on another thread. Parallel programming is hard, so the idea is to make this easy to slot into CPU cycles that would otherwise go unused; that way you can drop it into an existing engine and get the benefit of an additional visual effect without effecting your frame rate.

The runtime is designed with SPUs in mind; on PC I'm emulating SPU local memory and DMAs with memcpys. Sony is working with me to get access to dev kits in the near future.

At this stage I'm finishing a couple remaining features, polishing, bug fixing, and trying to line up beta testers and early adopters. If anyone is interested, please LMK.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Real-time Cloth and Hair

Post by jacmoe »



/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 218
Contact:

Re: Real-time Cloth and Hair

Post by Jabberwocky »

Very impressive.
Image
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Real-time Cloth and Hair

Post by jacmoe »

Just watched the videos ... :shock:
This is really impressive.
Also sounds intriguing that it's faster than a dedicated chip.

You're really on to something here. :)
Looking forward to seeing this in games.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Re: Real-time Cloth and Hair

Post by Praetor »

Amazing! I'd love to play around with this.
Game Development, Engine Development, Porting
http://www.darkwindmedia.com
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: Real-time Cloth and Hair

Post by sinbad »

Very nice indeed!
User avatar
cybereality
Hobgoblin
Posts: 563
Joined: Wed Jul 12, 2006 5:40 pm
x 12

Re: Real-time Cloth and Hair

Post by cybereality »

Wow! This looks really good. Nice work.
User avatar
rafa.gdev
Halfling
Posts: 56
Joined: Mon Apr 14, 2008 10:10 pm
Location: Belo Horizonte, Brazil

Re: Real-time Cloth and Hair

Post by rafa.gdev »

Wow! This is totally interesting!
Even emulating the SPU local memory and DMAs is it still able to run at that nice frame rate?
CloakWorks01
Gnoblar
Posts: 13
Joined: Sun Aug 01, 2010 12:56 am
x 1

Re: Real-time Cloth and Hair

Post by CloakWorks01 »

On real SPUs you can hide the DMA costs by kicking off the transfer with a non-blocking call in advance of the data's use; on PC emulating SPUs takes a slight performance hit because of the memcpy. But its just a debug feature to make development easier; I'd never recommend shipping like that, or even enabling it for non-PS3 titles.
kornerr
Greenskin
Posts: 110
Joined: Sun Dec 04, 2005 5:17 pm
Location: Russia
x 5
Contact:

Re: Real-time Cloth and Hair

Post by kornerr »

Awesome. I am so amazed that I wrote a post at BioWare forums in a hope they use it in DAO and/or ME series :)
kornerr
Greenskin
Posts: 110
Joined: Sun Dec 04, 2005 5:17 pm
Location: Russia
x 5
Contact:

Re: Real-time Cloth and Hair

Post by kornerr »

The guys at BioWare forums had pointed correctly how Shroud will perform if it's 10-20 cloaked humans, not a single one. What's the performance?
CloakWorks01
Gnoblar
Posts: 13
Joined: Sun Aug 01, 2010 12:56 am
x 1

Re: Real-time Cloth and Hair

Post by CloakWorks01 »

kornerr wrote:The guys at BioWare forums had pointed correctly how Shroud will perform if it's 10-20 cloaked humans, not a single one. What's the performance?
Ok, fair enough, lets look at that.

I'm still waiting on console hardware, so for now lets assume that the performance on console hardware is close to the performance on my PC (Core 2 Quad, 2.66Ghz). The code is SIMD heavy and optimized for in-order processing, consoles excel at SIMD processing, execute instructions in-order and run at 3.2Ghz.

So at 30fps, you have 1/30th of a second for all your processing. 1/30 = 0.0333s, or 33.3ms.

As seen in the video, a high-quality cape (20x32; for comparison, Havok's cape demo video is using a cape of about 19x13) is taking about 0.3ms using a single thread. So yes, that would be about 1% of the frame. You could make the cape more simple, but lets keep it like this for now.

Now consider that the Xbox 360 has 6 hardware threads, and the PS3 has 2 PPU threads and 6 available SPUs. So on the CPU there's really 6 x 33.3ms = 199ms or more of processing time available each frame if you can exploit it all, and Shroud is designed so that you can. 0.3 / 199 = 0.15% of the frame. 10 capes would be 1.5% of the frame. Its up to the individual to determine if they think the visual payoff is worth sacrificing 1.5% of the available processing time, but I think its a good value proposition. ;-)

In addition, parallel programming is hard, and SPU programming even more difficult. I don't know the specifics of Bioware's engine, but many games are not able to parallelize the work to be done each frame enough to use all the available processing time on all threads. I spoke to a tech director at Ubisoft recently, and he told me that at this point any work they can put on the SPU is essentially free. So not all of that 1.5% for 10 high-quality capes will be taking away from other features of the game.

Finally, consider that the alternatives. PhysX will cost you 6-10x more than Shroud for the same effect, and isn't necessarily designed in such a way to be able to exploit unused cycles on worker threads. I have not had an opportunity to compare Havok Cloth apples-to-apples w/Shroud, but I have spoken to developers who tell me that its performance on consoles is comparable to PhysX cloth.

In the end, cloth is something you add to a game because it looks cool, not necessarily because you can't do without it. You have to make a decision about whether the value it adds to the game is worth the performance cost. With Shroud I hope to keep the positives the same or higher than other cloth solutions, but significantly lower the negatives, and hope that will be enough to make it a valuable addition to everyone's games. Especially Bioware, I love everything those guys make.
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Re: Real-time Cloth and Hair

Post by Praetor »

What about LOD strategies? With multiple characters, do you think it is feasible to dynamic adjust different quality setting for distance? Can you somehow switch to low-res cloths at a distance without terrible side-effects? Or run the simulation with bigger (but still fixed) timesteps?
Game Development, Engine Development, Porting
http://www.darkwindmedia.com
CloakWorks01
Gnoblar
Posts: 13
Joined: Sun Aug 01, 2010 12:56 am
x 1

Re: Real-time Cloth and Hair

Post by CloakWorks01 »

Oh yes, LODs, thank you I forgot to mention that.

Currently Shroud supports LOD in the same way that PhysX appears to in the unreal engine videos I've seen. It is already calculating skinned positions and normals to support the skinned constraints seen in the video. The API allows you to blend between the simulated vertex position and the skinned vertex position for the final rendered result. You can blend the simulation out as it moves farther from the camera, and once has been blended out fully you can disable the simulation update and just use normal skinning to deform the mesh.

I'll be investigating dynamic resolution adjustment for future versions if there is sufficient demand for it.
pratty70
Gnome
Posts: 341
Joined: Thu May 13, 2004 4:52 pm
Location: Wales - UK

Re: Real-time Cloth and Hair

Post by pratty70 »

Very impressive!
workmanaquarious
Gnoblar
Posts: 6
Joined: Sun Feb 19, 2012 5:00 pm

Re: Real-time Cloth and Hair

Post by workmanaquarious »

What happened, is yor site still valid as their is no download link.
Post Reply