View Full Version : DOF
ive implemented DOF in my game, now the standard method of picking a distance or point to fucus on + blur based on the distance to that (radial or z-related), but this doesnt work well due to the sometimes sparse nature of the world of my game (its set in space)
ive tried also just blurring based on how far from the screens center (which actually does sorta resemble human eyesight, well this + the above) this looks ok i suppose, well better than having no DOF.
any other better suggestions?
a related question, for FBO i assume its better to have a FBOcolor with a FramebufferRenderbufferEXT DEPTHBUFFER attachment, than a FBO with color + depth textures ie both FramebufferTexture2DEXT?
or is there no difference.
another question on gf6/7 whats roughly the speed difference between texture_rects + NPOT, true easy to test but i assume someones done it before
04-17-2007, 05:32 AM
on my gf7gt, npot textures do not seem to be slower than rectangular or regular ones.
04-17-2007, 06:18 AM
I am not aware of the absolute state-of-the-art DOF methods for real-time graphics. I believe that quite recently people were using multipass methods to simulate DOF, turning it into an interpolation problem (assuming the engine doesn't suffer to badly from the multipassing, which sometimes involved rendering the _whole_ scene several times). As far I know there is no kick-ass solution to DOF in real-time. However, if you look at how realistic lens systems are implemented in ray-tracing you might get some ideas of what's actually going on and how to fake that!
04-18-2007, 03:33 PM
That's a tough one. I've been thinking about this too lately, and I must say I haven't really thought of anything very satisfying. DOF adds a nice cinematic touch for cut scenes, but I imagine it would be frightfully irritating in game, if not done with subtlety and finesse.
The best (untested) thought I have is to fire off a cluster of rays around mid screen to get an "average" focal distance, then smoothly interpolate this distance over time, somewhat like adaptive luminance in HDR rendering. But as you say, for sparse scenes, one object up close, in just the wrong position, could muck the average up but good. Maybe some clever bounding, or bringing the effect in only on occasion to highlight a special occurrence of some sort?
04-21-2007, 11:34 PM
please ,how to select the part of 3ds ,and how to control the part of 3ds .for example ,select the arm of body,use mouse to drag arm.thank up!
04-22-2007, 02:22 AM
For the human eye, anything that is farther than about 10 meters is at the same infinite focus, so realistically, no DOF for a space setup :)
If it was a third person shooter, maybe a nice effect would be :
- leave in crisp focus anything that is from the player ship to infinity
- blur gradually objects passing nearer, so the player can 'feel' the very near objects.
Btw Zed, would you release a demo of your game ? It looks good and fun : http://www.zedzeek.com/
yeah im a bit slack with the game, terrible shame since the engine is basically unchanged for the last 2 years, i havent given up hope though ( + are refocusing on it ), the main problem is i find the game not very fun to play ( which is a real killer ) but that could be just me since i find no games fun to play, even mr do or galaga i have to force myself to play them. ( i did release a set of psp apps a couple of weeks ago so havent been totally sitting on my ass )
anyways WRT DOF this what i have now (just a sinple radial blur)
i tried all manners of DOF (eg like what u suggested Zbuffer) but using the depth info was a no go, due to the often changing camera focus position.
04-22-2007, 02:13 PM
Nice shot, Zed. Boom! :)
04-22-2007, 02:51 PM
yep, looks really good that.
I found your last couple of games really good looking, but pretty nasty to play. You should focus on a better control system. I'd go for the Rez lock-on system if I were you - you'd get some nice combo explosion effects. In fact, just use Rez as your template, it would look pretty fantastic in your engine.
thanks, yes thats the reason ive done something that i said i wouldnt do + turned it into a FPS ( like gears of war, where u sorta view it from the 3rd person but its in reality a FPS ) purely because its easier for the player to control.
i had a look at rez, i used to have auto targeting (which would lockonto a target) but found it to easy.
if anyone knows any other similar games i should look at to steal the ideas from, mail me at thedude (at) zedzeek.com
04-24-2007, 04:24 AM
the idea is not to make it difficult for the player to shoot something, but to put them in situations where they've got to constantly prioritise. Therefore the control system can be as easy as you want, it's the scenarios that add difficulty.
04-24-2007, 11:37 AM
Not to go too far afield with game theory, but sometimes targeting difficulty is the point, depending on the kind of experience you're after. Take IL2, for instance: lovely, realistic flight sim, but perhaps not for the weekend warrior just looking for a quick slice of Klingon blood pie 8-)
04-24-2007, 12:48 PM
For this type of game (ie. not a combat flight simulator where the whole point is mastering control), he should definitely be going down the road of Rez, Panza Dragoon Orta, Space Harrier, and Afterburner. It's prioritising clusters of enemy, routes through obstacles and the acquisition of powerups. Not getting a cross-hair lined up - that's an instant turn off for me.
The games I've listed have sold very well.
Any more advice zed, just ask. ;)
ok played a bit more, the radial DOF works quite well for my particular game ( fast action, no up direction, ie the viewpoint is constantly changing, though perhaps not so for a FPS/car/platformer etc ) so perhaps it might suit your game ( personally DOF gives far more visual impact than bloom or HDR ).
now since i dont need the depthtexture then i assume its better to revert to what i had of a main window FBO of
FramebufferRenderbuffer( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT
FramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT
aint it, ie it doesnt need to keep an extra depth texture around or have i misunderstood?
knackered - i can remember playing Space Harrier and Afterburner ( + i hated them both imensely at the time, afterburner was $1 a pop IIRC + whilst it was nice to sit down the game (and spaceharrier) relyed to much on the wow effect of the psuedo 3d graphics, needless to say it looks extremely dated now.
i did download a video of Panza Dragoon Orta now that looked nice, i see theyre casting a ray in front of the dragon + when it hits a wall etc, will put the sights on that (so u know what youre shooting), i did this approach in an old version of captain courgette, but now in space i have a similar problem as the DOF something could quickly past the line of sight ( so it focuses on that ) but then its gone + youre back to focusing on the space behind.
but anyways cheers for that ive now decided to just focus the sights X distance ahead of the player, unfortunatly this means often u wont hit whats under the sights, but a good player should account for this after a while of playing, also if youre firing 10 bullets a second the tracer like effect should tell u where theyre going. another option i tried is like gears of war (where its marketted as a FPS but in reality it shoots from the first person perspective, which is nice + easy from a development viewpoint but doesnt look as good as being able to rotate/move the player/sights around the screen)
also ive decided to raise the enemy count greatly ~1000 ( + what u said about most of my stuff not being fun is true, but i have to say last night i was playing CC + it was actually ok, still not brilliant but its definitely more enjoyable)
For the human eye, anything that is farther than about 10 meters is at the same infinite focus, so realistically, no DOF for a space setupi dont think thats right, in fact just looking outside i can see it aint (then again i have an astigmatism in my left eye, so perfect focusing aint my strong suit)
while im at it-
how to texture a sun?
im thinking of using that 4d noise shader that was linked to on these forums a while ago, or does someone have any better ideas?
04-28-2007, 12:15 AM
how to texture a sun?I think 4D noise would do very nicely.
04-28-2007, 03:09 AM
Well I just did tests, comparing 10 meter (30 feets) and a 'infinite' distant mountain, and there is only a very subtle difference in focus between the two.
10 meters in space is still a very small distance anyway.
A strong DOF makes your scene look very small, such as miniature models, etc. Have a look at this, I hope it will make my point clearer :
How does your radial DOF works ? A simple blur that fades from strong on the edges and very weak on the center, without any relation to depth ? So I it is not really a depth-of-field :p But you are right, it is quite realistic, as human vision is less detailed away from the center.
How does your radial DOF works ? A simple blur that fades from strong on the edges and very weak on the center, without any relation to depth ? So I it is not really a depth-of-field [Razz] But you are right, it is quite realistic, as human vision is less detailed away from the center.true, though the objects at the edges are gonna be slightly further away (but true its really only a radial blur)
heres some older shots of mine which do use DOF based on depth ( it works in a scene like this but unfortunately not in space )
btw heres the results of my sun using Stefan Gustavson's 4d noise shader
looks pretty bad, but i should be working on the game + not this unimportant stuff.
btw for those that use noise remember to turn off aniostropic filtering for the textures, it took me 1/2 hour trying to workout why it had slight errors.
btw its 30foot or 30feet, hell i dont even know :) , but i can tell u its not 30 feets
04-29-2007, 05:02 AM
Ok, that would be 30 feet :)
Well, the real sun is pretty dull in visible light :
The thing is, it is very powerful, so HDR bloom would be useful (for once...)
Maybe square or cube your current 4D result, to get something less uniformly distributed, and displace a bit the texcoords, like with exaggerated parallax mapping.
If you need inspiration, ultraviolet and infrared pictures of the sun are pretty nice :
yes those sexed up ultraviolet/infrared photos of the sun is what i want
Ok, that would be 30 feetunless its a boat + then itll be 30foot
anyways heres my testing of GL_TEXTURE_RECTANGLE_ARB vs NPOT as u can see theyre practically the same ( any diff is prolly noise ), btw timings are in FPS
(timings arent 100% accurate, music playing in background) but good enuf
(25 iterations btw on nvidia 7600gs)
(with texture_rect using texcoords of 1024x? thus visually the same as 0..1 for texture_2d)
GL_TEXTURE_RECTANGLE_ARB 1024x1024 36.7 GL_TEXTURE_RECTANGLE_ARB 1024x1023 36.6
GL_TEXTURE_RECTANGLE_ARB 1024x1020 36.5
GL_TEXTURE_2D 1024x1024 40.6
GL_TEXTURE_2D 1024x1023 36.4 npot
GL_TEXTURE_2D 1024x1020 36.5 npot
I'have implemented depth-of-field using the variable sized filter kernel used in ATI demos.
This algorithme is pretty cool : you can avoid color leaking by using depth comparison. Furthermore, you can really approach real lensdepth-of-field by using a lens equation. That's what I've done in my implementation in QuakeIII renderer :
Ref : http://ati.amd.com/developer/gdc/Scheuermann_DepthOfField.pdf
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.