Material Library Generator

Started by wallworm, November 22, 2011, 11:25:41 AM

Previous topic - Next topic

wallworm

Built into WWMT is a Material Library Generator to convert collections of Source Materials into 3ds Max materials.

One thing I am considering changing is the default of creating a DirectX material for all materials. I need DirectX Material for the Blend Materials (for displacements) but I'm beginning to think it was not a good idea for the World brush materials... since I have noticed a lot of viewport display issues using DirectX materials and Nitrous (3ds Max 2012).

Anyone else seeing this? Opinions?

Stef

Hi wallworm,

I am very interested in getting this working but I am getting an error message as shown here...

I am using:

Max 2012 x64 (running as admin)
Windows 7 x64
Steam is running

This is what I get...


wallworm

Do you have the Wunderboy VTA Importer installed? The tool works best if you have that installed.

If not, make sure that all  your VTF files have been converted to TGA files. You can use VTFEdit for that.

Note that I have majorly updated the way WW exports materials in the last couple of weeks... and I have not had time to test how that affects the materials generated by the Material Library Generator. It may just work... but I have not tested since WWMT 1.85 release. I have also not had time to update docs... so best thing is to read the 1.85 changelog and all things since them here.

Hopefully it works with the recommendations above. If not, let me know.

wallworm

I've updated the link above to the current address for this tool at http://dev.wallworm.com/topic/35/material_library_generator.html

Also, there were many updates to this in the last several months. Mainly, the tool works faster and collects a much larger percentage of settings from VMT files now... and uses the new WW Source Parameters custom attributes in the materials. Enjoy.

CarbonCopyCat

