Jump to content

Please Make Cloth Physics!


Recommended Posts

Posted

I discussed cloth implementation with Xycaleth. He suggested I add it as a request on OpenJK github:

 

https://github.com/Razish/OpenJK/issues/291

 

In my request I posted some research papers and cloth simulation videos showing the research results (clip#3 is amazing!).

 

We think the best way to implement cloth would be to create a cloth Shader... which would identify the object as a cloth object. Cloth simulation would be handled on the client side (thus it would work for both SP and MP). Also, by using a cloth shader it should not break legacy models.

 

I think the cloth physics could be handled by a new class for cloth objects and its class methods-- perhaps Xycaleth could expound on how he thinks it could be implemented.

 

Until cloth physics is implemented... you fake it by having additional bones for cloth. You use the cloth simulation feature in your 3D application to bake the cloth motion onto the cloth bones. Then you tweak the cloth bones' animation by copying their first frame to the end to make the cloth animation loop.

 

EDIT: Cloth simulation results-- http://graphics.snu.ac.kr/%7Ekjchoi/cloth.htm

Posted

i was also worried about overhauling too yeah i thought about that last night... if we did add in a few more bones, i was wondering if it would slow the engine down a bunch? making it pointless

Posted

No, it's just that once you do that you have to re-weigh every model you want to use the new skeleton and you will not be able to play online.

 

I wouldn't consider JA to be a pure sandbox game but it's much closer to being on than MANY games out there and doing things that break online compatibility turns JA into one of those cheap 1 time play through games that collects dust after you beat it 1 time. Not to mention the huge amount of community made models that will no longer work.

Posted

yep. agreed. so yeah devi theres your answer. lmao 

u know why u cant have cloth physics yet devi?

man hours lol

"It's over 9000!!"

 

 

but i will be using this method for kazdan. and that makes me happy for now

 

i doubt anybody else will.. so lemme take a sec out to thank everyone for going in depth with this thread

i learned something  =)

 

and to arch... holy sh*t man

cloth looping and everything u explained about the shader made comlpete sense awesome stuff 

and big thank u for the cloth looping trick 

Posted

oh crap my bad that was an old dragonballz joke. wrong forums lmao

 

 

 

uvwv.jpg


so what youre proposing is the game engine determine that the cloth shader is geometry and will all be hard coded with collision or whatever? i guess the way im picturing it is like a misc_portal is an entity, but the shader calls for it... something sort of along those lines?

but see... ive overloaded a map with shaders before and it brought down my fps as well, will your method still be "cheaper" on the poor old engine?

Posted

I talked to Archangel about it a few days ago, and came up with a possible solution. It would involve adding a "cloth" keyword (and probably a few others to specify its physical properties) to your texture shader. The engine would recognise this as a surface which would need to be simulated as cloth, and would then simulate the surface as if it was cloth. It would do collision detection and stuff with the world/model it's attached to. There would most likely be a high performance hit - models in JKA aren't suited to doing physics cheaply as there is no way to specify a simplified collision hull for a model. How much of a performance hit, I don't know and until it's added, it's difficult to tell. A potential problem that occurred to me, is if the cloth physics were to be made optional, then would the surface marked as cloth do?

 

I should add that at the moment cloth physics is very low priority in OpenJK and will not be considered for a good few weeks or possibly months while we improve the stability of the engine, and take care of more pressing issues.

Posted

Changing the skeleton breaks MP compatibility, ruining the game,

 

yeah i know, but what i was suggesting is if the server as well as the client all used this modified skele... would that fix the compatibility problem for MP? or are the names and amount of bones hard coded into MP? Dont they just have to have the same gla?

 

 

 

 

there is no way to specify a simplified collision hull for a model. 

i was thinking about that from what i know (which isnt much lol) doesnt the jka engine make like boxes around the player for collision? as opposed to using the mesh? ohhhhh wait are u saying first, youd have to fix the mesh collision and remove the boxes so to speak, then implement the cloth? that kinda makes sense to me.

Posted

^You really gotta get out and play some MP, no one stays on 1 server ALL the time.

 

As for collision, most things use a bounding box, using a models hull to compute collision can really kill game performance, best to do like they did for the Pandemic Zero engine (SWBF, SWBF2, TCW) and use a low poly colision mesh to compute collisions, or even multiple primitives, think cube man, it'll still be better than a bounding box.

 

 

collisionproof.png

 

Posted

ahhh yeah see that makes sense... der my blunder i spaced that.

 

this is gunna get me lynched... but here it goes...

 

ive never even finished 1 level of SP  =X ive only modded since day1. and someone chewed my ass out for it too lmao. gettin at me about how the storyline is actually quite good in this game and the gameplay is rather fun your first time around.. but i dont play any games in my defense. never for more than like 5 minutes. i do a lotttttttttt  of modding, and record music, and am a single dad of 2 kids...and have a job lmao... so, i just dont play games man. i swear glob as my witness next time i am bored and dont wanna model something i will indeed play yavin  =)

Posted

You aren't missing out on anything in terms of SP campaign, the story is terrible.

 

MP can be shitloads of fun, I used to spend countless hours playing online, haven't much lately though, all my favorite lugormod servers have went away. I may buy a server though, been thinking about it for some time and I figured just from people knowing me from here it may stay full. Will have to find someone who hasn't forgotten how to build in lugormod like me though to make a nice map.

 

Real time map modding WITHOUT the need for a client side plugin FTW.

Omicron and ChalklYne like this
Posted

I've been thinking. Why can't we just have a modified animation GLA uploaded somewhere, and people who run OpenJK can just download and use it? We wouldn't be distributing it with any standalone project. Can just do a recompile against a new model adding back the toes, fingers & facial bones. In the end, OpenJK can't be held responsible for what players download and use with it. ;)

