Rant and depth-of-field

Published August 28, 2007
Advertisement
Rant

Time for a small rant. On various topics. I'll keep it short to not bore people to death. Some things are somewhat irritating:

1) People who want to test the ICP, have a crash, and post or send me e-mails / PMs saying "it does not work, can you help ?". No, I cannot help. At least, not if you don't explain what the problem is. What are your system specs ? Do you have the latest drivers ? Did you use the search function to see if your problem has been answered ? What happens exactly, can you login, is it crashing, is it freezing, or what ? Sorry, I don't have telepathy skills, I cannot read your mind. The point is: if you're going to ask for help, be precise! I don't have time to waste to extract the useful information for you point by point.

2) People who don't read the dev journals. Seriously, I'm sometimes spending an hour or two writing those journals. Nothing is irritating me more than people who criticize something when that thing was described and explained in the journal a few posts up. Things such as "omg vertex popping".. "omg it all looks the same, boring texture" when I explicitely said that geo-morphing isn't implemented yet, and that the terrain uses only big tiled textures.. wow.

I certainly have no problems with people commenting and criticizing the features that are shown in the video, but please, don't criticize or comment on things that are not done yet.

And please.. read the dev journal before flooding the thread with tons of questions.

By the way, this section is dedicated to SinKing from moddb.com who said the motion blur didn't look good and was unrealistic, thinking he was looking at depth-of-field. Hi :)

Depth-of-field

To be clear, motion blur is the act of bluring pixels in the direction of the motion. Play a DVD, put it on pause, and look at the image of your TV ( especially when the camera or something is fast moving ). That is motion blur.

Depth-of-field is another kind of blur, but this time based on a focal distance. It's the effect you see in movies when the focus is on an object in the middle of the scene: what is close to the camera is blurred, and what is far too.

Keep in mind that I'm exagerating the effects a bit, mostly to debug.

My implementation of depth-of-field is based on a pretty standard technique: the scene is rendered to a texture ( like many effects ); the scene is also rendered to a depth buffer. In a post-processing pass, those two textures are read back: the depth is sampled, compared with the focal plane distance, and the further the pixel is from this plane, the more blurry the scene pixel becomes.

The quality of the blur isn't very good ( by my standards ), as it does not use a separable gaussian yet. It's your basic blur taking N samples in a circular kernel around the center pixel, and averaged together. The size of the kernel is depending on the absolute distance to the focal plane ( and some magic formulas to "feel" good ).

One important thing is also missing: the focal plane distance is currently a constant, that I can change with 2 keys; in the future, I will have to cast some rays in the scene to determine the focus area near the center of the camera. Nothing too advanced technically, I'm not worried.

Pictures














0 likes 16 comments

Comments

Gaheris
Yeah, I stumbled upon the posts from SinKing and was like "WTF is he talking about". Some people really shouldn't comment about things they don't even slightly understand.
August 28, 2007 03:12 PM
Ravuya
Dude, you didn't solve the Halting Problem. Why isn't the Halting Problem solved?</betatester>

More seriously, it outstrips my game even if it isn't finished! [crying] I wish I could justify taking as much time as you have to make a gorgeous engine. I can't believe you've managed to keep it current for so long with so many advancements in graphics technology.
August 28, 2007 03:16 PM
dgreen02
I'm about to do a second pass on my DOF / Motion blur stuff...these last few entries are pretty inspiring.

I read you do 32 samples in your motion blur pixel shader? Jeeeze, I found a nice sweet-spot around 12 samples along the velocity of the scene...think of the people without 8800s lol. Or is that going to be minimum spec? heh.

Looks great though. Very tastefully done effects, not too overwhelming.

- Dan
August 28, 2007 04:10 PM
MARS_999
Hey Y, are you rich? or just a genius! :D Because I know you have some serious time invested in this game. Thank God someone still is making PC games! Keep it up. BTW how is the new PC working for you? Did you go Vista 64bit yet?
August 28, 2007 05:46 PM
Vileedge
Paging the Wizard of Oz, paging the Wizard of Oz . . . . what is the Emerald City doing in image seven?

Or more correctly, what is that green thing? All Green Lantern jokes aside . . .
August 28, 2007 10:30 PM
Ysaneya
Quote:Original post by dgreen02
I read you do 32 samples in your motion blur pixel shader? Jeeeze, I found a nice sweet-spot around 12 samples along the velocity of the scene...think of the people without 8800s lol. Or is that going to be minimum spec? heh.


Oh, I'm not worried. 32 samples is a variable that can be changed in one line, so it'll be adjusted for people with slower video cards.

Besides, if the game is getting released in another 2 years, 32 samples will be peanuts. Remember that it is post-processing, it's only run once per pixel of the screen (no overdraw). Even 32 samples is not that slow, my "old" Geforce 7800 has no problem with it :)
August 29, 2007 03:31 AM
Ysaneya
Quote:Original post by MARS_999
Hey Y, are you rich? or just a genius! :D Because I know you have some serious time invested in this game. Thank God someone still is making PC games! Keep it up. BTW how is the new PC working for you? Did you go Vista 64bit yet?


