Page 1 of 3

GTA5: Cloth-simulated meshes

Posted: Fri Feb 09, 2018 3:41 pm
by Oleg
Image
ZModeler3 got an update featuring cloth-simulated meshes export for GTA5. The simulated cloth will response to host object movement and in-game wind.

Cloth geometry can use any shader and have to be named as .cloth in hierarchy. High-detailed geometry model (e.g. buffalo2_hi.yft with highest LOD) can be exported with no cloth, as game reads cloth mesh from main model file with default LODs (buffalo2.yft with L1, L2, L3)
Image


Limitations.
  • To the moment (ZModeler build 3.2.0.1178, GTARage.zmf build 3.2.0.337) the following limitations apply:
  • Only .YFT file can contain cloth mesh. Ped models (.YDD) can not be exported with cloth meshes.
  • Cloth mesh can be attached to the main/first hierarchy entry. In case of vehicles, this is always a chassis object.
  • Only one .cloth object is allowed in scene (even thought file format assumes multiple cloth meshes support, game rejects such a file.
  • Non-collideable cloths are exported (cloth will not interact with player or any scene objects). Collide-able cloth meshes are available in game and under research.
  • Model with cloth meshes can not contain embedded textures (see remark below on exporting embedded textures in high lod model).
Settings and properties.
Cloth meshes are still under research, but in order to let you export them right away, some unknown properties are left to be edited manually via user-defined options.
  • User-defined options set on .cloth object are:
  • Options - bit flags togging some features on/off. Can combine (comma-separated) values from 1 to 32. Default: 2.
  • Unk - two unknown value, the first one most likely to be in range -0.5 to +0.5, and the second is mostly -1.
  • Stiffness, Response and Elasticity are comma-separated values defining per-vertex level values. The purpose is guessed, you can suggest your own meaning for these options if you find something with trial and error. Value like 0.0001, 0.003, 0.009 assumes the first "Level" is 0.0001, the second "Level" is 0.003 and the third level is 0.009. Up to six levels can be used currently (see vertex options below). "Stiffness" is optional, some .cloth models have no it.
  • Options set on vertices of .cloth object are available in Properties->GTA5->Options window:
  • Static point - point is attached to some object. Cloth need at least one vertex to be static to hang on, or entire cloth will fall through the ground immediately.
  • Point stiffness, Point response and Point elasticity are Level selectors. Actual level values are set as user-defined properties of the .cloth object itself. Thus, you can assign levels onto cloth vertices and adjust level values on export with trial and error approach.
Embedded textures issue.
When an exported model contain cloth-simulated mesh, the file is not allowed to store embedded textures. At least this applies to a .YFT file featuring combination of regular meshes and cloth meshes (e.g. vehicle model). On the other hand, it is known (and was proved by tests) the game does not need cloth object inside high-detailed model file (e.g. buffalo2_hi.yft can be exported with no cloth). Taking advantage of this game behavior, you can use embedded textures on high-detailed model if needed. However, ZModeler will not export embedded texture unless it is used by some material on an object that is being exported currently. Thus, for example, you can't embed cloth texture unless you export the geometry that uses cloth material. To bypass this problem, you can do the following:
1. Assign textures you like to a proper texture container, the regular way of specifying textures as embedded.
2. Remove L0 compound state from .cloth object using "Del" button on the right of "Convert to compound" in structure panel and having "L0" selected in a list earlier.
3. The removed L0 cloth will get detached as child of compound .cloth object (just delete it).
The compound cloth object should show L1 state in a list.

Re: GTA5: Cloth-simulated meshes

Posted: Sat Feb 10, 2018 12:01 am
by TomcattersVF31
Thank you so much for the implementation. Just tried using modified Liberator flag on an entirely custom model and it works just fine! Perfect.

2 questions:

1. Can I import flag prop objects from around the map or does it have to be flags on vehicle models?

2. I think I'm missing something here, but regarding vertices and properties->gta 5->options... Where exactly is the GTA 5 option located in properties tab? I can't seem to see it.


Anyway, this is AWESOME news. Thanks again :D

Re: GTA5: Cloth-simulated meshes

Posted: Sat Feb 10, 2018 12:07 am
by _Vlad_
Thats awesome news!
How can i edit this file properly ? x64k.rpf\levels\gta5\_citye\scentral_01\sc1_19.rpf\sc1_19_lspd_ban.yft

Re: GTA5: Cloth-simulated meshes

Posted: Sat Feb 10, 2018 1:21 am
by Oleg
@TomcattersVF31, GTA options have to be selected first in Settings->General->Compatibility->GTA5.
Cloth options will appear in properties window under "GTA5" -> "options", but they will toggle for selected vertices on object named .cloth. These will not appear on any other object (this is a part of ZModeler3.exe update involved).

You can use any cloth object or create your own, it doesn't matter. There are some unknown settings that I've used from "marshall" flag, but these seem to be very alike to "dune" and "barracks" models, so I suppose any object will work as cloth, the exporter will fulfill it with proper settings even if you miss to set them at all. Make sure to assign at least one point as "Static point".

@_Vlad_,
scenery cloth objects are a little different, and I haven't tested them. I suppose they might work already, just haven't tested them yet. They will be under research now, as they have a very interesting feature - they interact with scene and collide with player, so there is a hook to collide-able clothing support.

Also, I'm going to make some tests in attempt to attach cloth to .ydr files (haven't ever seen any .ydr file with cloth in OpenIV, if anyone has seen it, write me back please)!

