Glow effect in 2d ?

BlitzMax Forums/BlitzMax Programming/Glow effect in 2d ?

SillyPutty(Posted 2006) [#1]
Hi all

Does anyone have an idea of creating a glow effect in bmax ? I have seen it in some peoples projects. Some have just manipulated the actual sprite images themselves, and others have gotten it right in code, can anyone suggest how it can be done in code ?

I know indiepath has a module for this, for which I would gladly pay for ! Not too sure if it is still in development though.

Any help in this would be appreciated, thanks guys !


Dreamora(Posted 2006) [#2]
One possibility is to use the same image once again and draw on lightshade, just scaled it slightly up.


SillyPutty(Posted 2006) [#3]
yeah, I am gonna look at doing that, I am into vector graphics lately, so I want my lines to glow, it seems I may have to draw my lines as textured quads.

Would this work ?


Chris C(Posted 2006) [#4]
just draw them 2 or 3 thicker lines with a slightly increasing low alpha I think gllinewidth *might* work with brl's mod alternitavly just use opengl to draw the lines...


SillyPutty(Posted 2006) [#5]
can someone help me increase the intensity and effectiveness of this ?

It just doesnt seem right, and I dont like the idea of rendering more than one line, when 1 could do ?

I would really love to use a textured quad, but not sure how to go about doing this.

Strict

Graphics 800,600

Function DrawGlowLine(x:Int,y:Int,x2:Int,y2:Int,width:Int,Intensity:Int=3)   
	  SetBlend(LIGHTBLEND)

      SetAlpha 0.3
	  For x:Int = intensity To 1 Step - 1
		  'SetAlpha x*(1/intensity)
		  SetColor x*(255/intensity),x*(255/intensity),255
	      SetLineWidth x*(width/intensity)
	      DrawLine x,y,x2,y2
	  Next
		  
	  SetAlpha 1
	  SetBlend(SOLIDBLEND)
	  
End Function

While not KeyDown(KEY_ESCAPE)

	DrawGlowLine(100,100,200,200,20,5)

	Flip
	Cls
Wend



Will(Posted 2006) [#6]
Wrote this modification, doesn't really work nicely but i cant figure out why its not evenly graded at the edges. If you make it work, plz post.


Strict

Graphics 800,600, 0

Function DrawGlowLine(x:Int,y:Int,x2:Int,y2:Int,glowWidth:Int,Intensity:Float=1, stepdist=1)   
	SetBlend(lightblend)
	
	Local steps:Int = (glowWidth)/stepdist
	
	Local lwidth:Float = glowWidth
	Local widthInc:Float = (-glowWidth)/steps
	SetAlpha(Intensity / Float(steps))
	
	For Local i:Int = 1 To steps
		lwidth = lwidth + widthInc
		
		SetLineWidth(lwidth)
		
		DrawLine(x, y, x2, y2)
	Next
	
End Function

While Not KeyDown(KEY_ESCAPE)

	DrawGlowLine(100,100,200,200,200,1, 5)

	Flip
	Cls
Wend




BlackSp1der(Posted 2006) [#7]
it's not a real glow effect, I think you need to manage pixmaps to create a real glow effect.
When you draw a line over other line, you get a white line instead a gradient.




undomiel(Posted 2006) [#8]
Haven't tried the code myself so I don't know how the effect looks right now so I'm just guessing here but wouldn't what you would want to do is reverse the draw order so that you are drawing the bigger transparent ones first and the smaller completely solid one last. That way the glow is around the original line without creating an additive effect on it.


TartanTangerine (was Indiepath)(Posted 2006) [#9]
Email me and I'll sent it to you.


smilertoo(Posted 2006) [#10]
you could use the glowing line library that was released.


tonyg(Posted 2006) [#11]
... if you email Indiepath :)


TartanTangerine (was Indiepath)(Posted 2006) [#12]
heh, maybe I should just ask for donations :D


SillyPutty(Posted 2006) [#13]
I sent you an email Indiepath, thanks so much :)


SillyPutty(Posted 2006) [#14]
Emailed indiepath twice now, still no replies.


Dreamora(Posted 2006) [#15]
Last time I emailed him, he hadn't had his modules recompiled for 1.18. Seems like he has more important things to do than to recompile his modules on any BM update once again.


SillyPutty(Posted 2006) [#16]
Just a simple reply from him would have been nice.


BlackSp1der(Posted 2006) [#17]
The Indiepath glow line module isn't only a glow image expanded in a line?
Isn't a glow effect by software, is a glow dot image file. Or I'm wrong?