Jump to content
  • Advertisement
Sign in to follow this  
mancubit

Depth of Field (GPU Gems 3) Problems

This topic is 2601 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am currently trying to implement the depth of field algorithm as described in gpu gems 3 (link)

I am having some difficulties to get it running. My biggest problem is finding suitable parameters to test it out properly.

In the downsample shader (1. step):
dofEqWorld - what exactly is stored in this vector?
its used in the equation:


sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y );


according to its usage i think its the cocScale and cocBias value as described here but i am not sure about this (it also uses abs instead of saturate)

if this is the case, what are usual values for aperture and focallength? and should the depth value in this equation be provided as view-depth? or normalized depth? and should the depth value be linear?

there is also a similar vector used in the last step:


farCoc = saturate( dofEqFar.x * depth + dofEqFar.y );


i guess these would be the same values, right?

hopefully someone can answer these questions, because i kept playing around with values but never get any reasonable results..

Share this post


Link to post
Share on other sites
Advertisement
finally found the problem:

there is a mistake in the bias term (which is stated in the GPU Gems article - also found this mistake in a siggraph presentation!)

instead of this:


CoCBias = (aperture * focallength * (znear - planeinfocus)) / ((planeinfocus * focallength) * znear)


you have to use this:


CoCBias = (aperture * focallength * (znear - planeinfocus)) / ((planeinfocus - focallength) * znear)


hope this helps others too

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!