Unfortunately, I'm not rich at all (wished I was). The new PC is running well, but half of my cores are screaming "use me! use me!". Even making use of dual cores at full efficiency is hard. I use Vista 32 bits, 2 GB of ram is enough for my work, no point in going 64 bits (yet).
August 29, 2007 03:35 AM
Ysaneya
Quote:Original post by Vileedge
Paging the Wizard of Oz, paging the Wizard of Oz . . . . what is the Emerald City doing in image seven?

Or more correctly, what is that green thing? All Green Lantern jokes aside . . .


Untextured, unlit spaceport.
August 29, 2007 03:35 AM
DJMurtz
Well, I've been reading your journals for a year now and I figured it was time I registered myself to post comments on any new posts.

First of all, this game is just amazing, the details you work on are unseen in any other game and you really invest a lot of time in every single part of the game.

I have a question about the Depth-of-field you described in this post. I don't know if you've ever played Call of Juarez but it also uses a Depth-of-field technique. Now, I'm no technical dude but I love to read your technical articles and I was just wondering:

In Call of Juarez, the Depth-of-field decides which object to focus on by checking where the mousepointer is pointed at. This means that when I am hiding behind grass for example and the grass moves it changes the focus all the time because the grass goes in and out of my mousepointer range. The focus change is sudden and no smooth transition is applied.

How are you going to solve this in your game? Will it have a smooth transition, and will you have to stay focused on something for several seconds to get focus? I'd be interested to know, because the Call of Juarez technique is nice, but certainly not perfect.
August 29, 2007 04:06 AM
venzon
Quote:Original post by Ysaneya
Untextured, unlit spaceport.


Cool, I didn't realize you already had your engine set up to plop in 3D models in your terrain. How are you handling the problem of finding a flat, appropriate spot to put the spaceport? Or are you enforcing flat terrain around the spaceport?
August 29, 2007 08:47 AM
Ysaneya
Quote:Original post by DJMurtz
How are you going to solve this in your game? Will it have a smooth transition, and will you have to stay focused on something for several seconds to get focus? I'd be interested to know, because the Call of Juarez technique is nice, but certainly not perfect.


By casting not one but many rays in the scene, and analyzing the depth of those rays (plus some magical tricks) to know the focus distance.

I think I'll probably also use a "smart depth-of-field" function that only applies depth-of-field in specific gameplay situations. In other words, not in combat, as the last thing you want is to see are blurred opponents / details.
August 29, 2007 09:08 AM
Ysaneya
Quote:Original post by venzon
Quote:Original post by Ysaneya
Untextured, unlit spaceport.


Cool, I didn't realize you already had your engine set up to plop in 3D models in your terrain. How are you handling the problem of finding a flat, appropriate spot to put the spaceport? Or are you enforcing flat terrain around the spaceport?


Nothing very original: evaluating the height function randomly on the planet, and around the chosen spot, evaluate a few hundred of times the height function again to find if the altitude or the slope are within set parameters.
August 30, 2007 04:59 PM
Tape_Worm
Quote:Original post by Ysaneya
Rant
I certainly have no problems with people commenting and criticizing the features that are shown in the video, but please, don't criticize or comment on things that are not done yet.


This one is easy: They can't find anything else to complain about :) And they are jealous. Like me: *ahem* It doesn't work on my Tandy/PCjr in 16 color mode??? WHY NOT!??

But seriously, once again you've amazed the crap out of me. Just makes me want to give up. [grin]
August 30, 2007 08:16 PM
Lutz
Why does motion blur only apply to the parts of the terrain that are further away?

No, seriously, excellent work so far, but one thing: With DOF, terrain looks unrealistic IMO - like it is in a 2x2 meter sandbox. It reminds me of old movie tricks with models that looked unrealistic since they had too much depth of field.

I haven't worked out the maths, but I guess when you focus something that is 1 km away, the stuff in 10 km does not have any visible DOF effect in reality, since the ratio of focal length to distance to the object is so small. That's different when objects are smaller and closer.

September 10, 2007 12:32 AM
Vileedge
About update time again, isn't it Ysaneya? Eh, eh?
September 10, 2007 12:11 PM
dgreen02
Quote:Original post by Ysaneya
Quote:Original post by dgreen02
I read you do 32 samples in your motion blur pixel shader? Jeeeze, I found a nice sweet-spot around 12 samples along the velocity of the scene...think of the people without 8800s lol. Or is that going to be minimum spec? heh.


Oh, I'm not worried. 32 samples is a variable that can be changed in one line, so it'll be adjusted for people with slower video cards.

Besides, if the game is getting released in another 2 years, 32 samples will be peanuts. Remember that it is post-processing, it's only run once per pixel of the screen (no overdraw). Even 32 samples is not that slow, my "old" Geforce 7800 has no problem with it :)


Yea but combine 32 samples x 4 different post processing effects...if you want a star + bloom + motion blur + DOF...I dunno, I try to use samples very sparingly in post processing effects [ie: find the lowest number that looks "alright"].

Though as you said, it is very easily scalable, and your release date is far away.

Keep up the good work man.

- Dan
September 20, 2007 01:17 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement