Garry's Mod Wiki

render.SetBlend

  render.SetBlend( number blending )

Description

Sets the alpha blending for every upcoming render operation.

This does not affect non-model render.Draw* functions.

Issue Tracker: 3166

Arguments

1 number blending
Blending value from 0-1.

Example

Creating custom client side blending for ghosts that do not support color alpha channel.

local function BlendGhost(self) local num = render.GetBlend() render.SetBlend(0.8) self:DrawModel() render.SetBlend(num) end local function MakeGhost(model, pos, ang) local ghost = ents.CreateClientProp(model) if (not IsValid(ghost)) then return end ghost.RenderOverride = BlendGhost ghost:SetPos(pos) ghost:SetAngles(ang) ghost:PhysicsDestroy() ghost:SetNoDraw(true) ghost:SetNotSolid(true) ghost:DrawShadow(false) ghost:SetSolid(SOLID_NONE) ghost:SetMoveType(MOVETYPE_NONE) ghost:SetCollisionGroup(COLLISION_GROUP_NONE) ghost:SetRenderMode(RENDERMODE_TRANSALPHA) ghost:SetColor(color_white) ghost:Spawn() return ghost end