• About
    • Resume
A Game Developer also plays some guitar

复习了一下Frustum Culling

June 25, 2009 6:17 pm / Benny Chen

上次跟frustum culling的亲密接触还是两年前的事情,那时的一个游戏Demo里实现了quad-tree地形,并使用frustum culling显著减少三角形面的渲染。

catcher-in-the-rye两年前的游戏Demo:麦田里的守望者

这一丢就是两年了,最近的大规模人群渲染项目,逼得我再次对frustum culling发出了呼唤,凭着模糊的记忆,再把frustum的一些原理复习了一下,不用1个小时,我就重拾了frustum culling的相关核心概念和技术,并获得了新的理解。

这是我从两年前就开始膜拜的Chad Vernon(www.chadvernon.com)大大的一段话:

When we tell DirectX to render geometry, it will perform a culling test to see if a vertex is within the view frustum before rendering the vertex. DirectX will only render a vertex if it is within the view frustum. However, this test occurs after the geometry has been transformed and lit by the world and view matrices. In more complex scenes, thousands of vertices would be transformed just to be rejected by the frustum test in DirectX. We can speed up performance quite a bit if we implement a view frustum culling test prior to our render calls.

DirectX本身在其pipeline中就会对顶点进行culling test的,但这要在顶点被”顶点变换与光照”(Transform&Lighting)之后。Vernon在写这段话的时候,应该还是DX9的时代。在DX10的文档里也赫然写着:(Rasterizer Stage)the stage clips vertices to the view frustum,是在VS,GS这些之后才进行。

而自己手工实现frustum culling的好处,就是可以将大量的非可视的顶点在送进渲染管线之前就被拒掉~

下面的这条链接对frustum culling有比较基础而详细的介绍(这哥们爆了好多粗口……),同时进行了一系列的优化,这也让我对frustum culling有了更深的理解。里面所链接的那篇讲解如何构造frustum的文章,当我再次翻开它的时候,马上就从我大脑中的碎片中搜索并意识到,我两年前曾经读过这篇文章。记忆总是在某个似曾相识的环境下被突然的激活。

http://www.flipcode.com/archives/Frustum_Culling.shtml

另外DX10的时代早已来临,AMD的那篇March of Froblins的论文里,Frustum Culling和LOD已经全部是在GPU里进行了,通过了Geometry Shader的帮忙。在如今这个时代,貌似把任何运算转移到GPU,一切皆有可能。

打算最近把frustum culling相对于我目前所进行的人群渲染项目,在CPU和GPU都实现一个版本,并进行一些性能的比较。在我现在的项目里,估计实现后GPU的版本不一定就比CPU的跑的快,因为我的GPU已经承载了大量的人群渲染任务,而CPU到目前为止还基本是空闲的。

Posted in: Computer Graphics / Tagged: frustum culling

Comments are closed.

Post Navigation

← Previous Post
Next Post →

LinkedIn

Milan Petrovic

Categories

  • In My Life (25)
    • A Day in the Life (8)
    • English Learning (2)
    • Learn a Word (7)
    • Something In The Way (8)
  • Music Heaven (8)
    • Guitar (1)
    • In Concert (1)
    • Lyrics (3)
  • OK Computer (54)
    • 3D (3)
    • C++ (10)
    • Computer Graphics (15)
    • Game Programming (23)
    • iOS (6)
    • Linux (1)
    • Lua (9)
    • My Projects (3)
    • Some Experiences (9)
    • Talking in Code (2)
    • Unity (2)
  • Quotations (2)
  • Uncategorized (1)
  • Visca Barça (24)
    • FCB BJ (5)

Recent Posts

  • [译]优化你的手机游戏(没有延迟的,才是健康的)- 一篇给游戏美术设计师读的文章
  • 新浪微博API for MOAI
  • 稍后继续
  • Unity Developer ++
  • Another Thread @ Moai Forum
  • 1st Day of Golden Week
  • 为SyntaxHighlighter添加新语言
  • 基于Lua的State Pattern
  • Class Diagram of Pacman
  • 基于Moai的Pacman

Recent Comments

  • 约修亚_RK on 为SyntaxHighlighter添加新语言
  • 爱装的小男孩 on 小心DLL链接静态库时的内存错误
  • happyfire on Game Loop的几种实现方式
  • William on 新浪微博API for MOAI
  • Benny Chen on 新浪微博API for MOAI
  • your man on 新浪微博API for MOAI
  • 你家男人 on 稍后继续
  • 逍遥 on 关于对std::vector的遍历
  • papa on Unity Developer ++
  • T客网 ︱ Techpot » Blog Archive » iOS开发与OpenGL ES相关问题整理(1) on iOS开发与OpenGL ES相关问题整理(1)

Tags

2d 3D 3dsmax 3ds max air Apply architecture Asia tour barca Beijing bilbao binary search blocked bob boost bruce springsteen C++ capo CGContextDrawImage Champions League Change DLL DX10 eval exporter flash framework frustum culling game game engine iniesta ios linux lua Moai opengles pacman plug-in plugin 北京 导出插件 崩溃 巴萨 游戏引擎 踢球
© Copyright 2025 - A Game Developer
Infinity Theme by DesignCoral / WordPress