Sprite rendering problems

Edit: solved (no thanks to you guys >_>). All you had to do was make a custom material and set additive to 1. That’s what’s causing this problem.



local Glowmat = CreateMaterial("glow","UnlitGeneric", {
        ["$basetexture"] = "sprites/light_glow01",
        ["$additive"] = 1,
        ["$translucent"] = 1,
        ["$vertexalpha"] = 1,
        ["$vertexcolor"] = 1,
})

Can someone please tell me why the sprites aren’t translucent? I’ve spent the last 1.5 hours trying to fix it and only manged to come up with two ways to make it work:

  1. create a custom material. This only works for ONE sprite a a time though
  2. Turn them into particles with indefinite life times which is very stupid and roundabout.

Is there anyway to get them to render normally without doing all this stupid stuff?


if SERVER then return end

CreateClientConVar("Fairy_ID", 0, true, false);
CreateClientConVar("Fairy_Light_Brightness", 0, true, false);

//====================
// Function Prototypes
//====================

local MainThink;
local Light;
local Sprite;

//====================
local Fairy;

local Glowmat = Material("sprites/light_glow01")
local Glowmat2 = Material("sprites/glow06")
local Glowmat3 = Material("sprites/glow1")

local part = "effects/yellowflare"

local PixVis

function MainThink()
	if (!IsValid(Fairy) or Fairy == nil) then
		for _,v in pairs(ents.GetAll()) do
			if(IsValid(v) && v:EntIndex() == GetConVarNumber("Fairy_ID")) then
				Fairy = v;
				PixVis = util.GetPixelVisibleHandle()
			end
		end
	else
		Light()
		Sprite()
	end
end

function Light()
	local light = DynamicLight(0)
	local r,g,b,a = Fairy:GetColor()
	if (light) then 
		light.Pos = Fairy:GetPos()
		light.r = r
		light.g = g
		light.b = b
		light.Size = 75
		light.Brightness = 1
		light.DieTime = CurTime() + 0.3
		light.Style = 0
	end
end

function Sprite()
	if (IsValid(Fairy) and Fairy != nil) then
	local Visible = util.PixelVisible(Fairy:GetPos(), 4, PixVis)	
	if (Visible == false) then return end
	
	render.SetMaterial(Glowmat)
	render.DrawSprite(Fairy:GetPos(),20,20,Fairy:GetColor())
	render.SetMaterial(Glowmat2)
	render.DrawSprite(Fairy:GetPos(),100,100,Fairy:GetColor())		
	render.SetMaterial(Glowmat3)
	render.DrawSprite(Fairy:GetPos(),100,100,Fairy:GetColor())
	
	end
end
hook.Add("Think","MainThasdasdink",MainThink);
hook.Add("PostDrawTranslucentRenderables","sprite",Sprite);


Couple other things that might or might not be useful:
-I can’t set the sprites color or alpha when rendering them
-I’ve tried multiple ways of hooking/rendering (including sticking the rendering between cam.Start3D() and cam.End3D()) none of which made any diffrence.