Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Joakim Hårsman, posted on December 10, 2000

Image Description, by Joakim Hårsman

This is a shot from the latest version of my cloth simulation, based on spring dynamics. There's air resistance and wind (that's why it's billowing so beatifully :-) ) and decent friction. Oh and ignore the 9.6 fps in the titlebar that's just my timer that's confused since I paused the sim for the shot. The sim can be downloaded from:

Joakim hårsman

Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
Joakim Hårsman

December 10, 2000, 03:07 PM

OK, so the GameDev stuff is basically normal compression. Interesting but that has nothing to do with _generating_ normals, right? For most parametric surfaces it's very easy to get normals, either you use the formula on mentioned previously which is great for e.g. quadrics, or devise your own method specialised for the specific object (simple for e.g spheres and cylinders). If that doesn't work just look it up in "Computer Graphics: Principles and Practice", it contains info on how to do normals for stuff like bezier surfaces so I'm sure there's info for how to generate normals for other types of parametric surfaces.

Joakim Hårsman

December 10, 2000, 03:11 PM

Yeah, clothing will be too slow but you could have curtains billowing in the wind, capes and moving sails in a Pirates type game. Or you could just enable it for badass systems. If you're running at 800 MHz with a GeForce 2 GTS a little cloth simulation probably isn't something to worry about.


December 10, 2000, 05:19 PM

that is just an amazing effect. very beautiful, i'd love to see it on a model like JD Denton from Deus Ex with the coat flowing like that.

Esa Salminen

December 10, 2000, 05:40 PM

One reason for z-buffer problem coming to my mind, if you set near plane distance too small (smaller than 1.0) it possible that this can cause this kind of z-buffer problems, but anyway demo looks very cool, wind effect is very real.


Isaack Rasmussen

December 10, 2000, 06:22 PM

uuuh-hoo, sorry guys. Shouldn't have read that Normal Quantize document at 2.00 AM.
Yes, it is just for compressing normals and nothing to do with generating them.

Okay, yes true. You can do tricks with certain parametric surfaces. I already do it with cylinders.
But doing it on Beziers... that still requires a renormalizing each face right... presuming that you tessellate your parametric into triangles, which I do.

I'm just looking for fast ways to approach ordinary-expensive-sqrt-normalize normals.
It's only for lighting use, as I use a simplified static version for collisiondetection.

But your demo is extremely cool, I was playing around with the wind while the cloth was resting on the sphere. Then a couple of minutes later, when I got tired of it, I just let it rest with no wind... some seconds later, and then all the sudden it just slipped off.
I still think that it could be cool with unpredicted events in games.


Jan Niestadt

December 10, 2000, 06:56 PM

Very nice!
Something weird though: if I press 'H' for high precision, it runs faster than with low precision!

Jan Niestadt

December 10, 2000, 06:59 PM

Hmm, maybe I should post some system specs along with that.. :-)
I have a Celeron 466 and am running the demo with software OpenGL (I have a Voodoo2 but can't get it to run with that).


December 10, 2000, 07:05 PM

"But doing it on Beziers... that still requires a renormalizing each face right... presuming that you tessellate your parametric into triangles, which I do."

You can compute vertex normals directly from the parametric equation for a Bezier patch. Just take the gradient of the surface in both directions (u and v), take their cross product, and unitize.

This should give slightly nicer results than averaging face normals and I think can be done in fewer operations.



December 10, 2000, 07:46 PM

All I can say is: WOW! I spent awhile playing with this, and I didn't have any of the rendering problems here. Maybe I should get a towel to clean the drool from my keyboard now.


December 10, 2000, 07:59 PM

Yes, very nice demo. 39 fps on a P200 + Vaudoo2, but i got the z-fighting problems too :(



December 10, 2000, 08:35 PM

Hey, do you think there should be an award or something for IOTD's that get a whole bucketload of "on-topic" comments - or something? =D

As for the question on "quick" normal generation, and avoiding the sqrt, I don't think you really want to do that... I saw a function out of (maybe?) Graphics Gems that is a hacked super fast sqrt using just a handful of Adds,subs and mults, but it has a %13 inaccuracy factor. The whole idea behind generating a normal is that its supposed to be exactly 1 in lenght - not (0.871.13) =) Turns out that there was only like an average 10% speed difference between the two functions on an athalon 800mhz (whereas my old K6300 was about 20-25%) - so maybe newer cpus handle these sqrts better?

Sorry I can't be any more help than that... which was no help at all.


December 10, 2000, 09:46 PM

Awesome. Love the billowing effect. I was watching it for a while, and the billowing was symmetric on either side of the sphere, and then it started to go more random... cool.


December 10, 2000, 09:47 PM

Looks great! Runs perfectly (except for when the cloth doesn't collide with itself when it hits the ground). Using an NVIDIA GeForce 256 AGP Display Adapter.

Kasper Fauerby

December 10, 2000, 10:12 PM

About quick normal generations :

Remember that if you use "right" triangles (is that the right word to use for triangles where two edges is at 90 degree to each other?) then the length of the cross product of the two edged being perpendicular to each-other is equal to the multiplum of the the length of the edged. Ie. if vector A and B is perpendicular to each other then |A x B| = |A| * |B|.

This means that you can avoid the square-root in the calculation of the normal to triangles of this kind (as normalization is just dividing each vector component by the vectors length).

I can imagine many tesselations use alot of "right" triangles..

Kasper Fauerby


December 11, 2000, 06:46 AM

Cool demo. :)
What ODE solving method are you using? Euler?
Also, I did a similar demo a while back, but I rendered it using
environment mapping. I'd suggest trying that, as it can look
a lot smoother than specular gouraud shading.


Joakim Hårsman

December 11, 2000, 08:19 AM

Low precision is Euler, high is Midpoint. I'm going to implement RK4 as well but haven't gotten around to it yet. Implicit integration is an interesting alternative but probably isn't very well suited to games, it's more of a high end CGI thing. Besides it seems like such a pain to implement. I've also found that good damping does wonders for simulation stability so I'll try to get more of that working.
Environment mapping seems like a cool idea, I'll look into that.



December 11, 2000, 12:02 PM

Yup. RK4 will be good. Possibly adaptive step-size Euler or midpoint. I wouldn't bother with Implicit Euler for this app though.

Something like this can make a big difference in games. I think in Treadmarks they had a flag on the tanks, and each one was just 3x3 points with a pole to the tank. It abviously didn't slow things down because of the low number of points, but it looked SOOO cool :) It bent as the tank accelerated etc...


December 12, 2000, 04:00 AM

Geeesus.... is that your cloth... please take it,
it's cold outside... and leave that ball alone...

da demo rocks!

This thread contains 48 messages.
First Previous ( To view more messages, select a page: 0 1 ... out of 1) Next Last
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.