prince of persia glow

Blitz3D Forums/Blitz3D Programming/prince of persia glow

Akat(Posted 2004) [#1]
im trying to do glow effect like u can see in prince of persia (anyone had any idea?)


Tracer(Posted 2004) [#2]
They probably did something with shaders for that.. but something similar should be possible.

Which glow effect are you talking about anyway? there's quite a few in Sands of Time.

Tracer


CyBeRGoth(Posted 2004) [#3]
The effect is called 'bloom'


Afrohorse(Posted 2004) [#4]
I believe what they are doing is taking the framebuffer (either from the previous frame, or the current) scaling it down to a lower resolution texture and applying a contrast filter to it - Then overlaying it back over the screen. They also increase the feedback and dampen down the contrast when the camera moves quicky it seems, to give a motion blur effect - it's all very nice :)

I've seen the effect on the PS2 version, so it can be done without a pixel shader however, although on the PS2 it is possible to apply a contrast filter when you copy back from the backbuffer (which you can't really do on PC). Also, the PS2 has alot of fill-rate, so the fullscreen overlays aren't a problem.

It's a really nice effect and can be emulated in blitz, but it means copying back from the frame buffer so its going to be slow. I did a mock up of the effect not so long back in blitz, it looked nice but it was just too slow (it really needs RenderToTexture to avoid the copy back) :(


(tu) sinu(Posted 2004) [#5]

I've seen the effect on the PS2 version, so it can be done without a pixel shader however



ps2 has pixel shader, well i thought they had some form of them.


Afrohorse(Posted 2004) [#6]
Maybe you're thinking of vertex shaders...?

The PS2 can do vertex processing, anything that a vertex shader can do, it has two Vector units that you can use for that. It can't really do per-pixel shader calculations, like a PC can - shame really...


Flexman(Posted 2004) [#7]
ATI and Nvidia both have papers on these effects. You're talking about "seperable gaussian blur". Render ambient parts to a texture, blur it, *add* it back to the scene. Prince of Persia seems to have ambient everything so the whole scene has a glow.

You can do it with shaders, but it's not required.


jfk EO-11110(Posted 2004) [#8]
resizing the backbuffer to a small texture might be a very fast method to blur it, no? One could have a 64*64 Texture with flag 256, then use cameraviewport to render a 64*64 Pixels scene, then edit the contrast with readpixelfast and finally stretch it alphaed and with flag 2 across the screen.


Jim Teeuwen(Posted 2004) [#9]
the read/writepixelfast part will be the big timeconsumer here I think. Might be better of letting some tight assembly code handle that from a dll.. although I think the blitz routines are allready pretty much optimized to death


Afrohorse(Posted 2004) [#10]
Looks like this effect has a lot of weird names; 'glow', 'bloom', 'High dynamic range', 'seperable gaussian blur' - but no matter what you call it, it involves rendering to a texture and a full-screen blended sprite, so a real no-no for low end cards.

jfk - I did try using a 64x64 texture for this, but the filtering on the full-screen overlay sprite just wasn't enough to smooth out the pixels on a texture and having a contrast filter just makes the edges more noticable. Maybe adding a blur filter might do it, damn costly tho! The blur filter would have to read texels, so the texture would have to be copied back the AGP bus the slow direction - then edited in system memory - then copied back up to the card :(

Hmmm, using flag 256 on the texture - would that be faster or slower if you edit the pixels every frame in system memory? I guess when you lock it, it would get copied from vram anyway, so it might not make much difference - just wondering... ;)


sswift(Posted 2004) [#11]
Look in the general forum for a thread on "HDR" images. There's a function someone is working on that does this exact effect and it will be reelased soon, using a blurring function I wrote which uses hardware blending so it's very fast.


jfk EO-11110(Posted 2004) [#12]
Or maybe you should use two sprites or quads, one with a half a texel offset. The texture would be the same, so no loss there. (Or maybe 4 or even 8 Quads)


Zenith(Posted 2004) [#13]
Maybe people should stop worrying about people with low end machines, that way they have to catch up with the rest of us. :)