PDA

View Full Version : How to implement glow



karx11erx
11-13-2008, 06:58 AM
Can somebody hint me to a good tutorial about that, or explain it to me?

Afaik glow is rendered by rendering glowing faces to a texture, blurring that texture, and rendering that texture into the scene. As I understand it, I somehow need to preserve each glow texture's pixel's depth value to properly render the glow texture into the scene, and I don't know how to do that - or am I wrong?

I way I could think of not requiring depth values would be to render the entire scene to the glow texture (not just the glowing faces), with non glowing faces being black, and dotting out parts of glowing faces that are behind them. Am I on the right track here?

ZbuffeR
11-13-2008, 07:24 AM
That's it.
To have correct occlusion of the glow, you have different ways, with varying performance and complexity :

- you can render only a quarter sized window of the scene for the glowing texture. then the full size scene (strong points : simple. usefull if resterisation is the bottleneck.)
- you can copy the depth texture from normal scene and reuse that during the glow rendering (strong points : usefull if scene has high polycount)
- you can take advantage of depth-only rendering in first pass, then draw glowing parts, then clear color, then draw normal scene (nice if you can benefit from this first pass, ie. with some shadowing/shading techniques)

karx11erx
11-13-2008, 07:31 AM
In response to #3: I would have to copy the scene containing only glow to some glow buffer, blurring it in the process, before clearing the color and rendering the final scene, right?

_NK47
11-13-2008, 07:32 AM
render targets are needed for this afaik. a nice sample you can find here: http://www.humus.name/index.php?page=3D&&start=48

karx11erx
11-13-2008, 07:33 AM
I know how to render to textures, I am using that already for other purposes, thanks.

ZbuffeR
11-13-2008, 07:40 AM
In response to #3: I would have to copy the scene containing only glow to some glow buffer, blurring it in the process, before clearing the color and rendering the final scene, right?
Exactly.

karx11erx
11-13-2008, 07:46 AM
And ... do you happen to have some nice blur filter around that is not coded in assembly language? :)

_NK47
11-13-2008, 07:51 AM
i got one, but gaussian blur. you probably want motion blur.
http://www.ozone3d.net/tutorials/image_filtering_p2.php

karx11erx
11-13-2008, 07:55 AM
No, that's perfect, thanks! I am not looking for motion blur.