How to make a full screen glow effect as world of warcraft

Started by
12 comments, last by mpipe 17 years, 5 months ago
Hi,everyone ! i am about to create a full screen glow like world of warcraft.Glow in wow is very soft ,and it is really great ! how to achieve it ? Help~~~~
Advertisement
I don't mean to sound harsh, but if you can't figure that out on your own you should probably rethink what you're wanting to do. What exactly have you done as far as programming is concerned? No one is going to be able to just tell you how to do this effect because it is completely dependant on the structure of your code, how you have your rendering system set up etc.

Now if I'm incorrect in my assumptions that something like this may be out of your league right now (not that it will be for long, just seems like you don't really have the knowledge to worry about a very specialized effect like this currently) then I would tell you that this effect is done using some sort of shaders. Now I'm assuming they drop everything into a photonegative type scale by changing the color at each fragment to 1 - current_color (pseudocode). Then they probably have some sort of blurring and maybe even a glow on top.

In GLSL the first part is trivial (however WoW is written in D3D so the shaders would be in HLSL or possibly Cg), in the fragment shader you would simply do

gl_FragColor.rgb = 1.0 - gl_FragColor.rgb;
gl_FragColor.a = 1.0;

That's a good place to start at least, then look into blurring your scene and possibly adding some soft glowing effects
If you want to do some research, a few terms for Google would be 'post-processing', 'bloom', 'glow-shader'.

Regards
Admiral
Ring3 Circus - Diary of a programmer, journal of a hacker.
If you want to achieve it without shaders, you can do a simpler method. Used in Need For Speed underground and many other games.

- You render your scene (Or only the things that should glow, the rest of it in black) on a 128x128 area. glViewport(0,0,128,128); (assuming you are using opengl!?)
- Then, you copy those pixels into a buffer. (Search google for that, dont remember the function, but its pretty simple).
- Then, you will need to blur* that buffer. Take each pixel and take the average of the 8 around it. (This part can slow down the game).
- Copy your buffer to a texture.
- Then, render your scene again at full resolution.
- After render this texture on a quad covering the screen with alpha blending : GL_ONE, GL_ONE. (add)

Et voilà.
The result will not looks smooth as with shaders, but if you dont want to bother with shader or you are like me (GeForce4) that can not afford those kind of shader, use this method.

You should result something like this :
http://www.rndlabs.ca/daivuk/Images/07Lightmaps/HRMap3.jpg

Taken from my engine. See the white glow on the lights and at the left. It's a HDR faking.

Have fun.
Quote:Original post by Daivuk
If you want to achieve it without shaders, you can do a simpler method. Used in Need For Speed underground and many other games.

- You render your scene (Or only the things that should glow, the rest of it in black) on a 128x128 area. glViewport(0,0,128,128); (assuming you are using opengl!?)
- Then, you copy those pixels into a buffer. (Search google for that, dont remember the function, but its pretty simple).
- Then, you will need to blur* that buffer. Take each pixel and take the average of the 8 around it. (This part can slow down the game).
- Copy your buffer to a texture.
- Then, render your scene again at full resolution.
- After render this texture on a quad covering the screen with alpha blending : GL_ONE, GL_ONE. (add)

Et voilà.
The result will not looks smooth as with shaders, but if you dont want to bother with shader or you are like me (GeForce4) that can not afford those kind of shader, use this method.

You should result something like this :
http://www.rndlabs.ca/daivuk/Images/07Lightmaps/HRMap3.jpg

Taken from my engine. See the white glow on the lights and at the left. It's a HDR faking.

Have fun.


Are you blurring the buffer in system memory and on the cpu or doing it all on the graphics card?

Author Freeworld3Dhttp://www.freeworld3d.org
On the CPU, I was giving a way to do it without shaders. :)
If you're using OpenGL, are you just using glReadPixels to get the screen data, or the DirectX equivalent? Isn't this slow?
Author Freeworld3Dhttp://www.freeworld3d.org
Yes it's slow. And the DX equivalent (render to texture I think?) is pretty fast.
glReadPixels is remarkably slow -- you should consider using FBO with OpenGL when/if supported.
Instead of doing a glReadPixels you can bind a texture and then use glCopyTexImage2D to copy the framebuffer into it. Then, render a full screen quad with the copied texture several times, each time scaling the texture coordinates.

There's an example at nehe's site and also at Valve's site.

There's also a render to texture ARB extension for OpenGL.

cheers
sam

This topic is closed to new replies.

Advertisement