Mesh Physics (YLD)

Learn about the file format responsible for physics on clothing

Introduction

Clothing models often require more than just static geometry and textures. Certain items, such as long clothing, accessories and more, need to behave dynamically in response to player movement, environmental conditions, or specific in-game physics. This is where Mesh Physics (YLD) files come into play.

What are YLD Files?

YLD files are physics definition files that GTA V uses to simulate dynamic behavior for certain elements of a character’s appearance, primarily clothing and accessories. These files contain data that allows models to respond to physics-based interactions, such as wind, gravity, or collisions, which give the models a more realistic appearance in the game.

Purpose of YLD Files

The Mesh Physics (YLD) files serve several important functions in the game engine:

  1. Dynamic Cloth Simulation: YLD files define the behavior of dynamic cloth elements such as capes, skirts, loose sleeves, or long coats. Without YLD files, these items would appear stiff and unresponsive to movement.

  2. Accessory Physics: Accessories such as scarves, necklaces, or dangling items like tassels can also have associated YLD files to control their movement in relation to the character and the environment.

Components of a YLD File

A YLD file primarily contains information related to the mesh's interaction with in-game physics. These components can include:

  1. Vertex Weights: Each vertex of a mesh can be weighted to specific physics bones or joints, allowing for precise control over how different parts of the model behave under physics-based interactions.

  2. Collision Data: This section of the YLD defines how the mesh interacts with the environment or other parts of the character model. It ensures that cloth or hair does not clip through the character’s body or other items, adding realism to the game.

  3. Spring and Damping Coefficients: These parameters dictate how "springy" or "stiff" the physics-based movement will be. For example, a silk scarf would have a low spring coefficient, making it flow freely, while a leather jacket might have a higher coefficient, making it stiffer.

  4. Gravity and Wind Resistance: YLD files also determine how a mesh responds to natural forces like gravity or wind. This ensures that long coats, for instance, drape correctly over a character’s body and react to gusts of wind.

How Mesh Physics (YLD) Files Work

The YLD files are tied directly to the YDD (Drawable) files that define the visual appearance of the clothing or accessory model. The YDD provides the static geometry and textures, while the YLD file adds the dynamic behavior. These two files work together to create the final result seen in the game.

Example: A long coat in GTA V may have a YDD file that defines its shape, texture, and geometry. The corresponding YLD file allows the coat to flow naturally when the character runs or turns, and ensures that the coat does not clip through the character’s legs as they move.

In the absence of a YLD file, items like coats, capes, or long hair would appear static and rigid, ruining the immersion of the game world. The YLD files ensure that these elements respond realistically to the character’s movement and the environment.

YLD files are typically found alongside their corresponding YDD (Drawable) and YTD (Texture) files within the game’s file structure. The YLD file shares the same base name as the YDD file but ends with the .yld extension. Both files must be present and properly configured for the physics to be applied.

Example file structure:

jbib_000_u.ydd     // Drawable model file for a jacket (jbib)
jbib_diff_000_a_uni.ytd  // Texture file for the jacket
jbib_000_u.yld     // Physics file for the jacket

In this example, the jbib_000_u.yld file ensures that the jacket (drawable type jbib) has dynamic physics applied during gameplay.

Common Use Cases for YLD Files

1. Capes and Long Coats YLD files allow these items to behave like real cloth, flowing behind the character while running or responding to wind. Without the YLD files, these items would appear stiff and unrealistic.

2. Hair Long hairstyles use YLD files to move naturally as characters walk or run. The YLD file controls how the hair flows in response to head movement or environmental factors like wind.

3. Scarves and Loose Accessories Scarves, necklaces, and other dangling accessories benefit from YLD files by having physics-based movement that makes them react to gravity and motion. For example, a scarf might billow as the player runs or turn naturally as the player changes direction.

Summary

Mesh Physics (YLD) files are a crucial part of the GTA V clothing and accessory system, allowing for dynamic and realistic movement of cloth and hair. By working alongside YDD drawable files, YLD files enhance the overall visual fidelity and immersion of the game. While they have limitations, their careful implementation can significantly improve the realism of characters in GTA V, especially for clothing items like coats, scarves, and long hair.

Last updated