Though earlier today the Material Library Generator was working 100% fine, it somehow broke and no longer recognizes VMTs that exist in the specified folders. I restarted 3ds max numerous times, as well as my computer, and it hasn't fixed, so I'll list out the circumstances to help the troubleshooting.

  • The VMTs, VTFs, and TGAs are all in the same folder
  • The textures that don't import into 3ds max work properly in hammer
  • There is one folder that works in the Material Library Generator, but there is no difference in the VMTs (other than the folder path
  • The material libraries generated with the Material Library Generator before the incident work properly, and export properly
Thanks in advance.

wallworm

My best guess is that the MatGen Path is wrong. Can you verify that the MatGen path in the global settings is in the correct location?

CarbonCopyCat

#6
The problem seems to have sorted out itself (fortunately because it did, but unfortunately because I don't know what caused it, as the MatGen path was set to the correct location). For anyone who is reading this later, you may also be running into an issue I ran into a while before, where the VMTs won't be detected if you set the MatGen path to the direct location of the files. For example, if you dump all your textures you want in the library into one folder called "Decals" on your desktop, and set your MatGen path to the following:
QuoteC:\Users\username\Desktop\Decals
you will get the said error. To fix this, you just need to create a folder inside the folder, (let's call it "Decals", again), and place the files in the first "Decals" folder into the second "Decals" folder.

wallworm

Yes, the material library generator will not make materials from VMTs that are in the root of the MatGen path. The root mat gen path must be the container for folders where your materials go. It generally matches the way Source organizes materials.

The way I set it up is that I have a folder called materials_csgo that represents the materials folder in the game. Inside that folder are all the subfolders (Brick, Concrete, etc) that match the game (because they were extracted directly from the game). That folder and sub-folders have all of the original VMTs and VTFs. It also has a TGA for each VTF (because VTFs don't work in Max 2013+). My MatGen path is set to the materials_csgo folder.

Using this setup should work for you.

Hopefully this is helpful in explaining how it works.

CarbonCopyCat

Well, it seems I've run into an issue with this when I reorganized my materials earlier today  :-\
Pretty much what I've done is put a folder named "tf.materials" on my desktop, and extracted all the vtf's and vmt's into that folder (of course, converting the vmt's into tga's). However, when I attempt to create a material library for this folder (or any of the folders inside), I get this error:

(ignore the name of the library, I forgot you couldn't put /'s into names of files)

Strangely though, some of my older custom textures seem to work, so I have no clue what's going on. Just to make sure, I checked and I had the MatGen path in the correct location, as well as the latest version of Wall Worm. Help would be appreciated.

wallworm

This is probably because a VMT has a syntax error or a syntax I didn't anticipate. If you can figure out the specific VMT choking it, it will help me figure out the problem.

Also, like you mentioned, never use special characters for any of the file names. For the filters it is safe to use things like *,/\ etc.

To help find the VMTs that crash, you can type this into the MAXScript listener (F11):

wallworm_debug = true

then hit Enter. Then re-open the generator and start over. Note that when debug is on, almost ALL WW tools work way slower and outputs a bunch of info in the MAXScript listener. So when done, type: wallworm_debug = false and hit enter.

CarbonCopyCat

I debugged, and the VMT that was choking it was one named "replacements.vmt", which was present in almost every folder. It didn't seem to be linked to a VTF, so I inspected it and it was something to do with pyrovision in TF2 (as far as I could tell). Deleting all instances of it seems to solve the problem. I'm getting some "no VMTs found" in some folders, but I'll check if they do have VMTs (and if so, if those folders are necessary) later. Thanks for the help so far.

wallworm

Can you post the contents of this file?

CarbonCopyCat

The contents differ from what folder it's in, as it seems it's a thing for replacing textures. My guess is that each one corresponds to the files in each folder.

Here's one from the "signs" folder:
replacements
{
templates
{
sign001
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "signs/sign001_pyro"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
sign_spiral
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "signs/sign002_pyro"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
sign_square
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "signs/sign003_pyro"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
sign_triangle
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "signs/sign004_pyro"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
sign_strip2to1
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "signs/sign005_pyro"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
sign_letterx
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "signs/sign006_pyro"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
sign_hash2to1
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "signs/sign007_pyro"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
sign_mmphblu
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "overlays/patch007"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
sign_mmphred
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "overlays/patch007"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
arrow2way
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "signs/sign010_pyro"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
arrowrt
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "signs/sign011_pyro"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
arrowlf
{
"LightmappedGeneric"
{
pyro_vision
{
$basetexture "signs/sign012_pyro"
$vertexcolor $vertexcolor
$decal $decal
$translucent $translucent
$vertexalpha $vertexalpha

$EFFECT 1
}
}
}
}


patterns
{
sign019
{
template "sign001"
}
sign039
{
template "sign001"
}
sign097
{
template "sign_spiral"
}
sign023
{
template "sign_spiral"
}
signwall_blue001
{
template "sign_square"
}
sign126
{
template "sign_strip2to1"
}
blu_warehouse
{
template "sign_strip2to1"
}
red_barn
{
template "sign_strip2to1"
}
sign140
{
template "sign_strip2to1"
}
sign009
{
template "sign_strip2to1"
}
signwall_001
{
template "sign_strip2to1"
}
signwall_002
{
template "sign_strip2to1"
}
number_
{
template "sign_letterx"
}
sign099
{
template "sign_letterx"
}
sign100
{
template "sign_letterx"
}
sign101
{
template "sign_letterx"
}
sign102
{
template "sign_letterx"
}
sign103
{
template "sign_letterx"
}
sign104
{
template "sign_letterx"
}
sign028
{
template "sign_hash2to1"
}
sign125
{
template "sign_hash2to1"
}
sign113
{
template "sign_hash2to1"
}
sign008
{
template "sign_hash2to1"
}
sign121
{
template "sign_hash2to1"
}
//
thelcs
{
template "sign_mmphred"
}
sign001
{
template "sign_mmphred"
}
sign002
{
template "sign_mmphred"
}
sign003
{
template "sign_mmphred"
}
sign004
{
template "sign_mmphblu"
}
sign005
{
template "sign_mmphred"
}
sign006
{
template "sign_mmphred"
}
sign007
{
template "sign_mmphblu"
}
sign011
{
template "sign_mmphred"
}
sign012
{
template "sign_mmphred"
}
sign013
{
template "sign_mmphred"
}
sign014
{
template "sign_mmphred"
}
sign014
{
template "sign_mmphred"
}
sign016
{
template "sign_mmphblu"
}
sign018
{
template "sign_mmphblu"
}
sign020
{
template "sign_mmphred"
}
sign021
{
template "sign_mmphred"
}
sign022
{
template "sign_mmphred"
}
sd_sign001
{
template "sign_mmphblu"
}
sign033
{
template "sign_mmphred"
}
sign034
{
template "sign_mmphred"
}
sign035
{
template "sign_mmphred"
}
sign038
{
template "sign_mmphred"
}
sign040
{
template "sign_mmphblu"
}
sign041
{
template "sign_mmphblu"
}
sign042
{
template "sign_mmphblu"
}
sign043
{
template "sign_mmphblu"
}
sign044
{
template "sign_mmphblu"
}
sign053
{
template "sign_mmphblu"
}
sign054
{
template "sign_mmphblu"
}
sign055
{
template "sign_mmphred"
}
sign056
{
template "sign_mmphred"
}
sign057
{
template "sign_mmphblu"
}
sign058
{
template "sign_mmphred"
}
sign059
{
template "sign_mmphred"
}
sign060
{
template "sign_mmphblu"
}
sign061
{
template "sign_mmphred"
}
sign062
{
template "sign_mmphblu"
}
sign063
{
template "sign_mmphred"
}
sign064
{
template "sign_mmphred"
}
sign065
{
template "sign_mmphred"
}
sign066
{
template "sign_mmphred"
}
sign067
{
template "sign_mmphred"
}
sign088
{
template "arrowrt"
}
sign089
{
template "arrowlf"
}
sign090
{
template "arrow2way"
}
sign
{
template "sign_mmphred"
}
team
{
template "sign_mmphred"
}
}
}




one from the "models/props_trainyard" folder
replacements
{
templates
{
standard
{
"VertexLitGeneric"
{
pyro_vision
{
$VERTEX_LIT 1

$EFFECT 0

$basetexture $basetexture
$BASE_STEP_RANGE "[ 0.0 1.0 ]"

$CANVAS "rj/colorbar3"
$CANVAS_SCALE "[ 0.002 0.002 0.2 ]"
$CANVAS_STEP_RANGE "[ 0.0 1.0 ]"
$CANVAS_COLOR_START "[ 0.0 1.0 0.0 ]"
$CANVAS_COLOR_END "[ 1.0 1.0 0.0 ]"
}
}
}

cart_base
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture "models/props_trainyard/cart_base_pyro"
$vertexcolor $vertexcolor
//$alphatest 1


$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.2
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}
cart_bomb_red
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture "models/props_trainyard/cart_bomb_red_pyro"
$vertexcolor $vertexcolor
//$alphatest 1


$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.2
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}
cart_bomb
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture "models/props_trainyard/cart_bomb_pyro"
$vertexcolor $vertexcolor
//$alphatest 1


$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.2
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}
cart_dispenser
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture "models/props_trainyard/cart_dispenser_pyro"
$vertexcolor $vertexcolor
//$alphatest 1


$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.2
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}

}

patterns
{
cart_base
{
template "cart_base"
}
cart_bomb_red
{
template "cart_bomb_red"
}
cart_bomb
{
template "cart_bomb"
}
cart_dispenser
{
template "cart_dispenser"
}
}
}




