Sure I can use :GetMaterial() but it doesn't work with :SetTexture( "$basetexture" ).
From what I gathered I need the full string to the path of the material, e.x ( materials/models/santa_weapon/no/toys/for/you ), then I can use it.
[lua]
Output = GetRenderTarget("CamouflageRT", 1024, 1024, false)
local LPActiveMaterial = LocalPlayer():GetActiveWeapon():GetMaterial()
local OldRT = render.GetRenderTarget()
local w, h = ScrW(), ScrH()
local M4Texture = surface.GetTextureID( LPActiveMaterial )
local Camouflage = surface.GetTextureID("gui/gradient")
render.SetRenderTarget(Output)
render.SetViewPort(0, 0, 1024, 1024)
render.Clear(25, 25, 25, 255, true, true)
cam.Start2D()
surface.SetDrawColor(255, 255, 255, 255)
surface.SetTexture(M4Texture)
surface.DrawTexturedRect(0, 0, 1024, 1024)
surface.SetDrawColor(255, 255, 255, 50)
surface.SetTexture(Camouflage)
surface.DrawTexturedRect(0, 0, 1024, 1024)
cam.End2D()
render.SetViewPort(0, 0, w, h)
render.SetRenderTarget(OldRT)
LPActiveMaterial:SetTexture("$basetexture", Output)
[/lua]
Sure decompiling the models and checking the QC would be easy, but I am trying to make this universal.
This is the best you can get. wiki.garrysmod.com/page/Entity/GetTextures
Sorry, you need to Log In to post a reply to this thread.