Pictures: 



!THOSE PICTURES ARE FROM AN EARLIEST VERSION!Description:An advanced adaptative Depth of Field effect. It calculate the near & far distance by tracing from the player eyes position to forward at 2048 units maximum.
Technical: (EDITED)
This effect is made by combining coding & shaders. in order, i inject my code in the singleview() thread (i work on the DentonmodV2 sdk), i apply a globalmaterial on a new renderscene (hackedView2), this material reference to a VFP that write the fragment depth as a black(0) to white(1) value. the shader inverse the 0 to 0.5 range into 1 to 0.5.
Then i substract 1.0, add the trace value (0 to 1), and mutliply by 2, so everything further & nearer than the trace colision is white to black like this:

Then i capture the screen to _depthOfField, then use it with _renderView to calculate the bluriness. I also have some functions going on to remove unwanted models from my hackedView2.
Issues:Yes, there is always downsides. here the main one is that the depth is not fragment/pixel calculated, cause i never succeed to capture _renderView fragment depth (is it even possible?!?), but it's a surface depth calculated.
That's mean that there is no transparency. i removed all particles in my special renderview aswell as unwanted models and smoke particle to limit the bug. then every glasses stop the depth visibility too. i didn't find any workaround for that one.
I'm really proud of it, but i had modified so much things in the code for this and other things (for personnal project/tests) that i cannot give the code without heavily restore things, or copy the code to a new & fresh SDK.
That's why i give the general idea about setting it rather than a code, but i'll give it when i'll release my project. (not really near) & i'm actually working on a dynamic directionnal motion blur.
Hope you like what you see.
EDIT: 12 April 2009.A quick note about a futur release of a pack i'm working on. (followed by a clean code release)



!PICTURES FROM THE ACTUAL VERSION!This pack will contain some VFPs, materials and an updated DentonModV2 DLL that will bring to DoomIII new improvements like an Adaptative Depth of Field (DoF), a Motion Blur (based on mouse+key moves, but also on animated things on screen), and finally, a Glow implementation like
this one. (i'll post screens on release)
r_DepthOfField & r_motionBlur will work with the vanilla game maps, but r_glow will need special materials settings, so until someone convert/rework all vanilla materials, Glow will only be usable for (futur) mods and will be turned off but availlable. (a demo map will be in the pack to still demonstrate all effects combined together.)
Each effect is in alpha stages, and they eat ressources, but i still play at 60fps in ultra 80% of the time in the DoomIII campaign on my old comp: Dual Core 3800, 2gb ram, and a Geforce 9800 GTX+. I didn't test on any other comp.
Stay tuned!
EDIT: 19 April 2009.Finally, it's time for you all to get you hands on the alpha release of this little baby, codename:
idTech4 ExtendedHere come a zip that 'only' contain a DLL, a map to test all the features: showcase.map, and a DentonModV2 vital pack (def files, etc.), as my work is build upon Denton's source.
You can grab it on
FILEFRONT!
(28/08/09 : LINK UPDATED)In its current state (alpha), you can't enable the Glow with unmodified materials, so you can't play SP or MP common maps without rewriting all materials. you can't really use all weapons with depth of field enabled, because it's based on surface depth, and some weapons use to toggle muzzlefalsh sprites visible/invisible (try the bazooka to understand what i mean).
Read the readme for more general infos, and dig into files for technicals.
The source will come really soon, i promise!
6th Venom.

PS: Sorry to release it so late, i worked (irl job) all the weekend.
EDIT: 21 April 2009.Here come the source code from the alpha version, you must extract it over the DentonModV2.0 source code game folder to compile it.
idTech4 Extended [alpha] source code,
DentonModV2 source code. (filefront links)
Enjoy, 6th Venom.
6th Venom wrote:
!!! No source Downloadable !!!
!!!!!!
I like what I see.
Beautiful!! I'm so glad someone else has the motivation to do these types of post-processing effects as learning ARB assembly is somewhat difficult (though I'm slowly getting more and more comfortable with it).
I understand by not releasing the code but would it be possible to check out your fragment code for getting the depth value to black/white?
This is pretty awesome, bravo.
I'm sure someone would have the motivation to put together a vanilla D3 version if you post the important bits.
Damn that looks sweeeeet...

Keep up the good work man.
Very cool

.
How do you manage things like alphatested materials ?
I've played around with the global material a good while ago but was disappointed that it couldn't replace just certain material elements like "diffuse rgb only".
See the first post, i added some infos.
6th, I don't know how much you're considering when you determine what range to keep focused, but I have a few suggestions that should help even more.
If you're not already doing it, you should consider adapting or expanding the depth of unblurred field to include more potential enemies. For example, If an enemy is near the middle of a hallway, the above already works well. If another enemy comes around the corner, the range of focus could gradually expand or shift so that both enemies are reasonably focused. If you're firing at an enemy and / or they're firing at you, should consider making sure they're within reasonable focus.
Hope these suggestions help with your results which already look good!
rebb wrote:
I've played around with the global material a good while ago but was disappointed that it couldn't replace just certain material elements like "diffuse rgb only".
I've found some interresting things in renderer\material.h like idMaterial : GetStage (get a specific stage), hasAlphaTest (shaderStage_t), and alphaTestRegister (shaderStage_t) but don't really know how i could use those without checking every single material in PVS at each frame...

MBolus wrote:
Hope these suggestions help with your results which already look good!
Yep this is something i"m thinking about, even if i actually experiment dynamic & adaptative motion blur more than i work on DoF. I already used to sent a FocusDistanceNear & FocusDistanceFar to the shader so i think it's just a matter of doing a good "distanceto" with monsters in PVS. i'll seriously digg into that later...
it's still a good point, thanks for the suggestions.
Oh my. That's extreme. The motion blur isn't so much motion as a fading progressive after image that's blurred. Makes me feel very, very high. The adaptive depth of field is nice except for not being able to read ammo counters on the weapons when the focal point is too far away

Phobos wrote:
Oh my. That's extreme.
Is "extreme" bad or good?

Phobos wrote:
The motion blur isn't so much motion as a fading progressive after image that's blurred. Makes me feel very, very high.
I understand well, i struggled with another method a lot till ending with this balanced mix of hacks, but i already think about another appoach to test.
Phobos wrote:
The adaptive depth of field is nice except for not being able to read ammo counters on the weapons when the focal point is too far away

Yeah that's the primary wrong thing to deal with, simple answer should be to make the hud indicate ammos for ALL weapons, as it does for grenades and some others.
Thank you for feedbacks.

Awesome- and frankly, if your ammo count is on the stock of your gun, you won't be able to see it while firing anyway. It's not a bug, it's 'survival horror'.
Is like FEAR 2, but for me is too extreme in a bad way. It would be good to have the option to adjust the strenght if is possible. Love the glow.
It's really possible to create some new multiplicators Cvars for DoF, MotionBlur & Glow. (just like how denton made it for bloom)
Then after, just make a new option in the mainmenu gui with a bar to choose from 0 to 1 or 2 for extreme effects.
Like i said before, it's an alpha, plus it's more a "how to implement it into your futur mods" than a "it's done & 100% compatible with vanilla game".

EDIT:
You can download the source from alpha version in the first post 
Quote:
you must extract it over the DentonModV2.0 source code game folder to compile it.
sorry for possible noobishness, lack of searching etc..

where can I find/download the DentonModV2.0 source?
best regards..
I added the link into the first post too. ^^
Thanks a bunch, 6th Venom..