Sign in to follow this  
VanillaSnake21

How to draw stylized lines

Recommended Posts

Hi, I'm looking for a way to draw lines, boxes, weird shapes (in 2D) and so far I can't think of anything that would let me do that. I always thought that it was the shaders that drew all the small hard to draw elements (such as for example a crooked line with ink splatters around it), but I just ead that shaders only manipulate how geometry is displayed and don't actually draw anything by themselves. Which methods are used to create such effects. BTW, all the drawing has to programmable, so for example the line can't just be a predrawn texture, it has to respond to the game in realtime.

Share this post


Link to post
Share on other sites
Do you have an example of what you're talking about? For example, use of the technique you're describing in another game?

I would have imagined that textures were the most logical way to draw stuff like ink splatters...

Share this post


Link to post
Share on other sites
Quote:
Original post by Codeka
Do you have an example of what you're talking about? For example, use of the technique you're describing in another game?

I would have imagined that textures were the most logical way to draw stuff like ink splatters...


Well prety much any modern game, for example how can you draw a line then make it split when it hits the obstacle, or draw a glowing line or a pulsating one, basically what is that line made out of? Is it usaully done with vertecies/polygons or drawn pixels? A more direct question, I want to simply draw rounded glowing lines, and build a game similar to snake (more like Tron Light Cycles fltron.com) But I want to be able to control the width the curvature, glow, I want it to shatter when it hits the edge or opponent and those effects should all obey some realtime laws, not just be prescrited texture. How can this be accomplished?

Share this post


Link to post
Share on other sites
What you're thinking of, I believe, is usually implemented as a particle effect, and is typically textured quads (i.e. lots of small squares, with a specific kind of texture map applied).

A quick google search turns up things such as this video - these "lines" actually a collection of textured quads.

Share this post


Link to post
Share on other sites
A glowing line can be achieved by drawing 2 (or more) vertices using a LINESTRIP/LINELIST. After that, apply a glow effect to the backbuffer.

Either you render in two passes (a color and glow-buffer) or you use MRT. Either way, apply a horizontal and vertical gaussian blur to the glow-buffer and then blend it over the color buffer.

*edit* Of course, to draw lines, you need to enable wireframe drawing.

Share this post


Link to post
Share on other sites
I should add that the glowing effect that you see in that video is done by blending effects. I once played around with that type of thing when i made a Windows Media Player visualization using OpenGL. OGL has some blend types that add/multiply/subtract/etc the source and destination pixels (i.e. the pixels already on screen and the pixels in the image to be drawn).

EDIT: wow, two posts while i was posting this. Ninja'd * 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this