• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

What is replaceableId in MDX models?

Status
Not open for further replies.
Level 3
Joined
Feb 16, 2023
Messages
6
Hello everyone.

Currently I work on some pet project based on Warcraft 3, and I need help with the MDX format. I could not figure out, what is replaceable id used for?
This thread just gives common information, and this page gives me a hint that this is enum, but I still have no idea how to apply this to model.

For example, I parse LordaeronTree0.mdx, and now I get 31 (0x0F in hex) value for replaceableId in a single texture block.
I suppose that this is variations ID, but folder ReplaceableTexture in war3.mpq contains only 8 variations (LordaeronSummerTree, LordaeronFallTree, etc)
 
Level 14
Joined
Jan 16, 2009
Messages
716
A replaceable texture is a texture set at runtime.
The game decide which texture is used for which replaceable slot of a given model instance.
This function could look something like: set_replaced_texture(Model_Instance *instance, u32 replaceable_id, u32 texture_id)

Here are some examples of how it is used in game:
  • Typically, textures using replaceable id 1 and 2 are commonly called team color and team glow. Because the game will set those slots to use textures of the color of the player owner of that instance.
  • For trees, the texture is often defined on the destructible type (Art - Replaceable Texture File). Now when the tree find itself under blight or is harvested by a ghoul the game will simple set the texture used to the blight version of that texture (ReplaceableTextures\LordaeronTree\LordaeronSummerTree.blp -> ReplaceableTextures\LordaeronTree\LordaeronSummerTreeBlight.blp).
  • Finally, there is the War Club ability which will actually copy the texture used by another model instance to make the model instance of the caster use that texture on the corresponding slot. This has been used by the community to freely replace a texture at runtime using JASS (since there is no direct JASS function).
Hopefully this helps you understand the concept.

So if you want to apply this to a model instance without having any game specific state, I suggest using a default texture for each slot id. Typically each slot has a defined use. Here is a non exhaustive list of the known ids.
Code:
enum TEXTURE_REPLACEABLE_IDS : u32
{
    TEXTURE_REPLACEABLE_TEAM_COLOR = 1,
    TEXTURE_REPLACEABLE_TEAM_GLOW  = 2,

    TEXTURE_REPLACEABLE_CLIFF      = 11,

    TEXTURE_REPLACEABLE_LORDAERON_TREE = 31,
    TEXTURE_REPLACEABLE_ASHENVALE_TREE = 32,
    TEXTURE_REPLACEABLE_BARRENS_TREE   = 33,
    TEXTURE_REPLACEABLE_NORTHREND_TREE = 34,
    TEXTURE_REPLACEABLE_MUSHROOM_TREE  = 35,
    TEXTURE_REPLACEABLE_RUINS_TREE     = 36,
    TEXTURE_REPLACEABLE_OUTLAND_TREE   = 37,
};
 
Last edited:
Status
Not open for further replies.
Top