|
2 registered members (TipmyPip, izorro),
556
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Ha I finally have achieved DOF, without pro!
[Re: lostclimate]
#93902
10/11/06 19:36
10/11/06 19:36
|
Joined: May 2002
Posts: 2,541 Berlin
EX Citer
Expert
|
Expert
Joined: May 2002
Posts: 2,541
Berlin
|
Thatīs not correct. A depth blur has always a focus. The way you say it lostclimate the focus is always the camera, but that is wrong. I am making photos, and the blur goes around a spot called the focus. You cann adjust the position of that spot, by zooming in and out and adjust the range of the blur by changing the blend(?). Not only things more far aways get blurred more, also objects closer to the camera/eye as the focus get blurred more and more.
And thatīs the weak spot of the fur shader. The closer it gets to the camera the slower the fur shader is, but the more you have to blur. Thatīs a big problem. The other problem you get is you canīt blur the inline of the model. That means close objects outline will get only to the outside blurred. The inside wonīt get partially transparent.
:L
|
|
|
Re: Ha I finally have achieved DOF, without pro!
[Re: EX Citer]
#93905
10/11/06 22:07
10/11/06 22:07
|
Joined: Sep 2002
Posts: 8,177 Netherlands
PHeMoX
Senior Expert
|
Senior Expert
Joined: Sep 2002
Posts: 8,177
Netherlands
|
Quote:
What do you mean by fixed? Nothing is fixed. I am not sure if you understand how it works. I can focus what I want, and blur far/less far as I want.
Try your code near two wall sections, one wall up close and one wall further away and a couple of entities in between those walls. Like a hallway kinda thing with two obstacles, except it's outside. (Usually DoF isn't used inside buildings as you definately know.) Now, you will see everything sharper in the focus area (eventhough you can change it and it's stufenlos), however the two walls will look equally blurred eventhough the distance of both are quite different. This is not what happens with DoF, infact if you look at Half-life 2 then you'll see the blur technique is different too, like said by mk1, it's a scale blur, based on depth distance. Very very hard to fake, if not impossible without depth buffer.
Anyways, you did make me curious, would it be possible to make a little movie showing your progress on this till now?
Perhaps indeed your effect works better in real-time than what I've seen on the screenshots. You did a pretty good job on the blur effect, but theoretically it's simply not possible to fake DoF correctly. Off course theory and practise are not always what they seem to be. 
Quote:
You can do that with render to texture + depth map.
Yes, except that this would only work for scenes in which the camera doesn't move, right? Unless you know a very clever method on how to make this depth map 'realtime', which is where the depth buffer comes into play .. I'm no pro, so I'll be gladly proven wrong in all this, but I think you'll agree.
Edit: Btw, we can do this effect in 2D though ... as a post-processing effect, that's where the fixed or almost fixed focus doesn't matter that much .. If you're a real die hard you could go mad on making depth maps for the entire 2D level .. 
Edit: This is the result of some of my tests ... perhaps it's not so impossible .. I'll give a direct link because of the very big image otherwise on this forum;
Screenshot 1 Slipstream fighter project Slipstream fighter project test 2
Cheers
Last edited by PHeMoX; 10/11/06 22:32.
|
|
|
Re: Ha I finally have achieved DOF, without pro!
[Re: PHeMoX]
#93906
10/11/06 22:28
10/11/06 22:28
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
This is absolutely not necessary. You just have to access the Z-Buffer information, where ever they are. The Z-Buffer information is of course updated every frame. No need to calculate anything.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Ha I finally have achieved DOF, without pro!
[Re: Uhrwerk]
#93907
10/11/06 22:30
10/11/06 22:30
|
Joined: Sep 2002
Posts: 8,177 Netherlands
PHeMoX
Senior Expert
|
Senior Expert
Joined: Sep 2002
Posts: 8,177
Netherlands
|
Quote:
This is absolutely not necessary. You just have to access the Z-Buffer information, where ever they are. The Z-Buffer information is of course updated every frame. No need to calculate anything.
Yes, but we don't have access to it, that's the problem, unless, like you've asked elsewhere, it's possible to get the depth buffer info through a dll ...
Cheers
|
|
|
Re: Ha I finally have achieved DOF, without pro!
[Re: PHeMoX]
#93908
10/12/06 00:35
10/12/06 00:35
|
Joined: Oct 2003
Posts: 4,131
Matt_Aufderheide
Expert
|
Expert
Joined: Oct 2003
Posts: 4,131
|
No, no, you cant get access to the Z-buffer directly... you have to render every object using a shader that outputs the depth..for DOF you really dont want the complete depth range anyway.. here is a basic procedure I think would work:
1) For every object, use a vertex shader that outputs distance(vertexpos, viewpos)-focus_dist, and 1-(distance(vertexpos, viewpos)+focus_dist)
then scale this value by some number like 0.001.. and multiply them together in the pixel shader. This give you your DOF map.
Now in your final effect, you want a copy of your framebuffer to which you apply a gausian blur. You can either: blur the whole thing and use the depth map to as an inverse alpha map... or actually use the depth map to determine how many gaussian samples you do.. this might be faster if you use PS 3.0 .. however this assumes you use a full size blur map.. i think just using the depth map as an alpha on a reduced blur map is best.
I havent tried this, so it may need some work, but I think the general idea is valid. This could all be done in Pro, albeit probably non-optimally. I would reccomend a dll implementation.. may i will work on this at some point.
Last edited by Matt_Aufderheide; 10/12/06 00:52.
|
|
|
Re: Ha I finally have achieved DOF, without pro!
[Re: Matt_Aufderheide]
#93909
10/12/06 05:36
10/12/06 05:36
|
Joined: Oct 2005
Posts: 4,771 Bay City, MI
lostclimate
OP
Expert
|
OP
Expert
Joined: Oct 2005
Posts: 4,771
Bay City, MI
|
here is what i hear everyone saying tho..... its slow, or if you have pro and we had access to the z-buffer well -its slow: actully it ran pretty good on my fx 5200 and thats saying something, yes i realise that its not a complex scene, but then again... fx 5200.... i get like 5fps with sphere  also what is your alternative without pro or a dll??? nothing... or at least yet... thats like saying i want mirrored surfaces, but i dont have pro and dont want shaders or a plugin, cuz its slower and uses something not all users have... well.... you dont always get what you want. -You'd need pro, and access to the z-buffer: well ill answer this in two parts since its kinda a 2-part statement. first off, its meant for comm. users, as for the latter.... you dont have access to it, there is no point talking about it, and if you do, talk about it in a thread in "The Future" or "Ask Conitec" forums.
|
|
|
Re: Ha I finally have achieved DOF, without pro!
[Re: lostclimate]
#93910
10/12/06 06:08
10/12/06 06:08
|
Joined: Oct 2003
Posts: 4,131
Matt_Aufderheide
Expert
|
Expert
Joined: Oct 2003
Posts: 4,131
|
OK heres the deal.. it will be very slow when you have it applied to everything in a real application.. get some terrain or whatever.. basically make a real level, and you will see .. the reason is becasue of all the overdraw.
Really.. you are actually rendering every object like 15 times or whatever using that shader.. this is not a good idea. And DOF needs to be applied to every object, not just a few models.. like sky, grass, walls, whatever.
Some effects arent worth doing unless they can be done right..
Last edited by Matt_Aufderheide; 10/12/06 06:11.
|
|
|
|