View Full Version : Halo from environment map
04-09-2002, 12:52 AM
I've just seen an xbox driving game, don't know the title, just saw it running in a shop.
Anyway, it did something that turned my head.
The wheel trims (alloys) of the car seemed to be using a simple environment map (cube map, I think). Nothing clever about that. But, as the wheel rotated, the environment map reflection changed as normal, but when the part of the environment map representing the sun was rendered on the trim, it gave off a halo, and a flare! I mean, the reflection produced a flare...this looked absolutely brilliant.
My question: what would be the most efficient way of producing this effect?
I can think of several ways, but they all seem like they'd be slow - is there something in the xbox hardware to make this efficient?
Another thing, it seemed to be using vertex shaders to produce a really nice heat-haze over the whole image.
The game was Wreckless. Try gamespot.com for some more screenies.
AFAIK, all the halos and glows are done by rendering the scene to a texture/taking the framebuffer as a texture, subtracting a largish value to remove all but the bright stuff, then doing a few convolutions to blur everything into that star shape (_not_ a sprite, it's the result of non-uniform (term?) blurs), then adding it back to the framebuffer.
The great thing about this method is that it's very general (e.g. environment maps work perfectly) and reasonably constant time. The problem is that it eats major fillrate, and requires either a second scene render to texture or a stall while you copy and convolve the framebuffer.
The DOF/heat haze is covered on the NVidia site somewhere, although I don't know if they use the exact same method. I think they put a mip level in each texture unit and alpha blend between them, so any arbitrary blurring effects (haze) can be added on top as well as simple DOF.
Screenies: 1 (http://gamespot.com/gamespot/filters/products/screens/0,11105,475755-99,00.html) , 2 (http://gamespot.com/gamespot/filters/products/screens/0,11105,475755-98,00.html) , 3 (http://gamespot.com/gamespot/filters/products/screens/0,11105,475755-100,00.html) .
04-09-2002, 05:29 AM
Good god, those screenshots look fantastic!
It certainly didn't appear to have any frame rate problems in the shop where I saw it.
Wow, I'm blown away!
Cheers for the info.
04-09-2002, 12:35 PM
Xbox only needs to render 640x480 29.97 times per second, and has DDR memory as well as dual vertex processing pipes. You can get away with a lot under those circumstances :-)
04-09-2002, 11:31 PM
50fps or 60fps are the frequencies it has to aim for.
04-10-2002, 01:00 AM
Right, thanks to this forums search, I've found a link that explains how this flare effect is done (well, it explains how to do fast depth of field, but a neat halo effect is a side effect).
Funny, I can't remember depth of field in black & white.
04-10-2002, 03:57 AM
I started writing one from scratch last night, almost working when the small hours arrived. needs some tweaking.
The only annoying part is getting a good amount of blur occuring at high speed.
Anyone got any cool tips n tricks for fast blurring on gfx hardware?
Well, I've been thinking about something like enabling automatic mipmap generation (SGIS_generate_mipmap) and dynamically update the texture. Then using GL_ext_texture_lod_bias to choose a mipmap level. The higher the level the more blur the image will have. Has to be tested if that works and looks 'blurry'!
Originally posted by knackered:
50fps or 60fps are the frequencies it has to aim for.
Not true, e.g. Halo runs at 30fps. I'm pretty sure Wreckless runs at 30 (and occasionally lower) although I haven't got a copy around to confirm.
04-10-2002, 08:35 AM
most consolegames run at 30fps (about 30fps depends on where you live (pal/ntsc))
and why this works?
a tv screen is designed to show motion
a pc screen is designed to show static images sharp
04-10-2002, 09:18 AM
I have to say 30hz on a console, doesn't look anywhere near as nice as 60. You can tell the difference a mile off. Especially when you're used to it running at 60.
It's not the difference between the screens, it's the fact that TV images capture blur when filming, CG generated images in PC's and consoles dont, thus when they're not updating fast enough, it looks jerky. And sharp non blurred 30hz is jerky.
Trust me, I'm working on a console game in NTSC, and seeing it go from 60hz to 30, it is a big difference in visual quality, and makes a noticable jarring on your eyes.
04-10-2002, 09:28 AM
The Xbox doesn't even expose a 59.94 Hz 240 line per field mode for NTSC, nor a 50 Hz 290 line per field mode for PAL. Thus, all the games run at 29.94/25 Hz, and fill an entire progressive frame at 480 lines.
The fill rate is actually more or less the same for the two cases, but the transform rate is doubled in the interlaced case.
04-10-2002, 10:43 AM
30fps looks bad in my apps - maybe not as bad on a tv (probably because of the phosphor latency, mention by Nutty).
I don't know much about console/tv things, but why do dreamcast games give you the option of selecting between 50hz and 60hz when they boot up? They run super smooth in general.
I love my dreamcast... http://www.opengl.org/discussion_boards/ubb/wink.gif
04-10-2002, 10:45 AM
BTW, have any of you an opinion on those Wreckless screenshots?
Having seen it in motion, I really think it's worth the fill-rate hit.
04-10-2002, 01:03 PM
The reason you get offered 50 or 60, is because most games are written for NTSC 1st, so all their physics are hard-coded to run at 60hz. This is because, alot of console games are designed to run at a fixed speed, so the code isn't always time adjusted. Plus not time adjusting all moving things, means less floating point maths involved.
Anyway, the game is written as it's supposed to be played at 60hz, then they do a PAL version, and slow it down to 50. But they dont re-write all the movement values, so the whole game effectively runs 16% slower. As alot of PAL TV's now support 60hz, they offer it as an option to play the game at the intended speed.
This causes quite a bit of anger with alot of ppl. In future all movement code will probably be time adjusted, as more and more console games are moving away from fixed update speed, and more like PC variable frame-rate.
P.S. About this post-process scene glare. I've knocked up a quick demo. It's not fancy, and it's not particularly efficient yet, but it kinda works.
There are 2 controls. O and P increase and decrease the intensity at which the upper-intensity-range image (The scene image, after a value has been subtracted from it) is rendered at, during the blur phase, and N and M increase or decrease the number of passes done in the blur loop.
Uses cubemapping, and glCopyTexSubImage2D, and only 1 texture unit, so it should run on a fair variety of things. To make the texture updating even simpler, I'm using a 512x512 window too.
Download it here; http://www.nutty.org/OpenGL/Test/glare.zip
I'll add some onscreen indicators of the twiddle values soon.
P.S. When I get it nice, I'll upload the source code too.
[This message has been edited by Nutty (edited 04-10-2002).]
04-10-2002, 01:17 PM
That's a pretty nice little demo, Nutty.
One thing, how are you subtracting? Are you doing it in software? I say this because there seems to be a lot of stippling in there.
You could use the blend equation extension to subtract (blend subtract a screen sized quad), but this is only supported on geforce1 upwards...and probably a few other high end cards.
04-10-2002, 01:22 PM
I am using the blend equation to subtract.
The stippling effect is a side effect of the blur.
Each blur pass, renders it addatively, in 4 positions.
X +and- Offset, Y
X, Y +and- Offset.
Offset was 2 pixels, so it creates a kind of star shape around each texel. Reducing offset to 1, removes this, but then requires twice as many blur passes.
There is an nvidia doc which shows how to sample all 8 texel neighbours, I'll try and stick that in, to see if it makes it better.
04-10-2002, 01:28 PM
hello... congratulations for all!!!
04-10-2002, 04:33 PM
Hey Nutty, I got an error on your demo:
"Error getting blend eq func"
I think I'm using the win2k 6043 drivers.
04-10-2002, 10:53 PM
The radeon8500 *must* have the blend subtract equation! Surely?
Nutty, sorry for misunderstanding the stippling effect - I understand now.
04-10-2002, 11:26 PM
Surely it depends if quake3 uses blend subtract =)
04-11-2002, 05:13 AM
The latest 8500 drivers do have GL_EXT_blend_subtract in the extension string. But that might not be saying much.
04-11-2002, 06:31 AM
Me too, got that error message. However, it's on an year-old 8MB S3-card, so that's not so strange. However, I think it suggests that there's something else going on here...
04-11-2002, 06:48 AM
I havent tested it, but i think this could emulate blend_subtract:
draw data with Blend(1, 1)
draw inverted data with Blend(1, 1)
where InvertFB = draw white quad with Blend(1-DST_COLOR, 0)
04-11-2002, 08:07 AM
The code was extremly quick n dirty, cut n pasted from another app. I'll make sure it's initializing that extension properly tonight.. Though I'm pretty sure it is.
04-11-2002, 08:57 AM
I can't run your demo Nutty.
It only draws blank window and then it freeze.
04-11-2002, 09:33 AM
What drivers are you using? It should run fine on GF2.
04-11-2002, 09:36 AM
Have you not got a support hotline, Nutty? http://www.opengl.org/discussion_boards/ubb/smile.gif
04-11-2002, 09:42 AM
all other GL apps run fine.
04-11-2002, 10:01 AM
Are you sure you extracted it okay.. sounds like it's not loading the model file or something.. and no I aint checking for that..
daveperman says it runs on his gf2mx, so you must be doing something wrong.
That'll be 50 pence please! http://www.opengl.org/discussion_boards/ubb/smile.gif
P.S. Wait for the next version it will have better error checking in.
[This message has been edited by Nutty (edited 04-11-2002).]
04-11-2002, 10:57 AM
Lucky, just write yourself a little test app that shows the effect - it's not that complicated - read the document I linked to.
I've just finished writing one myself, similar to Nutty's, but I've no web space to upload it to at the moment - sorry.
Nutty's a busy person... give him a break http://www.opengl.org/discussion_boards/ubb/wink.gif
I've tried his (and my) app on 2 computers so far:-
Windows2000 + Dual PIII 733mhz with geforce2gts
WindowsXP + Athlon1.3ghz + geforce3ti500
It works fine on both systems.
04-11-2002, 11:24 AM
For anyone messing around with this, here's an idea:
Just do this effect on specular and ambient terms of your shading model, and then average the effect over previous frames.
04-11-2002, 11:27 AM
I'll try it.
04-11-2002, 11:33 AM
If you average it over previous frames you'll get blur when the camera moves - I don't like that effect, it's pretty unnatural, unless you're watching a drug sequence in Easy Rider, or something. http://www.opengl.org/discussion_boards/ubb/smile.gif
I like the idea of just rendering the specular term, though - but that adds a pass to the render.
04-11-2002, 11:48 AM
I saw on an TV advert for Project Gotham racing that the cars headlights left a halo-trail, as they flew past. So to avoid the stoned effect you'd turn that effect on/off per surface.
Or you could just put a slow LCD screen as a system requirement for your game...
04-11-2002, 12:07 PM
does not need additional pass for specular only.
calculate your color. add your specular. if it is bigger than one, take the part bigger than one and store it in the screenalpha. (yes its not rgb anymore)
use this rgba-texture for the blurring. the alpha tells how visible the stuff is, and the color wich stuff. that way you should get it working quite easy.
04-11-2002, 12:44 PM
nutty. its permEn, not permAn..
at least you should know my name (but i learned that you don't today http://www.opengl.org/discussion_boards/ubb/wink.gif)
04-11-2002, 12:50 PM
Has anyone got/found any demos for the the GDC presentation on light scattering in realtime? ( http://www.ati.com/developer/gdc/GDC02_HoffmanPreetham.pdf )
04-11-2002, 11:28 PM
Yeah about the previous frame thing. I was gonna say that yesterday, cos I thought of it after I did that quick demo. I thought it would be pretty cool to have a glow trail on fast moving lights.
About the "Just do it on specular terms". This is a fullscene process, it's not possible to distinguish the difference beteen whats specular, and whats just bright. Although I am adding in controls to adjust the brightness to recieve glow tolerance. Crancking this right up, would reduce the glow to only very bright stuff.
Currently that demo had no-lighting in what-so-ever, so thats why it did it all over the shop. Adding some diffuse and specular in would make it alot nicer.
I wish dave would hurry up and tell us how to do brightness greater than 1, instead of just telling me to use it all the time. Please discuss how you do this in this thread. Ta.
P.S. B4 you flame me, I just realised you can do this on just specular and ambient only. Might actually work out faster, with no textures n stuff.
But, the game in question did it on bright parts of environment maps, if I understood correctly, and I was trying to simulate that.
There are many different things you could tweak, and change, and fiddle with, and get a whole host of different effects.
[This message has been edited by Nutty (edited 04-12-2002).]
04-12-2002, 12:26 AM
nutty.. if you would have asked yesterday i would have explained it, just dont run away http://www.opengl.org/discussion_boards/ubb/smile.gif
well its easy.. simply calculate your color in the texenv or rc's or fragmentshaders, subtract one, calculate the brightness of this (a dp3) and draw this into the alpha-part of the screen.
the subtract one can be done with the help of signed_add.. at least the registercombiners wich have range -1,1 work. and the fragmentshaders with range from -8,8 are no problem eighter..
then use this alphavalue for knowing how visible the glow there is and then do the fast blurring with help of the link i sent to you ( http://www.ati.com/developer/sdk/RadeonSDK/Html/Samples/Direct3D/RadeonLightGlare.html ) wich yields to much faster big blurring (wreckless blurres quite big but not that bright except bright highlights..)
or you simply draw into the alphabuffer 1 if it this pixel should glow and 0 else (per texel on a map or per object or whatever..) as long as you generate the envmap yourself in realtime the alpha will be there, too.. as on the reflected water..
and yes its a postrendering effect that logical
[This message has been edited by davepermen (edited 04-15-2002).]
[This message has been edited by davepermen (edited 04-15-2002).]
[This message has been edited by davepermen (edited 04-15-2002).]
04-12-2002, 03:52 AM
I didn't run anywhere, I had things to do, other than argue over M$'s inconsistent windows API.
Anyway, thats enuff of that. I'll post a new demo Sunday, which will maybe have that feature in, as well as a host of different blur tricks, and UI to all the values.
04-12-2002, 04:33 AM
Arguing is my job - you don't want trouble with the unions http://www.opengl.org/discussion_boards/ubb/smile.gif
04-14-2002, 10:53 PM
Sunday is a distant memory now, Nutty....where's your program! http://www.opengl.org/discussion_boards/ubb/smile.gif
04-14-2002, 11:18 PM
hehe.. sorry I was busy watching the grand-prix, and washing my car, and cleaning the kitchen. It will be sometime this week. http://www.opengl.org/discussion_boards/ubb/smile.gif
04-14-2002, 11:25 PM
A traditional Sunday, as god intended. http://www.opengl.org/discussion_boards/ubb/smile.gif
04-17-2002, 01:56 PM
Finally got some nice big and fast blur running now. Take a look at these OTT screenies..
http://www.nutty.org/ScreenShots/cool1.jpg http://www.nutty.org/ScreenShots/cool2.jpg http://www.nutty.org/ScreenShots/cool3.jpg http://www.nutty.org/ScreenShots/cool4.jpg http://www.nutty.org/ScreenShots/cool5.jpg
Over 100fps, and I aint started optimizing yet.. http://www.opengl.org/discussion_boards/ubb/smile.gif
Next I'm gonna add lighting, and try Daves greater than 1.0 intensity light glare.
04-17-2002, 10:49 PM
Lookin' good Nutty!
Any reason why you're not posting an exe ?
Don't worry about compatibility problems, just post it! http://www.opengl.org/discussion_boards/ubb/wink.gif
04-17-2002, 11:20 PM
All in good time.. http://www.opengl.org/discussion_boards/ubb/smile.gif Probably late friday night, so I can add some more features.
Originally posted by Nutty:
Probably late friday night
How can you do anything after a looooooooong pub session ??? http://www.opengl.org/discussion_boards/ubb/wink.gif
04-18-2002, 09:50 PM
just have to say it now looks quite cool, but its not yet finished.. hope he get it this evening
04-19-2002, 11:41 PM
I find some of my best coding stints are when i'm drunk...
04-20-2002, 06:54 AM
Demo on my site, if anyones interested.. I'd appreciate some feedback on frame-rates on various hardware. Be sure to let me know how many mip-level's you're using at the time.
P.S. There's still alot of optimizations to be done in there too.
04-20-2002, 07:27 AM
Wow! Wow! Wow!
That's it! That's the wreckless effect!
Fantastic looking demo, Nutty.
Post that as an image of the day on flipcode...
04-20-2002, 07:29 AM
You can do it for me if you want, cos I'm not a member there or anything.. http://www.opengl.org/discussion_boards/ubb/smile.gif
Glad you like it..
04-20-2002, 08:15 AM
Err, no - it'd be best if you did it http://www.opengl.org/discussion_boards/ubb/smile.gif Don't like the idea of sharing credit for something I didn't do.
Forgot to give you some stats:-
My set up: athlon 1.2ghz, geforce3 ti500
default settings: 92fps
mipmap level 6: 102fps
Once again, fine demo. Good to see something dramatic for a change.
04-20-2002, 09:19 AM
i just want to state that i'm currently playing wreckless, and it has even more funny features.. you can enable filters wich affect the image afterwards, to get all those nice effects like night-vision, or edge-filters etc.. there are some great looking ones, looks like movies.. its damn cool game somehow..
great job with the demo btw.. so far so cool.. let it be more than just a spaceship now (skybox with glowing sun etc) and then put it on flipcode, yes..
04-20-2002, 09:41 AM
Nutty, it might be a nice gesture if you give Alex Evans a credit in your source code, or didn't you read that article I linked to?
04-20-2002, 12:44 PM
I didn't read it. That link just prompted a username and password for me. The only help was Dave, and the technique about using mip-levels in blurs from ATI developer page, that Dave found. I didn't bother looking at the source tho. Credits to Dave and ATI are in the source..
I have some wondering about using destination alpha, and alpha-test to help cut down fill-rate.. I'm gonna post another version soon with more complex features, more optimizations, and some different blur styles.
04-20-2002, 01:42 PM
Ok. I haven't read the ATI doc. I can only assume that someone at ATI read it, because that is exactly what the gamasutra article suggests doing, dated feb 2001 - and it's what I have done. I'm not getting all uptight about IP - I'm happy you've given ATI credit.
I think I'm a little drunk - watching Peter Kay on telly... http://www.opengl.org/discussion_boards/ubb/smile.gif
04-20-2002, 01:52 PM
Peter Kay rools.. His holiday sketches are top..
"Whats weather like there!?"
"It's spittin'!" http://www.opengl.org/discussion_boards/ubb/smile.gif
04-21-2002, 02:02 AM
He does indeed. Why do mums buy crap pop? http://www.opengl.org/discussion_boards/ubb/smile.gif
very nice piece of code.
winXP, duron 800, geforce2mx
mipmaplevel <= 4, up to 42 fps
mipmaplevel > 4, mostly 28 fps
04-23-2002, 06:22 AM
cool demo, nice effect.
WinXP, Asus 28.80 drivers,
gf2GTS, Athlon 1.2Ghz
Mip Levels 8 = ~50fps
Mip Levels 4 = ~70fps
04-24-2002, 04:25 AM
It's really cool.
GF2MX400, celeron 366, W98, detonator 28.32
fps: MIN MAX
mip levels<=5 50 70
mip levels>5 40 50
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.