Gmod materials

Just a general question for lua coding purposes,
where are the materials stored for use with Material()? The only folder I can see is in my steam/steamapps/common/GarrysMod/garrysmod/materials, but if that is where they are, then how does the client get them for use in, let’s say, a HUD for a custom gamemode?

/garrysmod/materials/yourimage.png -> Material(‘yourimage.png’)

Use in a HUD like this:



local image = Material('yourimage.png')
hook.Add('HUDPaint', 'a', function()
        surface.SetDrawColor(255,255,255,255)
	surface.SetMaterial(image)
	surface.DrawTexturedRect( 0, 0, 512, 512 ) // x,y,sx,sy
end)


Just making sure, that’s in your local game folder, right?

Yes

Then if it’s saved on your local files, how can the client see it on a HUD?

Because they should download it when they join if you resource.AddFile it