Glowing Names

Hey guys.
I’ve been trying to find a tutorial for this, because I couldn’t figure it out myself, and so far, no luck.
It would be very great if someone told me how to make a person’s name glow in the scoreboard and how to set the glow color. Thanks.

Local Color = SetColor(math.rand(1, 255), math.rand(1, 255), math.rand(1, 255), 255)

draw.SimpleText(“text”, “font”, x, y, Color, TEXT_ALIGN_CENTER)

do a curtime check though

Fuck no, shut up.

There is no real glowing for text in gmod, you can try to draw outlined text and let the outline color fade from 0 to 255.

[editline]4th March 2011[/editline]

Holy shit I just read the actual code, made me choke a little.

7:27 PM - Drew P. Richard: best way: math.sin
7:27 PM - Drew P. Richard: with math.abs
7:27 PM - Drew P. Richard: shit is the best
7:28 PM - Drew P. Richard: math.abs(math.sin(CurTime()))
7:28 PM - Drew P. Richard: will fade
7:28 PM - Drew P. Richard: from 0 to 255
7:28 PM - Drew P. Richard: and back

That’s more of a fade effect, now really glow, but you could do something similar.

oops…

(math.sin(RealTime())+1)*127.5

CurTime is synced and can lead to ugly flickering, though it still works

Draw 16 of the same exact text with offsets?

That sounds extremely efficient, you should draw lines to the screen in the form of text almost like making messages with rope that change colours according to what the value of math.Random is on the server, that is sent to the client using datastream every frame

What the fuck are you talking about?

I think you have no idea what this thread is about.

Here, try this:
[lua]
local Var = math.abs( math.sin( CurTime() * 2 ) )

TextColor = Color( Var * 255, Var * 255, Var * 255 )[/lua]

You can have Var * any number between 0-255. The above will produce a pulsate between black and white. the CurTime() * 2 is basically the speed. The higher the slower.

I’ve never used them, but this sounds like something the stencil buffer might work for, draw your glow material then your text and use the stencil buffer to only draw the material x units from the text. If the stencil buffer even works on text, it’s either late or early, so it’s just a guess.

The only thing that comes to mind is this function **[G.DrawBloom

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.DrawBloom)**

Use draw.SimpleTextOutlined(text, font, x, y, colour, xalign, yalign, outlinewidth, outlinecolour) and make the outlinecolour fade between two colors: one which is the color of the glow, and the other being similiar but slightly more closer to white.

That’s what everyone else in the thread has already said to do using math.sin .

Not necessarily helpful, but why does everyone use math.abs with math.sin? I use this:
[lua]
(1 - ((math.cos(var) + 1)/2))*255
[/lua]
Starts at 0, and fades evenly.

I’ve always used 0.5 + math.sin(SysTime()) * 0.5. You really shouldn’t use math.abs, because then it won’t be smooth anymore.