[转]Linear Depth Buffer(线性深度缓冲区)
2012-02-07 14:30
176 查看
[b]TheProblemwithZ-Buffer[/b]Ifyouareagraphicsprogrammer,youareboundtodealwiththeuseofz-bufferforeffects.Forexample,thedepthbuffercanbeusedforperpixelfog,softparticles,motionblur,SSAO,depthoffield,etc.Usingthestandarddepth,i.e.thevaluethatisobtainedbymultiplyingwithWorldViewProjectionmatricesfollowedbyperspectivedivide,isoftennotenough.Themainproblemwithstandarddepthisthatthedepthvalueisnotlinear.Mostofthetime,thefirst10%ofthescene(thenearscene)willbemappedto0.0to0.9range.Inotherwords,90%oftheprecisionisusedupinthefirst10percentoftheviewingdistance.Ifyouralgorithmreliesheavilyondepthcomparison,youarescrewed.Thekeytohandlethisproblemistomakethedepthvaluelinearormakingitalmostlinear.Iwilldescribethetwoapproachesbelow:[b]LinearDepthBuffer[/b]NoticethatmultilyingWorld,View,Projectionmatriceswithyourpositionwillmakeitendsupinclipspace,(x,y,z,w)=(x_in_clip,y_in_clip,z_in_clip,z_in_view)exceptthatw=z_in_view.Wecanexploitthisfactandinsteadofstoringthestandarddepthwhichisobtainedbyz/w=z_in_clip/z_in_view,wecanstorelineardepthvalue.Thereareseveralvariationsformappingz_in_viewlinearly.Forexample,youcando:z_final=z_in_view/camera_far_plane
oryoucanalsodo:z_final=(z_in_view-camera_near_plane)/(camera_far_plane-camera_near_plane)
[b]W-Buffer[/b]
Theideaofw-bufferistoprovideamoredistributedlinearmappingthanforz-buffersbyinvertingthedepthvalue.Bydoingthis,youeffectivelymapthelast90%ofthescene(thefarscene)to0.0to0.9range.Inotherwords,wbuffercanstillproduceartifactswhenmanyoftheobjectsinthesceneareclosetothecamera.Incomparisontoz-buffer,w-bufferhasalotmoreprecisionavailableforobjectsinthemiddletofardistancefromtheviewer.Incodelanguage,youwouldoutput:z_final=1/z_in_view
Inconclusion
I'vediscussedseveraltechniquestoalleviatethenon-linearityofz-buffer.Ihopeitcangiveyoulightwhyyoumayhavealotofartifactsusingthestandardz-buffer.
from:http://www.3dgametechnology.com/index.php?option=com_content&view=article&id=95:linear-depth-buffer&catid=34:articles&Itemid=55
moreflexibledepthbuffercontroltitled"quasi-lineardepthbuffer".
http://dl.acm.org/citation.cfm?id=383530AutodeskCanadaCo.
oryoucanalsodo:
[b]W-Buffer[/b]
Theideaofw-bufferistoprovideamoredistributedlinearmappingthanforz-buffersbyinvertingthedepthvalue.Bydoingthis,youeffectivelymapthelast90%ofthescene(thefarscene)to0.0to0.9range.Inotherwords,wbuffercanstillproduceartifactswhenmanyoftheobjectsinthesceneareclosetothecamera.Incomparisontoz-buffer,w-bufferhasalotmoreprecisionavailableforobjectsinthemiddletofardistancefromtheviewer.Incodelanguage,youwouldoutput:
Inconclusion
I'vediscussedseveraltechniquestoalleviatethenon-linearityofz-buffer.Ihopeitcangiveyoulightwhyyoumayhavealotofartifactsusingthestandardz-buffer.
from:
moreflexibledepthbuffercontroltitled"quasi-lineardepthbuffer".
相关文章推荐
- Android:深度探究线性布局LinearLayout中权重(layout_weight)属性
- 深度学习框架Keras学习系列(一):线性代数基础与numpy使用(Linear Algebra Basis and Numpy)
- 线性判别分析(Linear Discriminant Analysis)(二)
- Java NIO学习总结二(Buffer缓冲区)
- Minimum Depth of Binary Tree 求二叉树最小高度/深度@LeetCode
- Locally Weighted Linear Regression 局部加权线性回归-R实现
- Android 线性布局(LinearLayout)相关官方文档 - 指南部分
- 深度学习与媒体计算②——kNN的优化与线性分类 (CS231n)
- NIO - Buffer缓冲区
- lintcode maximum-depth-of-binary-tree 二叉树的最大深度
- 一个线程往缓冲区buffer写数据,另外三个读数据,读和写要分开
- 《Java源码解析》NIO中Buffer缓冲区的实现
- 深度学习中得数学,高效计算基础与线性分类器
- LinearGradient线性渲染
- muduo应用层缓冲区buffer设计
- Node.js Buffer(缓冲区)
- 线性判别分析(Linear discriminant analysis)
- Digdata Development Java__Study_10(buffer缓冲区,字符流)
- R语言分类算法之线性判别分析(Linear Discriminant Analysis)