• Need advice on best approach to materials
    2 replies, posted
I am wondering how to properly set up a complex material system for my car model. Basically I have UV mapped the interior of my Pontiac Grand Am model and I’m now wondering how to properly texture it to make full use of the Source Engine’s material system while also trying to avoid any needless waste of memory. My current idea is to basically put all the colour and baked AO onto a single medium to large texture sheet and then use separate material (.vmt) files to add different $detail textures to specific parts of the mesh. So a tiling leather texture on the leather upholstery and a light noise texture onto hard plastic for example. My question is will the Source Engine only load the large base texture into memory [B]once[/B] or will it be loaded again separately each time I reference it in a .vmt? I want to try and make my final model as resource efficient as possible. Here’s an example of what I was thinking for the .vmt, let's imagine this is for the leather upholstery: [code] "VertexLitGeneric" { "$baseTexture" "models/vehicles/pontiac_grandam/interior/interior_base" "$bumpMap" "models/vehicles/pontiac_grandam/interior/interior_normal" "$phong" "1" "$BasemapAlphaPhongMask" "1" "$phongexponenttexture" "models/vehicles/pontiac_grandam/interior/interior_exponent" "$phongboost" "2" "$phongfresnelranges" "[0.3 0.5 1]" "$phongtint" "[1 1 1]" "$detail" "models/vehicles/detail_textures/leather_tile" // This proxy prevents the material from being coloured using the colour tool in Gmod. "$colorfix" "{255 255 255}" "Proxies" { "Equals" { srcVar1 $colorfix resultVar $color } } } [/code] And then this one is for the plastics: [code] "VertexLitGeneric" { "$baseTexture" "models/vehicles/pontiac_grandam/interior/interior_base" "$bumpMap" "models/vehicles/pontiac_grandam/interior/interior_normal" "$phong" "1" "$BasemapAlphaPhongMask" "1" "$phongexponenttexture" "models/vehicles/pontiac_grandam/interior/interior_exponent" "$phongboost" "2" "$phongfresnelranges" "[0.3 0.5 1]" "$phongtint" "[1 1 1]" "$detail" "models/vehicles/detail_textures/plastic_tile" // This proxy prevents the material from being coloured using the colour tool in Gmod. "$colorfix" "{255 255 255}" "Proxies" { "Equals" { srcVar1 $colorfix resultVar $color } } } [/code] Would this cause the interior_base.vtf, interior_normal.vtf and interior_exponent.vtf textures to be loaded into memory multiple times or is Source smart enough to know to use the same resource just once?
It will only load a vtf once regardless of how many times a vmt references it. Which is nice. Keep in mind it does this on a per-string basis. You can have an identical vtf with the same filename and if you load it from a different filepath it too will get put in memory. Doesn't look like that will be a problem with your setup so you should be good.
Thanks for clearing that up Blue :smile:
Sorry, you need to Log In to post a reply to this thread.