Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add glowing effect to a line for OpenGL? [closed]

How can I add a glowing effect to a line that I draw? I'm using OpenGL for Linux.

like image 239
joi Avatar asked Nov 28 '11 09:11

joi


People also ask

How does a Bloom shader work?

The effect produces fringes (or feathers) of light extending from the borders of bright areas in an image, contributing to the illusion of an extremely bright light overwhelming the camera or eye capturing the scene.

How do you implement the bloom effect?

To implement Bloom, we render a lit scene as usual and extract both the scene's HDR color buffer and an image of the scene with only its bright regions visible. This extracted brightness image is then blurred and the result added on top of the original HDR scene image.


4 Answers

You can implement the radial blur effect described on Nehe Lesson 36. The main idea is to render the drawing to a texture, and do that N times with a small offset after each render, until the drawing is ready to be copied to the framebuffer.

I've written a small demo that uses Qt and OpenGL. You can see the original drawing (without the blur) below:

enter image description here

The next image shows the drawing with the blur effect turned on:

enter image description here

I know it's not much, but it's a start.

like image 59
karlphillip Avatar answered Oct 19 '22 11:10

karlphillip


I too once hoped there was a very simple solution to this, but unfortunately it is a little complicated, at least for a beginner.

The way glowing effects are implemented today, regardless of API (D3D,OpenGL) is with pixel/fragment-shaders. It usually involves multiple render passes where you render your scene, then render a pass where only "glowing objects" are visible, then you apply a bloom pixelshader and compose them together.

See the link provided by @Valmond for details

Edit:

It should be added that this can be achieved with deferred rendering, where normals, positions and other information like a "glow flag" is rendered to a texture, i.e. stored in different components of the texture. Then a shader will read from the textures and do lightning computations and post-processing effects in a single pass since all data it needs is available from that rendered texture.

like image 29
edvaldig Avatar answered Oct 19 '22 12:10

edvaldig


Check this out : http://developer.download.nvidia.com/books/HTML/gpugems/gpugems_ch21.html

It explains easily how to make glow effects.

like image 27
Valmond Avatar answered Oct 19 '22 12:10

Valmond


Without using shaders, you might also try rendering to texture and doing a radial blur. As a starting point check out NeHe-Tutorials.

like image 26
Zappotek Avatar answered Oct 19 '22 12:10

Zappotek