Farmsim Forensics: Solving the mystery of 3D tracks

Kim Brandwijk
Farmsim Forensics
Published in
9 min readJun 11, 2021

Considered by many to be the Holy Grail of tracked vehicles in FS19, and the subject of controversy in the community: 3D tracks. And not just any 3D tracks, but 3D tracks that do not require any scripting, can be created in any desired shape and form, and are approved by GIANTS for both PC and consoles!

GIANT tracks

I won’t claim to be the first one to make 3D rubber tracks. They’ve been around for quite a while, there is a script based solution out there that certainly deserves some merit, and some modders have even been lucky enough to have their track shapes generated for them directly by a GIANTS artist. Others have tried to ‘reuse’ or adapt existing tracks from DLCs, much to the dismay of GIANTS.

If you’re only interested in how to create your own tracks, please skip ahead to the bottom of this article, where I provide the download links to the Blender template and addon you’ll need. Because before I’ll get to that, I’d like to dive a little bit deeper in why and how these tracks work.

How do GIANTS’ tracks work?

A track is made up of 3 elements: a mesh of a (flat) track, a special image (trackArray), and a bit of shader logic to give the track it’s final shape, using the information from the image.

This technique is based on something called Vertex Animation Texture (VAT), and as the name implies, it works by encoding information about the position and/or rotation of vertices into pixels of an image. It’s very efficient, because you can store a lot of information in a small image (you can encode a 30 minute animation of an object with hundreds of bones in a single 4K texture), and because it’s all processed by the GPU, it doesn’t put a burden on the CPU, so it’s generally very performant.

A sample trackArray image

The trackArray is composed of two images. The top one holds the information about the position of every ‘link’ in the track, the bottom one holds the information for the rotation. For rubber tracks, these values are smoothly interpolated, because a rubber track is a continuous shape. For caterpillar type tracks, each pixel corresponds to a single link in the track.

Storing position and rotation information in a pixel?!

Now that the shader code has revealed that it wants to read position and rotation data from this image, the next step in unraveling the mystery was to figure out how this information is encoded into these colored pixels. Again, the shader code gave up some secrets, as it uses ‘xyz’ from the image for position (simple coordinates), and ‘xyzw’ for rotation, suggestion the rotation information should be stored as quaternion values, which is a special representation of rotation (see https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation for an in-depth primer on quaternions). Decoding this data, pixel by pixel, from existing trackArray images, and comparing it with the actual position and rotation of track elements, confirmed the theory, so we now know what information to store in the image, and in which format it should be stored.

Creating new track shapes

As nice of an exercise decrypting image pixels is, it’s an exercise in futility without the ability to generate our own brand new track shapes. As it turns out, all of GIANTS’ tracks are created in an expensive 3D modeling program called Houdini, which has an existing addon for VAT. These tools are not available to the average modder, so I set out to create something for Blender that would serve the same purpose.

Defining a track shape in Blender

For the track shape, I settled on using a curve object. It’s very easy to tweak the shape, it can even be generated from an existing mesh, and other objects can easily be set up to follow a curve.

To represent the track, an armature with 100 bones is set up to follow the curve. For rubber tracks, those 100 bones provide an accuracy of 10 cm per pixel or better, based on the default tracks mesh that is 10 meters long. For caterpillar tracks, each bone would represent a single link of the track.

This technique is a fast and easy way to define track shapes. The blender file I will share also offers the possibility to use a background image to easily recreate existing real world track shapes.

Creating TrackArray Images

Unfortunately, Blender does not have any VAT functionality. There have been some user experiments, but none of them resulted in anything usable for this purpose, so it would need to be programmed from scratch. To stick with the theme of ‘things Blender has no support for’, there’s no DDS support in Blender. There’s also no suitable other built-in image format for our purpose. The only format that would supports the 32 bit depth we need to store the information, is OpenEXR. However, there’s no library that supports converting EXR to DDS. Not a problem, we can just create our own DDS, directly from Python. I’m sure there’s a library that can do that, right? Wrong. What does exist, however, is a Python module for writing TIFF files, a format that supports 32 bit depth, and can easily be converted to DDS by just about every tool.

So the script would read the position and rotation of each bone in the chain, write that to a TIFF image, and at the end of the script, convert the TIFFs for position and rotation into a single DDS texture array. As it turns out, there’s a million different ways you can mess up reading, converting, and writing coordinates and quaternions, so over the course of several days I was treated to tracks that were flipped, warped, twisted, deformed, inside-out, and wrong in every other way imaginable…

