### FIX: Terrain Materials WashOut Cannot Find Texture

Materials, textures, lighting, postfx

#### FIX: Terrain Materials WashOut Cannot Find Texture

Steve_Yorkshire
Posts: 336
Joined: Tue Feb 03, 2015 10:30 pm

Update:
I had the terrain's atlas texture map saving out as a JPG at a mere 90k, hence the loss of clarity.

Default is DDS (683k) and PNG (249k) is also available. Whatever you select does not update until you restart the level so you cannot just check the differences on the fly.

So if you do go looking through the drop down menu ... remember to reset it to a respectable format.

===============================================================

When loading a terrain, the textures are washed out.

In Terrain Painter, on any texture, hitting "apply" without editing any material/texture, brings the correct colour/tone/etc back.

Console says it cannot find the material for the texture - even though it is displaying a "proximity" of that texture.

The crux of the problem is this error message:
[MaterialList::mapMaterials] Unable to find material for texture: rock01a_dryGroundHard80seamlAutoCon2
[MaterialList::mapMaterials] Unable to find material for texture: grassMidDark_base
[MaterialList::mapMaterials] Unable to find material for texture: grassMidDarkDryGroundMix_base
[MaterialList::mapMaterials] Unable to find material for texture: dirtyandmix_base

Yeah I have terrible naming conventions for some textures

Error called from mapMaterials (~300) in materials/materialList.cpp ~338
void MaterialList::mapMaterial( U32 i )
{
//...
if ( materialName.isNotEmpty() )//<----- THIS IS FAILING FOR SOME REASON ... OR IS IT, IT CAN STILL DISPLAY THE TEXTURE?
{
Material * mat = MATMGR->getMaterialDefinitionByName( materialName );
mMatInstList = mat ? mat->createMatInstance() : MATMGR->createWarningMatInstance();
}
else
{
if ( Con::getBoolVariable( "\$Materials::createMissing", true ) )
{

//...
}
else
{
Con::errorf( "[MaterialList::mapMaterials] Unable to find material for texture: %s", mMaterialNames.c_str() );//<---- THE WARNING ~338
mMatInstList = MATMGR->createWarningMatInstance();
}
//...
}


Happens on ALL copies of T3D I have, from devhead going way back to the year nth (or at least the old 3.8).

Anyone with any ideas?
Last edited by Steve_Yorkshire on Fri Mar 29, 2019 1:47 am, edited 1 time in total.

#### Re: BUG: Terrain Materials WashOut Cannot Find Texture

Duion
Posts: 1598
Joined: Sun Feb 08, 2015 1:51 am

A slight hint may be, that terrain textures are handled differently than normal textures and the terrain textures are actually mapped to the base layer, not the actual material.

Can you post your materials.cs?

#### Re: BUG: Terrain Materials WashOut Cannot Find Texture

Steve_Yorkshire
Posts: 336
Joined: Tue Feb 03, 2015 10:30 pm

@ Duion yep, I had the texture map saving out as a JPG. Torque actually defaults to DDS (that and PNG give the best quality). I must have clicked the drop down by mistake, and of course nothing happens until you reload the level ... ahem ...

#### Re: FIX: Terrain Materials WashOut Cannot Find Texture

Duion
Posts: 1598
Joined: Sun Feb 08, 2015 1:51 am

Using JPG is quite heretical.
Another trick is to not set the file ending in the materials.cs, but just type the filename, then Torque will always use it no matter the format, unless you have the same filename in the same folder with multiple file endings, then it may get tricky.

#### Re: FIX: Terrain Materials WashOut Cannot Find Texture

LoLJester
Posts: 110
Joined: Thu Aug 13, 2015 5:58 pm

For anyone stumbling upon the "[MaterialList::mapMaterials] Unable to find material for texture:" warning, you should know that, to avoid this warning, there must be a material created that is mapped to the name of the texture that the warning is displaying.

So, if you have for example:

Code: Select all

new TerrainMaterial() { internalName = "TerMaterialA"; diffuseMap = "art/Textures/myTexture"; };
The corresponding material shall be:

Code: Select all

new Material(myTexture_Mat) { mapTo = "myTexture"; };

#### Who is online

Users browsing this forum: No registered users and 1 guest