• How to change color of .png material
    5 replies, posted
local testmat = Material("materials/mymat.png") local params = { ["$basetexture"] = testmat, ["$nodecal"] = 1, ["$model"] = 1, ["$additive"] = 1, ["$nocull"] = 1, ["$color"] = "0 255 255" } local new_material = CreateMaterial("MyMaterial","UnlitGeneric",params); however this is just giving me this https://i.imgur.com/oZXhCDQ.png
if you check out wiki's note about CreateMaterial, https://puu.sh/CCiDH/afe5c5a311.png so your CreateMaterial table should look like this; local params = { ["$basetexture"] = "materials/mymat.png", ["$nodecal"] = 1, ["$model"] = 1, ["$additive"] = 1, ["$nocull"] = 1, ["$color"] = "0 255 255" }
Ah would it even be possible to change the color of the image then? Or would I be better off just remaking it in the new color.
what are you trying to do with that?
["$basetexture"] = testmat:GetName(), Also what you are doing is kinda wrong, just use surface.SetDrawColor You can see a full proper example at this page: https://wiki.garrysmod.com/page/surface/DrawTexturedRect
surface.SetDrawColor(0, 255, 255, 255) surface.SetMaterial(testmat) surface.DrawTexturedRect(0, 0, width, height) When you use that in some form of draw hook, make sure your replace the width and height variables with what you are using. If you use a white material, SetDrawColor works much, much nicer. PNGs that are darker will not color as you would expect a white material to.
Sorry, you need to Log In to post a reply to this thread.