and one from the "models/props_foliage" folder
replacements
{
templates
{
standard
{
"VertexLitGeneric"
{
pyro_vision
{
$VERTEX_LIT 1

$EFFECT 0

$basetexture $basetexture
$BASE_STEP_RANGE "[ 0.0 1.0 ]"

$CANVAS "rj/colorbar3"
$CANVAS_SCALE "[ 0.002 0.002 0.2 ]"
$CANVAS_STEP_RANGE "[ 0.0 1.0 ]"
$CANVAS_COLOR_START "[ 0.0 1.0 0.0 ]"
$CANVAS_COLOR_END "[ 1.0 1.0 0.0 ]"
}
}
}


spikeplant
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture "models/props_foliage/spikeplant01_pyro"
$vertexcolor $vertexcolor
$alphatest 1

// $STRIPETEXTURE "rj/stripe4"
// $STRIPE_SCALE "[ 0.002 0.002 0.002 ]"
// $STRIPE_COLOR                   "[0.6 0.25 0.20]"
// $STRIPE_LM_SCALE      1.0



$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.2
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}
cactus
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture "models/props_foliage/cactus01_pyro"
$vertexcolor $vertexcolor
$alphatest 1


$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.2
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}
joshua
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture "models/props_foliage/joshuatree01_pyro"
$vertexcolor $vertexcolor
$alphatest 1

