Custom Textures GTA:V / alt:V

It's not very often that I need to stream custom textures through DLC content for GTA:V but this is pretty much how you do it.

If you are looking for something like this...

These are done through a .ytd file.

Tool You Need

You are going to want to install the File Format plugins for Photoshop in the following folders:

C:\Program Files (x86)\Adobe\Adobe Photoshop CS6\Plug-ins\File Formats
C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Plug-ins\File Formats

You should place a file inside called IntelTextureWorks.8bi from the Intel Texture Works link above.

Using the Tools

Open Photoshop and any Icon / Texture you want to use.

After opening the image you will have two pathways.

  1. You do not need transparency in your image.
  2. You need transparency.

If you keep need transparency follow the following steps. It not; skip these steps.

Go ahead and CTRL + Left Click the icon preview image in your layers tab on the right-hand side.

This specifically:

After you will see that your image is selected; but only the non-transparent parts.

Next in the right-hand side there's a tab called channels open that and click the save selection as chanel at the bottom. It's a square with a circle icon inside of it. Easy to miss.

You should have something like this if your channel was created correctly.

Black is transparent and white is solid.

Finally, just enable the layer.

Great, now we can save the texture.

File -> Save As -> .dds

Now, depending on if your texture has transparency you'll want to do either of the following settings.

Transparency

No Transparency

Great! Now your file is saved and you can make a new file with the Texture Toolkit plugin and import your file and then save it as .ytd

Now when you stream it in-game it will follow the following criteria:

Dictionary: The name of the file.
Image: The name of the texture inside of the file.

Here's some example alt:V code to use with an everyTick or 0ms interval.

export function drawTexture(dictionary: string, name: string, position: alt.Vector3, scale: number = 1) {
    const identifier = `${dictionary}${name}`;
    if (!textureData[identifier]) {
        const [_, width, height] = native.getActiveScreenResolution(0, 0);
        const resolution = native.getTextureResolution(dictionary, name);
        textureData[identifier] = {
            x: resolution.x / width,
            y: resolution.y / height
        };
    }

    const texture = textureData[identifier];
    if (!texture) {
        return;
    }

    const width = texture.x * scale;
    const height = texture.y * scale;
    const [visible, x, y] = native.getScreenCoordFromWorldCoord(position.x, position.y, position.z);

    if (!visible) {
        return;
    }

    native.setDrawOrigin(position.x, position.y, position.z, 0);
    native.drawSprite(dictionary, name, 0, 0, width, height, 0, 255, 255, 255, 255, false);
    native.clearDrawOrigin();
}
Stuyk

Stuyk