[Guide] GTA V: Scene hierarchy, compound objects, geometries

GTA:V Modding with ZModeler3 discussion.

Moderator: madga182

[Guide] GTA V: Scene hierarchy, compound objects, geometries

Postby Oleg » Sat Aug 08, 2015 10:21 pm

Scene Hierarchy

GTAV *.yft models are usually split into ultra-high detailed version model file (model_hi.yft) containing only one very-high detailed geometry LOD, and "all the rest" detailed versions (model.yft) containing upto 4 LODs. I'll call the second one the base model. All together your model can have upto 5 LODs. The game will generally use the base model file for in-game logic, physics and collisions and will use high-detailed as a source of geometry (and if available higher resolution textures). The geometry stored in a *.yft file is tightly bind to the hierarchy layout, so the high-detailed model and the base model must reside on exactly the same, absolutely identical hierarchy. This includes both, the order of objects, their child-parent relation and their position/rotation in scene. Literally, you can not add, remove or sort parts inside one (high-detailed) model file without identical changes on a base model file (and vice verse).

Taking this limitation as a strict rule, the filter import/export is designed the way to allow you have just one scene containing data for the high-detailed file and the base model file simultaneously. Technically, this is an utilization of all geometry LODs in common hierarchy tree.

Before you start loading models, make sure to prepare ZModeler to be compatible with loaded model. Open Settings -> General -> Compatibility and set there <Default Compatibility> with the following set of options toggled (then restart ZModeler if you've chaned any).

compatibility_settings01.jpg



Your scene hierarchy should start with a dummy node named the same way as the file you will export into. It should not include ".yft" or ".ydr" extension, just the title only. It is allowed and recommended to specify _hi in a file name, so you denote the exporter the scene contains high-detailed version of a model too. An option combine with existing models will allow the imported model to be merged with existing scene models, so you can import high-detailed model_hi.yft file and then populate it with other LODs by loading model.yft (or vice verse). In this case, a model_hi root node will be created, an attempt to load model.yft with "combine with existing models" will populate data inside model_hi root node. Importing scene in differnt order (model_hi.yft after model.yft) is allowed and will produce mostly the same scene (except the root node will be named model instead of preffered model_hi.

Hierarchy of model contains parts and dummy nodes. Parts are geometry objects with at least one LOD available. Geometry LODs will be combined into a single object, which will be shown with bold name, these objects are called Compound objects. These objects can hold different objects inside and only one at a time could be available depending on scene conditions.

here's an example of loading Buffalo2_hi.yft and Buffalo2.yft models:

compounds_in_hierarchy02.jpg



Compound objects.

Expand the Structure panel above hierarchy view. You should see condition state buttons there: LODs buttons (L0, L1, L2, L3 and L4), effect tooglers (Dirt, Dust, Scratch, Burn) and collision toggler button COL.

compound_components03.jpg

You can pick any of compound objects in a hierarchy view and see available states for this compound. The bold item is the one currently shown by compound. By toggling state buttons all compounds in scene will immediately switch to associated state, so you can switch LODs on all objects by pressing L0, L1, L2 buttons. The Default state is the one when no other state buttons toggled. Importer creates default states on compounds as dummy nodes, so you will see a bunch of dummy nodes in scene on import. The image above shows availability of 5 LODs on "chasis" compound object and "Default" variant is shown currently.

Collision elements are also made as compounds with COL state toggled on it. Thus, you can toggle collisions visibility by toggling on COL state button. Additionally, collision objects are not equipped with Default state, so toggling off COL state will make collision compunds invisible in scene (even no dummies or axes will be shown for them).

The following video is a draft explanation how compounds work and how to create them in scene, assuming you already have geometries for L0, L1, L2...



When no LOD state buttons toggled on, you see the dummy node associated with compound (and other non-compound objects as is). You can (and should) assign properties on these objects in default state. For example, each opening entity like doors, bonnet, boot should be considered by the game as rotation joint, so a correct physics scenario will apply. You can assign rotation constrains on these parts and exporter will configure them as rotation joints. Ensure default state is shown, pick any door object in hierarchy view and press Isolated button in the bottom of hierarchy view. You enable object isolation, so all other objects from scene will vanish temporary. In isolation mode, the Properties panel will automatically shown properties for isolated object, rather than to selected elements. This is for simplicity - you pick object in Isolated mode one by one and see associated properties instantly (no need to deselect and select object(s) to reach its properties). Double-click on "User-defined options".

04_rotation_constraints.jpg


You can see a user-defined options RotX, RotY, RotZ which are rotation constrains on respective axes. Value of 0,0 means "no rotation on this axis allowed", so a given object will rotate on Y axis only in range 0..72 degrees. For simplicity, the filter will apply "cylinder" shape to such a dummy node, so you can see these axis-constrained dummies in scene easily. This does not happen when you manually assign these properties, so don't put this on strict rule "cylinder = will rotate on one axis". Even more, the exporter does not pay attention to dummy shape, size or color, these are completely insignificant during export.

When you've done editing properties of an object, press "Apply" button, so changes are saved. Make sure to toggle "Isolated" button off when done editing the object.

Note, since collision compound objects have no "Default" state associated with them, in order to access or assign properties to collision object, you have to toggle COL state, so you directly access an associated collision object inside a compound. This is important, as you will need to assign specific properties on each collision component.

Geometries.
Most of geometry objects utilize two UV channels, tangents and per-vertex color. Availability and usage of UV channels is denoted in respective material/shader topic, so make sure your object conforms the needs of the shader(s) you apply to it. One object can have several different materials to be used on geometry and vertices components should be taken as maximum of requirements. For example, if just one used material requries Bump mapping, an entire object should have tangents on vertices. The exporter will chop unused data, so this is not of much problem to have tangents or multiple UV channels when these are not used or not needed.

Vertices components (vertices format) is configured on per-object level in Properties -> Mesh -> Vertices -> Format. Tangents are automaticaly evaluated when Surface\Normals\Calculate tool is applied to an object.

Per-vertex color is used in most of GTA V shaders, but this component is not considered as mesh color. Instead, each color component has its own meaning for the shader. For example, in most of cases, Red channel is per-vertex ambient occlusion (pre-computed shading), and Blue channel is the strength of "Burnt" effect. Scene objects can use per-vertex components as "wetness" mask or for some other purpose. You can paint and refine per-vertex color using Surface -> Paint... set of tools. Notice the expansion box in "Paint" branch, it contains an options window where you can specify the channel to be affected by tools. E.g. you can compute AO shading into R channel, and paint manually Blue channel with "Color" tool.

05_paint_channel.jpg
05_paint_channel.jpg (29.6 KiB) Viewed 8854 times


Below is an example of painting Blue channel into black on a driver's door. Blue channel is the level of burnt on paint material. Upper snapshot shows the mesh with per-vertex color as is, the lower snapshot shows the mesh with per-component meaning of vertex color (not using per-vertex color as mesh color):

06_paint_blue_burnteffect.jpg


Standard per-vertex color components meaning are:
Red: Ambient occlusion level. The filter generally uses a black diffuse#2 color masked by inverse of per-vertex R component, so lower AO on R channel will give more black color on a mesh, emulating an AO. This is barely seen on mesh, as AO on GTA models is very tiny in contrast to other games. However, it's strongly recommended to create AO for your meshes too.

Green: deformation constrain. The level of mesh deformation is defined by per-vertex green component. To apply constrains on deformation, reduce green component color. For example, the image above shows magenta color on doors (something about red:255, green:40, blue:255), meaning, "very low deformation" on doors. Thus you can achieve accurate deformations on areas that actually need a deform.

Blue: Burnt effect level. Burnt overlay level is constrained by per-vertex blue color component. You can imit an area where burnt effect will be used by painting per-vertex blue channel properly. Original models generally paint blue channel on center part of chassis and doors only, leaving the hood, wings, bumpers and boot with no burnt affection. I suppose this is done for proper in-game appearence when the vehicle is exploded and bonnet/bumpers fly away in non-burnt state, while the rest of chassis stays burned. It might appear unreallisting when a front bumper thrown 10 meters away (and not burning) covers with burnt texture effect. You should follow the same guideline too.

Alpha: material transition effect. Can be used as transition level of material texture layers. For example, most of "winter" vehicle shaders will use per-vertex alpha as the level of "Snow" overlay effect on a mesh. Scenery models can utilize per-vertex alpha for transition of one texture to another.

In order to increase level of associated channel on per-vertex level, pick desired channel, specify white color and paint the mesh. To reduce associated effect, pick desired channel, specify black color and paint the mesh. Note, the Color paint tool will respect mesh topology during paint with Solid viewport shading mode toggled on (vertex will not get painted if it's covered with some other polygons and not "seen" in viewport; as well as back-facing vertices will not get painted too). To paint "through" the entire mesh, toggle off Solid shading (leave wireframe only) and you can paint through the whole mesh to all vertices in a spot of paint brush area.
User avatar
Oleg
Site Admin
 
Posts: 7826
Joined: Fri Feb 06, 2004 3:54 am

Return to Grand Theft Auto V

Who is online

Users browsing this forum: No registered users and 2 guests

cron