Attempt 68, 231, and 478

And then, finally, it happened.

3D tracks in various shapes and sizes

Now, that wasn’t the complete end of the story. The exporter worked, but due to all the libraries and tools needed, installation had become a complete nightmare, running Blender with administrator privileges for the installation, packaging command line tools in the addon, none of the things you would want, ideally.
When I initially thought about writing a DDS directly, it seemed like a daunting task. It’s a complicated file format, with headers and all kinds of flags and fields you need to set just right. But… we are not creating just any DDS, we are creating a very, very specific DDS, one with a very specific layout: 2 images, always with the same size, the same bit depth, no mipmaps, etc. Apart from the pixel data, the DDS would always be completely identical. So why not just hardcode all of it, and just put the pretty colors in there for the specific track shape. This turned out to be way easier, faster, and eliminated all the libraries and command line tools.
And with that, the exporter was done.

Make sure to do everything in the right order!

So… how do I create my own?!

If you’re still reading this, you most likely have one question left: how do I create my own. First of all, go ahead and download the blender file from the download links below. In true Alice in Wonderland fashion, the file contains three main objects: a background image (‘REPLACE me’), a curve (‘EDIT me’) and an armature (‘EXPORT me’).

Don’t rotate anything, don’t move anything, don’t mirror anything. The only thing you have to do is shape the curve any way you want, using a background image for reference if needed.

When you’re done, select the armature for export.

Exporting the TrackArray image

To export the TrackArray image, you first need to download and install the exporter addon. With the addon properly installed, there should be an new entry in the File > Export menu for the TrackArray Image.

The new exporter option for TrackArray images

With the armature selected (labeled ‘Export me’), go ahead and select new export option. The standard save dialog will open, and you can select where to save your TrackArray image.

Congratulations! You have just created your own 3D track shape.

You are now ready to take your new TrackArray shape into the Giants Editor.

Putting the track together in GIANTS Editor

For the final step, we’re going to hop over to GIANTS Editor. In theory, you could do these steps in Blender as well, as the amazing community exporter from SterneIdioten allows you to select shaders and set shader parameters, but that won’t actually bring the track to life until you load it up in the Editor, so for the sake of this article, we’re doing this in GIANTS Editor.

First of all, make sure you have a flat track mesh exported. Like I mentioned before, GIANTS uses a 10 meter long track mesh, which works particularly well with the number of bones we used to generate our trackArray, so unless you know exactly what you’re doing, I suggest you stick to those dimensions.

The flat mesh shape in GIANTS Editor

Next, we’re going to assign a shader to our mesh. The shader is a special variation of the vehicleShader we all know and love. It is not included in the shared base game files, but it is available through a GIANTS Axion Terra Trac mod on the official ModHub. Copy that shader to your mod folder, and select it. Under variation, pick ‘motionPathRubber_secondUV_colorMask’. This will temporarily make your track mesh disappear. This is perfectly normal, because we haven’t told it about our TrackArray image yet.

The vehicleShader attempting to make a track shape

In the shader properties panel, go ahead and click the dots on ‘Custom Texture 3’ and select the TrackArray image we’ve created.

Our new TrackArray image applied to the shader

Spec map for wear, dirt, AO with their own UV map, and UDIM material and color based on your first UV map on your mesh, all work like all other vehicle parts, so that should all sound familiar. The end result, properly textured and configured, should look similar to this:

Our final track, with the correct material, a dirt map, and some normal map detailing

I will skip the configuration of the tracks to get them onto a vehicle. There’s plenty of examples out there on how to do that. An end-to-end video is in the works that will also include that part of the process though.

What’s next?

This is the initial version of the template and addon for Blender. And while it is fully functional for rubber tracks, I will continue to work on it to bring the same functionality to Blender for caterpillar style tracks.
Also on my wishlist is to give you the ability to create a track armature using the standard Blender functionality for creating new object (similar to how you’d create a Cube, a Cylinder or a Bolt).
And lastly, I would like to enable visualization of tracks directly in Blender. This is part of a larger attempt to bring other parts of the vehicle shader (like the UDIM materials) to Blender.
Stay tuned for more information!

Download links

If you have any questions, or topics you would like to see in a future article, feel free to leave a comment.

Enjoy modding, enjoy gaming, and stay tuned for new articles!

--

--