Omicron and ChalklYne like this
Posted

I talked to Archangel about it a few days ago, and came up with a possible solution. It would involve adding a "cloth" keyword (and probably a few others to specify its physical properties) to your texture shader. The engine would recognise this as a surface which would need to be simulated as cloth, and would then simulate the surface as if it was cloth. It would do collision detection and stuff with the world/model it's attached to. There would most likely be a high performance hit - models in JKA aren't suited to doing physics cheaply as there is no way to specify a simplified collision hull for a model. How much of a performance hit, I don't know and until it's added, it's difficult to tell. A potential problem that occurred to me, is if the cloth physics were to be made optional, then would the surface marked as cloth do?

 

I should add that at the moment cloth physics is very low priority in OpenJK and will not be considered for a good few weeks or possibly months while we improve the stability of the engine, and take care of more pressing issues.

One of the papers I referenced talked about simple elliptical hulls... but we could also use a low-level LOD. Could also use LODs for the cloth mesh as well... even have cloth turn off collision detection when NPCs are at a certain LOD (i.e. a good distance away from player)-- mesh would just keep its root pose if cloth was turned off??? I'm sure we could think of solutions.
Posted

wow man thats really interesting stuff here.. a low level LOD would be number one man. seriously i would be giddy as hell with something like that. 

 

 

 

this is totally unrelated but unworthy of its own post so im sorry in advance 4 the slight derailment... but with LOD's...

i was thinking a few weeks ago about being able to swap between LOD's at certain battle damage percentages.. like you're at 100% health then u have the main model. 75% a bit more damaged of a model, 50% beaten to hell, 25% almost dead. im sure u get the idea. but at a certain percentage, do a glm swap. but, if u could just rig it just like a LOD with its own stupidtriangle_off_dam75...stupidtriangle_offdam50 etc etc am i making any sense here? or if u did it like that would it be ridiculous on the engine as well? would it be easier to swap between glms instead at a certain damage percentage? i apologize again for the derailment

Posted

OP needs a smaller signature, seriously.

 

Side note, please stop making issues on GitHub and posting like six consecutive replies, please just use one post. Reason being is that it sends an email to all stargazers whenever you do that, which is a bit annoying.

 

Anyway, back to business here. I've been looking into something which Rich referred to me. Goes by the name of Open Dynamics Engine. While I plan on trying to implement it for vehicle collision in the distant future, it might have a cloth simulation, I'm not sure. I know it does just basic stuff like mesh on plane collision and so forth, but it might have a cloth simulator too. If I get this implemented into the game before someone properly does that, and it does use cloth related primitives, feel free to steal that, as I might just go ahead and do that too.

 

I just skimmed through the thread, but I'm a little concerned as to how you plan to implement this... Is this an addition to Ghoul 2? The way I'd do it is have some kinda external file to the skins and so forth which lists surfaces which combine to form a physics mesh so to speak that the physics system interacts with. Either way, using your own physics engine is counterintuitive and going to be a hell of a job to write on your own. You still need to figure out how that would work with Ghoul 2 on level collision and Ghoul 2 on Ghoul 2 collision. Anyway, PhysX and Havok are out of the picture as they aren't compatible with GPL.

Posted

Aha, I see Xycaleth posted an eloquent solution. Ignore me.

 

One thing to note -> FX can do Ghoul 2 and level collision with a relatively mild performance hit. Also of note is the "paper" FX keyword, which only works in SP (!!)

Posted

 

One thing to note -> FX can do Ghoul 2 and level collision with a relatively mild performance hit. Also of note is the "paper" FX keyword, which only works in SP (!!)

 could u or someone explain this a bit?

Posted

There's a "paper" keyword in FX files which can be used in either the spawnflags or flags field (I forget) along with ExpPhysics to produce paper physics when there is global wind in the map. This flag is one of the few hidden features of the FX system which are not explicitly mentioned or noted in EffectsEd. It's essentially a hidden feature.

 

Now I'm wondering how this might affect cloth physics code..

ChalklYne and Archangel35757 like this
Posted

I was thinking this cloth Shader and cloth physics would work would work similarly to how some current shaders deform world objects but on the character instead... (like the Shader that makes a wavy flag motion). Couldn't the cloth physics be handled by a new cloth object class methods?

 

Maybe one method could generate those elliptical hulls (see the paper I posted on github) for the charactner to use in player collision detection if the low-level LOD/Ghoul2 is not efficient enough?

 

@@eezstreet - The open dynamics engine does have a spring-mass system but it won't yield good cloth buckling. I read a thesis where ODE was used to simulate rope pretty well. I imagine that ODE could be modified to include the immediate cloth buckling method. See the github papers I posted.

Posted

in the words of Scotty, "I canna change the laws of physics captin" usually physics in a game are handled either by an in house or in engine physics coding, which is basically takes gravity and wind into consideration if you want a basic physics, with cloth, its a lot more to it, it usually has what id call "flowing physics" since everything follows in a  wave like motion to some degree, now I don't know much about in game physics, rather then the IDtech3 engine wasn't designed with physics in mind, now mind you if JKA was rebuilt on the UT3 or UT4 engine, we'd have something to go with, so much more, but as for the IDtech3, we're rather limited to what we can tweak due to the engine's age and limits, now im not a coder, so I do not know if it would be possible to add physics or a simple version of the havoc engine or some other physics engine, like I said, its unknown ground to me, if someone could figure out the ground work then id encourage them to go with it

 

for the sake of whatever: (or if anyone wants to fart around with the Havok physics engine)

http://www.havok.com/try-havok

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...