3D游戏引擎场景渲染技术的研究与实现毕业论文
2020-07-01 20:49:58
摘 要
游戏是一个很复杂而且庞大的工程,而渲染引擎作为一个最重要的组件,它的好坏影响着游戏的质量和品质。论文主要结合Vulkan技术,首先介绍了Vulkan的渲染管线,分析每一阶段的主要内容。其中主要包括几个重要的可编程着色阶段,例如顶点着色阶段和像素着色阶段等,还有部分固定功能的阶段,它们是可配置的。作为Khronos组织拟定的下个时代的图形标准,在改进以往标准的诟病,大大提升了API的性能和效率。它可以直接操控GPU,在一定程度上还能访问GPU的显示驱动抽象层,提升了硬件的计算效率。
数学知识在渲染中也占有很重要的内容,很多数据也是通过数学来计算的,例如平移、旋转、缩放和投影等等。论文主要介绍了一些常用的相关知识,其中包括向量和一些矩阵的基本知识。后面还介绍了投影变换,主要把3D坐标投影到二维平面。接下来开始根据渲染管线的步骤来进行具体操作,创建物理设备和逻辑设备,创建队列来执行提交给命令缓冲区的命令。首先开始根据管线来渲染基本的几何物体,例如三角形。然后引入纹理映射,增加物体的真实感,介绍纹理和采样器的创建,还介绍了纹理的多重采样和滤波知识。随后为了减少重复的顶点数据存储造成的开销,介绍了索引缓冲相关知识。在索引缓冲的知识上进行来一些复杂场景的渲染。
光照在增加真实感的基础上很有用,介绍了简单的光照模型,其中包括漫反射光、环境光和镜面反射光。简单光照模型只考虑物体对直接光照明模型,该模型只考虑物体对直接光照的反射作用,认为环境光是常量,没有考虑物体之间的相互反射光,物体间的反射光只用环境光表示。并且假定物体表面不透明,具有均匀反射率,在计算处理上变得简单,不同物体具有不同的亮度,同一物体表面的亮度被看成一个恒定值。
关键词:Vulkan 计算机图形学 渲染 纹理 光照
Research and Implementation of 3D Game Engine Scene Rendering Technology
Abctract
The game is a very complicated and huge project. As the most important component, the rendering engine affects the quality and quality of the game. The paper mainly combines Vulkan technology, first introduced the Vulkan rendering pipeline, and analyzed the main content of each stage. It mainly includes several important programmable shading phases, such as vertex shading and pixel shading phases, as well as some fixed-function phases, which are configurable. As the graphic standard for the next era developed by the Khronos organization, the flaws in the previous standards have been improved, and the performance and efficiency of the API have been greatly improved. It can directly manipulate the GPU, to a certain extent, it can also access the GPU's display-driven abstraction layer, which improves the hardware's computational efficiency.
Mathematical knowledge also plays an important role in rendering. Many data are also calculated through mathematics, such as translation, rotation, scaling, and projection. The paper mainly introduces some commonly used related knowledge, including basic knowledge of vectors and some matrices. The projection transformation is also introduced later, mainly to project the 3D coordinates onto the two-dimensional plane. The next step is to perform specific operations based on the rendering pipeline steps, create physical devices and logical devices, and create queues to execute commands submitted to the command buffer. Start by rendering basic geometric objects, such as triangles, based on the pipeline. Then the texture mapping was introduced to increase the realism of the object. The creation of textures and samplers was introduced. The knowledge of multi-sampling and filtering of textures was also introduced. Later, in order to reduce the overhead caused by repeated vertex data storage, the knowledge of index buffering is introduced. Perform some complex scene rendering on the knowledge of index buffering.
Lighting is useful for increasing realism. Simple lighting models are introduced, including diffuse, ambient, and specular. The simple light model only considers the object-to-direct light illumination model. This model only considers the reflection effect of the object on the direct light. It considers that the ambient light is a constant and does not consider the mutual reflected light between the objects. The reflected light between the objects is expressed only by ambient light. . And assuming that the surface of the object is opaque and has a uniform reflectivity, it becomes simple in calculation processing, different objects have different brightness, and the brightness of the same object surface is regarded as a constant value.
Keyword:Vulkan Computer graphics rendering texture lighting
目 录
摘 要 I
Abctract II
第一章 绪论 1
1.1课题背景 1
1.2 研究现状 1
1.3 研究意义 2
第二章 数学理论 4
2.1 矢量 4
2.1.1 矢量运算 4
2.2 矩阵 4
2.2.1 单位矩阵 5
2.2.2 逆矩阵 5
2.2.3 转置矩阵 5
2.3 坐标空间 6
2.3.1 模型空间 7
2.3.2 世界空间 7
2.3.3 观察空间 7
2.3.4 裁剪空间 8
第三章 Vulkan渲染管线 9
3.1 介绍 9
3.2 逻辑图形管线 9
3.3 RenderPasses 12
第四章 绘制和贴图 15
4.1 Instance,Devices,and Queue 15
4.1.1 创建Instance 16
4.1.2 创建物理设备 16
4.1.3 创建逻辑设备 17
4.2 呈现 18
4.2.1 Window surface 18
4.2.2 交换链 19
4.2.3 Image views 21
4.3 渲染基础 21
4.3.1 着色模块 21
4.3.2 固定功能 23
4.3.3 Render passes 26
4.4 绘制 27
4.4.1 Framebuffers 27
4.4.2 Command buffers 27
4.4.3 Rendering and Presentation 29
4.5 纹理映射 30
4.5.1 Images 30
4.5.2 Image view and 采样 32
4.5.3 联合图像采样器 34
4.5.4 深度缓冲 35
第五章 场景绘制和光照 39
5.1 顶点缓存和索引缓存 39
5.2 简单光照模型 42
5.2.1 环境光 42
5.2.2 漫反射 42
5.3.2 镜面反射 43
第六章 总结 46
6.1 总结 46
6.2 期望 46
参考文献 47
致 谢 48
第一章 绪论
1.1课题背景
计算机图形这门学科是把二维或者三维图像按照数学上的理论方法计算显示在屏幕上或者保存为文件格式。它在一定极大程度上依赖于数学上的理论和算法,都是经过了很多年的研究。生成比较真实的图像,这其中又包括实时和离线两个研究方向。图形的表示又由几何属性(例如点、线和面)和非几何属性(例如灰度范围、色彩范围、线条长度、线宽大小)构成。
在一些领域,普通大众能够通过可视化的方式接触到一部分内容;在游戏娱乐领域,在视频领域也发挥着重要的作用,比如电子游戏和好莱坞大片等,游戏已经成为人们的主要娱乐活动之一,它影响着我们的生活,电影也在人们的日常活动中占据着重要的作用。随着现代人类社会的快速发展,人们在生物学数据可视化、化学成像、教育可视化、信息可视化、医学影像、工程制图、用户界面设计、娱乐等产业的视觉追求逐渐提高,还有很多这个方面相关的领域开始热门起来,如VR游戏和数据可视化等等。
随着GPU的集成电路技术和现代电子工艺的飞速发展,GPU引入了可编程的渲染管线和并行计算(OpenCL)的架构。因此也带动了相关领域的技术发展水平,让人们之前认为计算机不可能实现的事情成为事实,而计算机图形学的相关技术就是其中之一。
相关图片展示: