(一)、习题答案

1、EXERCISE1

  本题中,我们需要先构建一个circle,然后将其扩展为一个无盖无底的圆柱。本题需要手动创建一个circle。结果如下:

Introduction to 3D Game Programming with Directx12 Chapter12

2、EXERCISE2

  本题是对一个二十面体进行细分的考察,这里我们使用几何着色器来完成(也可以使用曲面细分着色器来完成),通过距离来控制细分程度。

Introduction to 3D Game Programming with Directx12 Chapter12

3、EXERCISE3

  本题我们只要将三角形沿法向方向赋予一个速度即可,我们还可以对法向做扰动来使三角形面片旋转。

Introduction to 3D Game Programming with Directx12 Chapter12

4、EXERCISE4

  本题第一次进行常规渲染,第二次则只对法向进行渲染,这里需要在vertex的法向方向再生成一个顶点,渲染vertex到新生成顶点为线段即可。

Introduction to 3D Game Programming with Directx12 Chapter12

Introduction to 3D Game Programming with Directx12 Chapter12

使用wireframe渲染更能清楚的看到渲染线段的位置

5、EXERCISE5

  本题与第四题技术方法一样,只是在需要计算面法向和法向两个端点的位置。

Introduction to 3D Game Programming with Directx12 Chapter12

Introduction to 3D Game Programming with Directx12 Chapter12

6、EXERCISE6

  本题主要是说明SV_VertiexID是每一次DrawCall都不一样的,第一个DrawCall都会重置SV_VertiexID,下图可以看出来,不同的方法生成的树将会不一样,大小也不一样,第一种方法会导致clamp,第4棵树以后的树都一样。

Introduction to 3D Game Programming with Directx12 Chapter12

Introduction to 3D Game Programming with Directx12 Chapter12

Introduction to 3D Game Programming with Directx12 Chapter12

7、EXERCISE7

  本题与第六题类似。

Introduction to 3D Game Programming with Directx12 Chapter12

Introduction to 3D Game Programming with Directx12 Chapter12

(二)、源码下载

第七章习题源代码下载 源码下载

相关文章: