Content Validation Errors: Image Incorrectly Used as Texture.txt Source and Raw Image

By Shaine Bennett, July 05 2013

There are a number of new errors thrown up by content validation. This one is currently thrown by the download station approvals process (you won't actually see it in Content Manager yet).


Error: Image file 'thing.tga' is incorrectly used as both a texture.txt source file and a raw image file.


This error is telling you that the config file references an image (in this case, thing.tga) directly, when there is also a .texture.txt file that uses the same image file.

Content Manager will compile the .texture.txt and the image file it references into a .texture file when the asset is committed. This .texture file is the most efficient way for Trainz to load an image texture - the vast majority of the work has been done beforehand by Content Manager.

If both the texture and the image are referenced separately, this will cause Trainz to load both copies. This is inefficient - Trainz must now load two copies of the same texture, one of which needs to be created on the fly from an image file.

There are also some cases where loading the image directly will fail completely, and Trainz instead displays a solid white image. That failure case is why this report is considered an error, and not just a warning.

If you receive this error for your content, the simplest fix is to change the config.txt to refer to the .texture file directly. In most cases, this is as simple as changing 'thing.tga' to read 'thing.texture' in the config.txt.

Very occasionally this might not be appropriate; the image might be used as part of a texture with more than one source image (e.g. a texture with a diffuse and normal map), and you did just want a plain copy of the diffuse without the normals for a thumbnail. In this case, you'll need to make a new .texture.txt and set it up how you want it for the image you reference in the config.txt. You may also wish to consider if the image is appropriate at all; the diffuse map from an object will rarely make a good thumbnail. It may be more appropriate to make a proper dedicated thumbnail image instead.