Repository of dumb things Garry's Mod
Seems to work better (ie. models in addons/mylink/models
load when using junction but not when using a symlink).
Can be worked around with something like local GM = GM or GAMEMODE
Meepen Ƹ̵̡Ӝ̵̨̄Ʒ: [you should] not do that
Source: https://facepunch.com/showthread.php?t=1456688&p=47356770&viewfull=1#post47356770
For instance:
e:SetupBones()
e:SetRenderOrigin(somepos)
e:DrawModel()
Namely once for 3d skybox entities, once after (see https://wiki.garrysmod.com/page/Render_Order). If you do something expensive in the hooks that only needs to be done once per frame, it might be worth it to return early in one of the passes.
If you set the texture of env_projectedtexture to some string (eg. myprojtex
), you can render to a RT clientside with same name to change what's displayed on the projectedtexture.
Makes the rt look more like what you're actually drawing to it.
local nilToneMappingScale = Vector(1, 1, 1)
local oldTMSL = render.GetToneMappingScaleLinear()
render.SetToneMappingScaleLinear(nilToneMappingScale)
-- Draw to RT here
render.SetToneMappingScaleLinear(oldTMSL)
Source: Facepunch/garrysmod-issues#1511, https://facepunch.com/showthread.php?t=1374457&p=46073827&viewfull=1#post46073827
You can load the material by using surface.SetMaterial(mat)
anywhere on client.
If you actually want to disable Panel functionality, use Panel:SetEnabled(false)
.
Source: https://facepunch.com/showthread.php?t=1529285&p=50927618&viewfull=1#post50927618 Credits: wauterboi & rubat
AddCSLuaFile();
ENT.Base = "base_anim";
ENT.Type = "anim";
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT;
function ENT:Initialize()
if (SERVER) then
self:SetMoveType(MOVETYPE_VPHYSICS);
self:SetSolid(SOLID_VPHYSICS);
self:SetModel(self.Model);
else
self:SetRenderBounds(self:OBBMins(), self:OBBMaxs());
end
end
function ENT:Draw()
self:DrawModel();
end
function ENT:KeyValue(key, value)
if (key == "model") then self.Model = value end
end
GetRenderTarget
seems to truncate the name to x characters. If you experience render targets pointing to same buffer even with different names, try to shorten the used names to see if it's related to truncation.
Source: https://facepunch.com/showthread.php?t=1497293&p=49312072&viewfull=1#post49312072
local nm = "myrt"
local rt = GetRenderTargetEx( nm, 512, 512, RT_SIZE_NO_CHANGE, MATERIAL_RT_DEPTH_NONE, 8, 4, IMAGE_FORMAT_RGBA8888 )
render.PushRenderTarget(rt)
render.OverrideAlphaWriteEnable( true, true )
render.ClearDepth()
render.Clear(0, 0, 0, 0)
render.OverrideAlphaWriteEnable( false )
render.PopRenderTarget()
-- Note: specifying alphatest, vertexcolor in material constructor seems to be important
local mat = CreateMaterial(nm, "VertexLitGeneric", {["$alphatest"] = "1", ["$vertexcolor"] = "1"})
mat:SetTexture("$basetexture", rt)
If using activities other than ACT_WALK
or ACT_RUN
, remember to edit BodyUpdate (https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua#L64)