Dynamic cloth
-
- Kobold
- Posts: 35
- Joined: Mon Feb 07, 2005 6:01 pm
- Location: Ontario Canada
- Contact:
Dynamic cloth
Hey all, I'm new to the community, and I must say I'm very impressed and will try to use this great engine for my next project. I was wondering, Ogre has many of the features we wanted that our programmer would have had to add to another engine himself, but one feature I didn't see while browsing was dynamic cloth.
Has anybody made this yet? If not, could somebody who know how make it or let me know how it could be done?
Thanx a lot, great work everybody!
Has anybody made this yet? If not, could somebody who know how make it or let me know how it could be done?
Thanx a lot, great work everybody!
- Antiarc
- Greenskin
- Posts: 120
- Joined: Thu Jan 23, 2003 8:40 am
- Contact:
- :wumpus:
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
Verlet integration works very well for cloth simulation, you basically just have a grid of springs that you simulate with very basic force integration.
http://members.shaw.ca/chahal/clothpaper.htm
We're thinking of putting in a demo doing basic cloth simulation for an 'OGRE logo' flag, but I don't know when
http://members.shaw.ca/chahal/clothpaper.htm
We're thinking of putting in a demo doing basic cloth simulation for an 'OGRE logo' flag, but I don't know when
-
- Kobold
- Posts: 35
- Joined: Mon Feb 07, 2005 6:01 pm
- Location: Ontario Canada
- Contact:
verlet simulation
how would this work with wind? Could we have a set wind direction and force, then set certain objects to differen levels of movement? Cotton and canvas wouldn't react the same to the same wind as canvas is heavier material - thicker and heavier.
A demo would be nice indeed!
A demo would be nice indeed!
- :wumpus:
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
did you read the link? There are three types of springs/interconnections: structural, shear and flexion. The relative spring constant of those springs sets the kind of material.
Too stiff materials might not work with the verlet integrator though, due to numerical integration issues.
You can 'simulate' wind easily with a slight constant force in some direction as I've heard.
Too stiff materials might not work with the verlet integrator though, due to numerical integration issues.
You can 'simulate' wind easily with a slight constant force in some direction as I've heard.
- tuan kuranes
- OGRE Retired Moderator
- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
- Contact:
Here is my demo of a flag in the wind, with gravity but no collision.
Todo :
- I didn't find a way to prevent self-intersection, apart from finding tweaked spring and wind forces...
- Shaders support (per pixel light)
- Lod support (not only reducing vertex count but also reducing spring and normals calculations.)
- collision (at least with a sphere...)
I didn't release it before because of the self-intersection bug... and the bad feeling when looking at Humus flag and cloth demo...
Todo :
- I didn't find a way to prevent self-intersection, apart from finding tweaked spring and wind forces...
- Shaders support (per pixel light)
- Lod support (not only reducing vertex count but also reducing spring and normals calculations.)
- collision (at least with a sphere...)
I didn't release it before because of the self-intersection bug... and the bad feeling when looking at Humus flag and cloth demo...
- :wumpus:
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
Too expensive to do in real time, even with theoretically really low bound algorithms, and often not needed if you tweak the environment well. (especially for things as flags)tuan kuranes wrote: - I didn't find a way to prevent self-intersection, apart from finding tweaked spring and wind forces...
That's a matter of providing the right material I suppose?- Shaders support (per pixel light)
Cool idea. and not that hard if you use a grid- Lod support (not only reducing vertex count but also reducing spring and normals calculations.)
not really a matter for me, I don't want to collide my flags against anything, it must not get crumpled against the flagpole or something- collision (at least with a sphere...)
What's the licensing on your flag demo? Would it be OK to use parts of it in an Ogre demo?
- tuan kuranes
- OGRE Retired Moderator
- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
- Contact:
Would be an honor !Would it be OK to use parts of it in an Ogre demo?
(And will at least demonstrate use of my vector2 patch )
it's an Ogre Demo license.
The good thing in my demo is speed. Didn't find a faster 40x40 flag demo out there, at least in d3d9, as opengl does have 40 fps less here (ati 9600 catalyst 5.1)).
Too expensive, that's the word. I tried many things to prevent self intersection, getting fps as high as 0.5 fps final results ! (using orientation, normals, cross prod and so on...)
But I can't stop thinking there must be a simple concept that handle it...
- It's a grid, so it should be Ok.
Forgot to point that the bounding box calculation is somewhat... flawed.
Need a min, max calculation somewhere in a the flagmesh::update final damping loop.
Was hoping to find a "free software patents" flag somewhere, to cycle with Ogre flag but cannot find one...
Last edited by tuan kuranes on Tue Feb 08, 2005 3:51 pm, edited 1 time in total.
- tuan kuranes
- OGRE Retired Moderator
- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
- Contact:
-
- Greenskin
- Posts: 122
- Joined: Wed May 26, 2004 1:45 pm
- Location: Perpignan, France
Something like that ?Was hoping to find a "free software patents" flag somewhere, to cycle with Ogre flag but cannot find one...
http://nomasis.com/nomablog/blogimages/no_epatents.png
http://www.itzgrund.net/data/logos/noepatents.gif
- :wumpus:
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
There's an overflow somewhere; I get some fairly strange behaviour at the sides of the flags under Linux, maybe it's something to do with a boundary condition?
On shutdown, ogre seems entirely corrupted (log turns to pure gibberish, heap overwrite?)
I didn't find out yet where's the culprit. I do know it happens somewhere in the initialisation of the FlagMesh, as commenting out update() doesn't help.
Edit: the problem is probably local here, still searching, I don't think it's your code at all
On shutdown, ogre seems entirely corrupted (log turns to pure gibberish, heap overwrite?)
I didn't find out yet where's the culprit. I do know it happens somewhere in the initialisation of the FlagMesh, as commenting out update() doesn't help.
Edit: the problem is probably local here, still searching, I don't think it's your code at all
- :wumpus:
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
- :wumpus:
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
Got it! You set mIndexCount too high on creation of the buffer
Change line 267 to:
Change line 267 to:
Code: Select all
mIndexCount = 3 * 2 * (mNumvertX-1)*(mNumvertY-1);
- tuan kuranes
- OGRE Retired Moderator
- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
- Contact:
This comes from a bug...
mIndexCount should be
in initbuffers, 6 is just too much, and will surely cause ATI bugs...
[edit]Too late, you spotted it. Well it's a common bug in my code.. thinking I must write 3*2 to make it clear that it's 2 group of 3 indexes... But my mind cannot prevent himself to gladly compute 3*2=6 in a mind loop and I end up write 6*2 Sorry ! [/edit]
mIndexCount should be
Code: Select all
3 * 2 * (mNumvertX-1)*(mNumvertY-1);
[edit]Too late, you spotted it. Well it's a common bug in my code.. thinking I must write 3*2 to make it clear that it's 2 group of 3 indexes... But my mind cannot prevent himself to gladly compute 3*2=6 in a mind loop and I end up write 6*2 Sorry ! [/edit]
- :wumpus:
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
Thanks
I wonder if it would be possible to make the flag cast a shadow? I see no option of converting it to a closed manifold mesh. Nah, a better option is to use texture shadows, but that rules out self-shadowing.
Btw, I replaced the image with this logo (just the logo, sans the "powered by ogre" etc):
Looks real good on a flag
I wonder if it would be possible to make the flag cast a shadow? I see no option of converting it to a closed manifold mesh. Nah, a better option is to use texture shadows, but that rules out self-shadowing.
Btw, I replaced the image with this logo (just the logo, sans the "powered by ogre" etc):
Looks real good on a flag
- tuan kuranes
- OGRE Retired Moderator
- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
- Contact:
A box with a very small depth could do the trick, no ?
A new side would just be a matter of "vertex winding + slight shift" thing. Vertex culling would make it as effecient as actual one.
(except when looking two sides at once, rare case)
But that would also means edge calculations each frame to get stencil shadows to work... That would be a costly thing.
A new side would just be a matter of "vertex winding + slight shift" thing. Vertex culling would make it as effecient as actual one.
(except when looking two sides at once, rare case)
But that would also means edge calculations each frame to get stencil shadows to work... That would be a costly thing.
-
- Kobold
- Posts: 35
- Joined: Mon Feb 07, 2005 6:01 pm
- Location: Ontario Canada
- Contact:
fast replies
hey guys - wow, amazed at your fast replies....I bet some of you sit at home, firefox up, hitting the refresh page continually for hours just so you can be the first to reply to a new post
Well, I appreciate your ideas - I can't say I fully understand them, but that'll come with time I'm sure.
I'll keep looking down the path you guys have pointed me in - thanx for the giudance and code - and above all, your willingness to help others.
Some demo ideas besides Dynamic cloth in future (by the way, could the GUI demo not be used to launch the other demos? This way the demo program would be all in one exe - consolidate) might be soft-shadowing, ogreODE (maybe too big/not-applicable), a 3D model that could be manipulated in real-time....
Well, I appreciate your ideas - I can't say I fully understand them, but that'll come with time I'm sure.
I'll keep looking down the path you guys have pointed me in - thanx for the giudance and code - and above all, your willingness to help others.
Some demo ideas besides Dynamic cloth in future (by the way, could the GUI demo not be used to launch the other demos? This way the demo program would be all in one exe - consolidate) might be soft-shadowing, ogreODE (maybe too big/not-applicable), a 3D model that could be manipulated in real-time....
- SpannerMan
- Gold Sponsor
- Posts: 446
- Joined: Fri May 02, 2003 10:05 am
- Location: UK
- Contact:
That sounds cool
How about a long, eerie corridor (like some sort of asylum ward) with dingy lighting and rusty walls. There are doors on either side all along the length of the corridor. On the doors are little signs, like 'Smoke' or 'Terrain'. You can move up and down the corridor, and can go in and out of the doors into the different 'rooms' where the different demos show off the different functionality.
How about a long, eerie corridor (like some sort of asylum ward) with dingy lighting and rusty walls. There are doors on either side all along the length of the corridor. On the doors are little signs, like 'Smoke' or 'Terrain'. You can move up and down the corridor, and can go in and out of the doors into the different 'rooms' where the different demos show off the different functionality.
-
- Ogre Magi
- Posts: 1266
- Joined: Tue Aug 12, 2003 1:53 am
- Location: Melbourne, Australia
- x 1
- Contact:
- SpannerMan
- Gold Sponsor
- Posts: 446
- Joined: Fri May 02, 2003 10:05 am
- Location: UK
- Contact:
-
- Ogre Magi
- Posts: 1266
- Joined: Tue Aug 12, 2003 1:53 am
- Location: Melbourne, Australia
- x 1
- Contact: