Sign in to follow this  
Unikorn_1982

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

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
If you're using OpenGL, are you just using glReadPixels to get the screen data, or the DirectX equivalent? Isn't this slow?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
WoW uses DirectX 9 pixel shaders to do this. (it says in the tooltip for the option you need a 9 card for it I beleave)

I'm unsure of how to integrate pixel shaders in 9, but the shader itself should be a very simple (well... compared to a lot of things) piece of HLSL. I'm thinking it would be ran as the very last step (not in the graphics pipe, but in the actual calls in your program) before the buffer is swapped for display.

A simple guess is it would just sample the pixels around the one being worked on and average the color out to some degree, and plot the pixel either back into the back buffer or into a storage one. (or the reverse of that... copy buffer initially and plot into the back buffer... I think the pixel shader can only plot to the back buffer anyways...)

An effective, simple blur... I guess. I'm not checking this for accuracy, it's just a basic starting point, so don't jump on my idea and rip it to shreds! :P


Also... it is being 'kind of' harsh to say that it's out of his league and depandant on how everything is set up... It's obvious that the specifics depend, but he also said 'about to impliment' so I'm assuming he has some experience. I know, a lot to assume on such a short post, but don't jump down his throat on not having enough experience. So, it's up to us to provide basic samples and ways to impliment such an effect.

PS. Doing it with a final pass like pixel shading technique wouldn't rely on any part of the rest... or really doing it how WoW does it. It is a 'full screen glow effect that smoothes things out', it doesn't say anything about actual glow effects, like halo's or light emissive materials, it's like the layman's AA and AF! ^.^

Share this post


Link to post
Share on other sites
Quote:
Original post by Motocrossdoug
WoW uses DirectX 9 pixel shaders to do this. (it says in the tooltip for the option you need a 9 card for it I beleave)

It doesn't use DirectX shaders on all platforms -- it uses the reference to DirectX 9 as the card "class" because that's simpler than asking for the particular GL extensions. It uses OpenGL on Mac OS X, but I have no idea if it's also done as a shader there, or if it's just asking for a DX9-class card because that's what will have FBO.

Share this post


Link to post
Share on other sites
Quote:
Original post by Morpheus011
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.


It may have been a little harsh. He didn't post "LOL, I wanna make a MMORPG, can someone tell me how to order a Dell off AOL?" He was just asking about a particular effect he thought was neat.

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