P.S. the flag in a video is a brand-new, flat surface created as 36x24 points. Static points on the pole side, the rest of points use "Response" level of 0.0005 (original marshall flag had response 0.003 or 0.004 on all points and it give excessive stretch and wavy effect while driving). Response of 0.0005 looks like weighty drape, as it doesn't wave enough while driving even on high speed, but it looks damn cool when wind is turned on in game.

P.P.S. Also, I can't find any correlation or adjusting values for cloth behavior in response to wind and in response to vehicle movement. It might looks ok on static vehicle with wind and behaves dramatically while driving, or vise versa.
Nuc_e7AuZMM

Re: GTA5: Cloth-simulated meshes

Posted: Sat Feb 10, 2018 1:38 am
by carloxfranco
I already updated my Zm3 but when I import a flag my Zm3 gives this message

ZModeler is ready.
No shader configuration avail for "cloth_default".

or else this happens

Image

Re: GTA5: Cloth-simulated meshes

Posted: Sat Feb 10, 2018 3:04 am
by Oleg
what model file gives you this app crash? does it work fine with other files (e.g. non-cloth models are well-importable?)

Re: GTA5: Cloth-simulated meshes

Posted: Sat Feb 10, 2018 3:48 am
by Yoha
Wonderful! !
Wait for this update for so loooong time~~ :D

Re: GTA5: Cloth-simulated meshes

Posted: Sat Feb 10, 2018 3:57 am
by Oleg
@Yoha,
is your issue with ped (modified .yft file export) resolved, or I should take a look at this situation?

Re: GTA5: Cloth-simulated meshes

Posted: Sun Feb 11, 2018 8:38 am
by Yoha
Oleg wrote:@Yoha,
is your issue with ped (modified .yft file export) resolved, or I should take a look at this situation?
Hi Oleg,
Thanks for put this in your mind.

I've just run the test, but the result is not good.
check below image.

I've updated ZM3 to the latest version.

If i only put new ydd into game, and change the texture in ytd, then run game.
The ped can be spawn succesfully.

But if I put new yft into game, it will crash, when I try to spawn that ped.

About yft, I didn't change anything, like bone position, size of bone, etc, nothing been changed.
Just import it into ZM3, and export it.

Here is the image:
Image

Re: GTA5: Cloth-simulated meshes

Posted: Sun Feb 11, 2018 9:39 am
by Oleg
ok, i'm currently messing with ped models, will take a look by the chance.

bigger file created by ZModeler is OK, as it saves small thumbnail image into a file.

Re: GTA5: Cloth-simulated meshes

Posted: Mon Feb 12, 2018 10:06 am
by carloxfranco
Oleg wrote:what model file gives you this app crash? does it work fine with other files (e.g. non-cloth models are well-importable?)
Yes I can import other things and even yesterday I did the conversion of a car and it went well,

But when I import a flag prop_flag_us.yft it gives this error or else gives ZModeler is ready.
In the shader configuration avail for "cloth_default".

My Zm version:Image

Re: GTA5: Cloth-simulated meshes

Posted: Mon Feb 12, 2018 10:11 am
by Oleg
ok, i'll check it few later.

Re: GTA5: Cloth-simulated meshes

Posted: Mon Feb 12, 2018 10:55 am
by carloxfranco
Oleg wrote:ok, i'll check it few later.
prop_flag_us.yft = No shader configuration avail for "cloth_default".

prop_flag_us_r.yft = bust with zmodeler

prop_flag_us_s.yft = bust with zmodeler

prop_flag_usboat.yft = bust with zmodeler

Re: GTA5: Cloth-simulated meshes

Posted: Mon Feb 12, 2018 11:05 am
by Oleg
I haven't messed with scene cloth .yft files. Leave them for now, they might have a different format layout or setup inside.

Re: GTA5: Cloth-simulated meshes

Posted: Mon Feb 12, 2018 8:25 pm
by carloxfranco
Oleg wrote:I haven't messed with scene cloth .yft files. Leave them for now, they might have a different format layout or setup inside.
So how do I create banners with movement? I did not realize anything then. Would it be possible to create a video tutorial?

Re: GTA5: Cloth-simulated meshes

Posted: Sun Feb 18, 2018 11:54 am
by Oleg
BDUz3PgIeJ0

Re: GTA5: Cloth-simulated meshes