// $STRIPETEXTURE "rj/stripe4"
// $STRIPE_SCALE "[ 0.002 0.002 0.002 ]"
// $STRIPE_COLOR                   "[0.6 0.25 0.20]"
// $STRIPE_LM_SCALE      1.0



$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.2
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}

shrub_03_card_skin2
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture "models/props_foliage/shrub_03_card_skin2_pyro"
$vertexcolor $vertexcolor
$alphatest 1

// $STRIPETEXTURE "rj/stripe4"
// $STRIPE_SCALE "[ 0.002 0.002 0.002 ]"
// $STRIPE_COLOR                   "[0.6 0.25 0.20]"
// $STRIPE_LM_SCALE      1.0

// $COLORBAR "rj/colorbar_white01"

$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.2
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}
shrub_03_card_skin3
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture "models/props_foliage/shrub_03_card_skin3_pyro"
$vertexcolor $vertexcolor
$alphatest 1

// $STRIPETEXTURE "rj/stripe4"
// $STRIPE_SCALE "[ 0.002 0.002 0.002 ]"
// $STRIPE_COLOR                   "[0.6 0.25 0.20]"
// $STRIPE_LM_SCALE      1.0

// $COLORBAR "rj/colorbar_white01"

$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.2
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}
shrub_03_card
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture "models/props_foliage/shrub_03_card_pyro"
$vertexcolor $vertexcolor
$alphatest 1

// $STRIPETEXTURE "rj/stripe4"
// $STRIPE_SCALE "[ 0.002 0.002 0.002 ]"
// $STRIPE_COLOR                   "[0.6 0.25 0.20]"
// $STRIPE_LM_SCALE      1.0

// $COLORBAR "rj/colorbar_white01"

$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.2
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}
shrub_03_model
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture "models/props_foliage/shrub_03_pyro"
$vertexcolor $vertexcolor
$alphatest 1

$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.2
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}
darkgreen
{
"VertexLitGeneric"
{
pyro_vision
{
$EFFECT 1
$VERTEX_LIT 1

$basetexture $basetexture
$vertexcolor $vertexcolor
$alphatest 1

$STRIPETEXTURE "rj/stripe4"
$STRIPE_SCALE "[ 0.002 0.002 0.002 ]"
$STRIPE_COLOR                   "[0.6 0.25 0.20]"
$STRIPE_LM_SCALE      1.0

$COLORBAR "rj/colorbar_darkgreen01"

$DIFFUSE_WHITE 0.9
$GRAY_POWER 0.4
$GRAY_STEP "[ 0.0 1.0 ]"
$LIGHTMAP_GRADIENTS 255
}
}
}

}

patterns
{
spikeplant01
{
template "spikeplant"
}
shrub_03_card_skin2
{
template "shrub_03_card_skin2"
}
shrub_03_card_skin3
{
template "shrub_03_card_skin3"
}
shrub_03_card
{
template "shrub_03_card"
}
shrub_03
{
template "shrub_03_model"
}
grass
{
template "darkgreen"
}
cactus
{
template "cactus"
}
joshua
{
template "joshua"
}
}
}



I would include more, but there's about 20-or-so of these and it would be a bit time consuming to paste them all in. However, I could attach the rest if these are not enough.

wallworm

No, that was good enough. The error is that WW chokes on this line:

$basetexture $basetexture

I will have to update the VMT parser to deal with that.

the6thmonkey

#14
Hey currently having problems trying to get materials into 3dsmax.  I have used vtflib to extract the tga's and then import.  Everything seems to import fine and the materials appear to be in there but they all appear to be grey textures.  Any suggestions?
Oh and the materials are blend textures if that would cause a problem

SMF spam blocked by CleanTalk