Use of Hint=Dynamic in a Texture.txt File

By Shaine Bennett, August 02 2013

A number of content creators are still using .texture.txt files containing the line:


This 'hint' value tells Trainz that this texture is expected to be modified in memory while the game is running. This has been used to produce a number of effects in Trainz history, but importantly there has never been a mechanism provided by Trainz for a content creator to make any use of this effect.

However, it does have a number of side effects:

It will slow down the rendering cycle. As the game considers that the texture may be modified in memory, it keeps it in shared memory, not in dedicated graphics RAM. The graphics card must then access it from system memory every frame. The impact of this will depend on the texture size, and is worse for large textures.
It disables mip-map generation. This is because re-generating mip-maps every time the texture was modified in memory would be impractical.

If you encounter this line in a .texture.txt file while working on an asset, your best course of action is to remove it. In a lot of cases, the line is merely there in the .texture.txt file by accident, having been copied and pasted from a previous file. In a few other cases, the line has been intentionally introduced by a content creator. Either way, it is generally not necessary to replace it with anything else.

If the texture is used as part of a 2D user interface element, you may find that the use of mip-mapping can lead to blurred looking images. If you are experiencing this problem, use this line instead:


This will completely disable the generation of mip-maps, and textures used in the user interface (e.g. "art_icon" images) will remain sharp. However, it doesn't introduce the slowdown that using Hint=Dynamic does.

Disabling mip-mapping for a texture used in the 3D world does work, but results in a poor quality image. You will get poor appearance, with obvious aliasing, moire patterns and also other artefacts.

If this texture config option has been used in the 3D world, it has generally been used in a misguided attempt to increase the "sharpness" of a texture when applied to a plane that is often viewed at an acute angle, e.g. to combat vertical blurring when looking along the side of a rake of carriages. This should instead be improved by increasing the 'Anisotropy' settings using the in-game slider. Trainz defaults to generating sufficient mip-maps for all Anisotropy levels now, so no changes are necessary to .texture.txt files for Anisotropy support; unfortunately the in-game slider still defaults to the lowest level though, so you will need to drag it up to a higher level.

For full documentation on the contents of a .texture.txt file, see the texture file Wiki page which documents all the usable options.