Posted: Thu Feb 22, 2018 12:29 pm
by Oleg
Ped cloth getting improved significantly, but I face a problem I can't fight in several days already.
The cloth on a ped model seem to respond into an opposite direction to the wind
ped_cloth_01.jpg
This becomes clearly visible when ped moves (or runs), the cloth intend to sway toward direction of movement. Especially bad effect when riding a bike:
ped_cloth_02.jpg
As expected, reversing on a bike makes cloth sway into back direction too:
ped_cloth_03.jpg
I thought I've messed something badly, but take a look at original model with cloth (minor hex editing to increase cloth freedom, no other changes, no import or export):
ped_cloth_04.jpg
having the same effect while riding a bike:
ped_cloth_05.jpg
So, my question follows: have you ever seen in game a ped model with cloth that has correct sway effect while ridding the bike? may be some accessory with straps, tapes that does act properly?

P.S. Just after posting this I thought of player_zero's jacket fields that do behave properly. will inspect this certainly.

Re: GTA5: Cloth-simulated meshes

Posted: Thu Feb 22, 2018 2:36 pm
by Oleg
well, after some tests with Michael jacket (uppr_000 and uppr_029) I get pretty strange observations. Uppr_000 model has a bit different cloth data, so I tested uppr_029 mostly, as they seem to behave very alike.

Initial spawn gives incorrect model behavior with opposite-direction cloth sway while riding a bike.
However, after a deep crash (later found to be just "get out of bike") the sway becomes correct while riding:
ped_cloth_07.jpg
this is clearly seen on altered (high wind/movement freedom on cloth) model:
ped_cloth_08.jpg
even more, the model gets correct wind response while still riding a bike (stand still)
ped_cloth_09.jpg
but as soon as he gets out of the bike, wind effect changes to incorrect again
ped_cloth_10.jpg
Also, it is clearly seen the game "resets" cloth simulation during "get on the bike" and "get off the bike" animations playback, so I think we have some sort of a bug here (not sure whether the game is the cause or the model or the trainer).

P.S. was still unable to get correct sway on a test model (explicit editing of cloth and an export from ZMod). Making a superhero model with cloak is doubtful to the moment.

Re: GTA5: Cloth-simulated meshes

Posted: Mon Feb 26, 2018 4:23 am
by Yoha
amazing!!!
the result of cloth on the ped is very nice~~ :shock: :lol:
look forward to the zm3's updated~ :D

Re: GTA5: Cloth-simulated meshes

Posted: Wed Mar 07, 2018 1:08 am
by Oleg
@carloxfranco,
I've checked flag_us models, they contain LODs for geometry and LODs for cloths too. These are importable now, but can't be exported, as lods transition (additional cloth-specific data) requires extra research. You can remove lods from .mesh and from .cloth objects to make it exportable. also, can you specify me a location on map of any of flag_us.yft model?

Re: GTA5: Cloth-simulated meshes

Posted: Fri Mar 09, 2018 10:50 am
by _Vlad_
Oleg wrote:@carloxfranco,
I've checked flag_us models, they contain LODs for geometry and LODs for cloths too. These are importable now, but can't be exported, as lods transition (additional cloth-specific data) requires extra research. You can remove lods from .mesh and from .cloth objects to make it exportable. also, can you specify me a location on map of any of flag_us.yft model?
I can specify a location, for example at VInewood PD station. Just go to Vinewood and get arrested if u cant find it. In red circle https://pp.userapi.com/c840521/v8405219 ... lrBBb4.jpg
https://pp.userapi.com/c831309/v8313099 ... q8rFHA.jpg

Re: GTA5: Cloth-simulated meshes

Posted: Fri Mar 09, 2018 11:11 am
by Oleg
thanks, i'll take a look then.

Re: GTA5: Cloth-simulated meshes

Posted: Fri Mar 09, 2018 8:04 pm
by pnwparksfan
Oleg wrote:@carloxfranco,
I've checked flag_us models, they contain LODs for geometry and LODs for cloths too. These are importable now, but can't be exported, as lods transition (additional cloth-specific data) requires extra research. You can remove lods from .mesh and from .cloth objects to make it exportable. also, can you specify me a location on map of any of flag_us.yft model?
When I import any models that are only cloth, there is no .mesh object, only a .cloth object, and it isn't assigned to any LOD. Is there a way I can make that sort of object exportable?

By the way, Codewalker has a world model search tool. Open the tools sidebar, then click the Tools menu button and choose World Search. There you can type a model (or part of a model) name and it will list every location in the world where it exists. You can then double-click on an entry to go to that position and see it.

Re: GTA5: Cloth-simulated meshes

Posted: Sat Mar 10, 2018 2:19 am
by Oleg
cloth-only models are currently under research.

Re: GTA5: Cloth-simulated meshes

Posted: Mon Mar 12, 2018 9:50 pm
by pnwparksfan
It looks like the problem with exporting cloth props may be related specifically to exporting materials which adapt cloth_spec_cutout. I'm still experimenting, but I imported a mesh from a cloth-only model and replaced the .cloth object on a model with non-cloth and cloth parts. It would spawn in game but the cloth was not visible. After much messing around, I found that if I changed the material of the cloth to adapt cloth_normal_spec instead of cloth_cutout, it does show in game. It just so happens that all of the cloth-only props I've inspected so far are made with cloth_spec_cutout, which may be why none of them were working. I haven't yet tried exporting a new cloth-only prop using this info though.