[How-to] Fix failed ZLIB call

If you are trying to load a pedestrian model or spawn in a car and you are presented with an error, it is most likely due to the textures of that particular model is of too high resolution or has an incompatible compression format. Here is the error:

ERR_GEN_ZLIB_2
Failed zlib call. Please reboot, verify the game data, or reinstall the game. For more information, please visit: http:// rsg.ms/verify

Texture limitations

All textures cannot exceed 1024 pixels in either direction, and have to be stored in a specific DXT format (read below). For example, 1024x2048 textures will crash your game, and so will 512x512 textures stored in A8R8G8B8 format.

Be aware that the game will still crash with the same error if the texture dictionary size exceeds 16MB. You will have to downscale textures and/or change compression method to lower the total file size.

It generally is a good idea to reserve 1K textures for big objects, and just do 512x512 or even smaller for the smaller things. Not everybody has a kick-ass computer or high internet speeds like you! These files do need to be streamed after all…

Tools to fix the error

Converting textures

Create a new empty archive in OpenIV (ctrl+n). It doesn’t matter where you save it; the archive is only temporary. Find the *.ytd file of the model in that crashes your game and add it to the archive. Ensure you are in Edit mode and double-click the file you just added.

On the left of the window that just opened, you want to look for items that exceed the texture limitations mentioned above. Click on those items and press the export selected button, and save them in the .dds file format.

Open up Photoshop and load in the files you just exported. If the resolution is too big then you downscale them with Image > Image size so that neither dimension exceeds 1024 pixels. Obviously you’ll want to keep the image ratio, so 1024x2048 becomes 512x1024.

Once the image meets the texture requirements, you’ll want to save the file (File > Save) or if you haven’t made any changes and only want to change the compression method, choose Save as. At the dialog choose .dds as format and press save. It will prompt you with additional options:

Importing converted textures

With OpenIV’s Texture Editor still open, you can press the + Import button to import the textures back in. Leave everything default/automatic on the prompt. This will overwrite textures with the same name without prompting you, so don’t panic thinking it didn’t do anything. After pressing Save you can now drag the *.ytd file back out into your assets folder and delete the created archive and exported textures.

Big texture dictionaries tip

A thing I like to do with big dictionaries is to just export everything into a folder. Open that folder in Windows Explorer and go into Details view (Ctrl+Shift+6 on Windows 10). Right-click the column headers and select More.... Find “Dimensions” and put a checkmark in front of it. Sort by dimension in descending order and you can now quickly find the textures that are too big. Scroll all the way to the bottom of the folder, and the .dds files that show no resolution are likely stored in the wrong format (non-DXT).

Side-note on apparent plain-white .dds files

Some .dds files may appear white in some cases and when you import them back normally, the in-game model may have have solid windows and/or a white body that can’t be painted. In this case you need to manually add an alpha channel to this texture in Photoshop and delete the white foreground so that you now have an empty, transparent texture. Now you’ll have windows you can actually look through.

I’m not sure why this happens, but I believe it is a bug with the OpenIV editor.

3 Likes

Nice, yhank you.
Can you tell about mipmaps leves?

They add optimized, lower-resolution image data (mostly for Level of Detail or quality settings) at the expense of a tad larger file size, which compared to real-time processing, is a better trade off . When working with them in the process of rescaling / reformatting textures, there is only one caveat to be wary of:

You’ll most likely want to make sure not to load MIP maps (if available) when importing a .dds, as the extra image information will double the texture width and thus messes with the aspect ratio, which is only a problem if you don’t specify that the MIP maps are already defined when exporting.

So, under “MIP Map Generation” of the NVidia exporter, if you didn’t load the MIP maps when importing, you can export with “Generate MIP maps” enabled. If you do loaded them when importing, you have to make sure to export with “Use Existing MIP maps”.

2 Likes

thank you. this helpep me a lot :slight_smile:

Does this still work if the size of the file is over 16 mb? I did everything right changed 512x512 ARGB8888 to DXT5 and resized anything that had over 1024 but it still crashes :frowning:

Good question. Which model are you trying to get working? I’ll take a look at it when I have time.

That’s very kind of you! Not used to people like you :stuck_out_tongue:

there’s some models I have but mainly titanic so heres the link to that mod: https://www.gta5-mods.com/vehicles/rms-titanic-hq-add-on
I guess the main reason is that the textures are so many on this I had very hard time getting it work.

Intresting and slightly related to topic bug: if you change the taillights of the Ingot, it wil only change the LOD1 ones, which means from further away your taillights will be modded (in this case, completely murdered out) but up close they’re the originals.

Am I doing something wrong?

You can batch resize dds with ImageMagick(cmdline), or Irfranview (gui), but is there a way to batch extract import them to gtav file formats?

The problem with batching them is that you might end up saving as the improper compression format. Yes, it’s slower if you don’t do it by batch, but well worth on saving the filesize, bandwidth and ultimately the loading times of joining your server.

If only the textures seem to change, then you need to generate MIP maps. If the whole model seems to change, then the issue is with the model lacking LOD versions. Why are you still replacing cars when you can add new cars?

There indeed seems to be a problem if the texture dictionary is over 16MB. If you manage to downscale textures enough and get it under 16MB it will work. I have updated the OP with this information.

“Why are you still replacing cars when you can add new cars?”

Because fuck asking a server owner to add it. I play on many servers and I’d rather have my mods clientsided.

That being said, how do I generate Mipmaps? I don’t have PS but I do have Paint.NET

EDIT: I tried the DDS plugin for The GIMP but it still won’t work as it should. Wat do?

Did you just make Titanic work or was that in singleplayer?

Cause if you did please send me the YTD :smiley:

That is completely incorrect. Textures can be up to 8k. The ytd file must be under 16mb, though.

I see but MsQuerade just showed me a pic of titanic working in multiplayer so can we have that?

Please send it to me D:

Also incorrect. I’m aware that in some cases 1024+ textures do work, but for the sake of avoiding problems and people having to trial-and-error, this is what I wrote as limitations. I’ve added about 30 cars and in quite a few cases the texture dictionary is under 16 MB but with textures over 1024 resolution and in a single case one texture being A8R8G8B8 crashed the game.

Yes, it’s in multiplayer. The idea was to let you do it yourself so you could learn but I saved the file just in case. Seems that I accidentally deleted the file in a rush, though :\ sorry.

Guess I will never be able then, I already tried but it’s way too much work to trial and error with this thing since it’s so huge.

I might do it later for you then. But I will batch process it, so some things may turn out ugly (low resolution). Is that okay?

Who are you to decide what ‘mods’ to run on a server? If you want to decide that so badly, go play by yourself or run your own server, don’t be surprised nobody’ll help you with that.

YEahp! it is more than ok thanks! :smiley: