Difference between revisions of "例子程序"

From KlayGE
Jump to: navigation, search
m (1个修订)
(Created page with "''' 注意 ''' 如果要在没有安装Microsoft Visual C++ 2010的机器上运行二进制版本的例子,需要事先安装Microsoft Visual C++ 2010 Redistributable Package...")
(16 intermediate revisions by one user not shown)
Line 5: Line 5:
 
*x64版本可以从[http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=bd512d9e-43c8-4655-81bf-9350143d5867]下载。
 
*x64版本可以从[http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=bd512d9e-43c8-4655-81bf-9350143d5867]下载。
  
在第一次执行之前,建议先运行引擎提供的[[KConfig]]来完成配置。
+
= Deferred Shading =
 
+
Deferred shading渲染框架。
= Deferred Rendering =
+
[[File:Deferredrendering.jpg|200px|thumb|right|Deferred Rendering]]
+
[[延迟渲染|Deferred rendering]]渲染框架。
+
 
+
'''难度'''
+
+
  
 
''' 技术点 '''
 
''' 技术点 '''
Line 20: Line 14:
 
#任意光源
 
#任意光源
 
#Soft shadow
 
#Soft shadow
#[[文件打包系统]]
 
  
 
''' 需求 '''
 
''' 需求 '''
Line 29: Line 22:
  
 
= Depth peeling =
 
= Depth peeling =
[[File:Depthpeeling.jpg|200px|thumb|right|Depth Peeling]]
 
 
顺序无关的透明物体渲染。
 
顺序无关的透明物体渲染。
 
'''难度'''
 
 
  
 
'''技术点'''
 
'''技术点'''
Line 47: Line 36:
  
 
= Distance mapping =
 
= Distance mapping =
[[File:Distancemapping.jpg|200px|thumb|right|Distancemapping]]
+
GPU Gems 2中提到的distance mapping。在pixel shader中根据预处理的距离场进行局部球面光线跟踪。这里我做的扩展是可以表现出边缘的轮廓。
[http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter08.html GPU Gems 2第八章]中提到的distance mapping。在pixel shader中根据预处理的距离场进行局部球面光线跟踪。这里我做的扩展是可以表现出边缘的轮廓。
+
 
+
'''难度'''
+
容易
+
  
 
'''技术点'''
 
'''技术点'''
Line 65: Line 50:
  
 
= Fractal =
 
= Fractal =
[[File:Fractal.jpg|200px|thumb|right|Fractal]]
 
 
在GPU中计算分形图形。
 
在GPU中计算分形图形。
 
'''难度'''
 
容易
 
  
 
'''技术点'''
 
'''技术点'''
Line 81: Line 62:
  
 
= GPU Particle System =
 
= GPU Particle System =
[[File:Gpuparticlesystem.jpg|200px|thumb|right|GPU Particle System]]
 
 
基于GPU的粒子系统。
 
基于GPU的粒子系统。
 
'''难度'''
 
 
  
 
'''技术点'''
 
'''技术点'''
Line 100: Line 77:
  
 
= JudaTex Viewer =
 
= JudaTex Viewer =
[[File:Judatexviewer.jpg|200px|thumb|right|Juda Texture Viewer]]
+
Juda Texture查看器。
[[Juda Texture]]查看器。
+
 
+
'''难度'''
+
+
  
 
'''技术点'''
 
'''技术点'''
#[[Juda Texture]]
+
#Juda Texture
 
#鼠标交互
 
#鼠标交互
  
Line 117: Line 90:
  
 
= Model viewer =
 
= Model viewer =
[[File:Model_viewer.jpg|200px|thumb|right|Model Viewer]]
+
一个MeshML模型查看器,支持Skinned mesh和Normal map。初始模型来自于http://www.cgrealm.cn。
一个MeshML模型查看器,支持Skinned mesh和Normal map。初始模型来自于[http://www.cgrealm.cn http://www.cgrealm.cn]。
+
 
+
'''难度'''
+
+
  
 
'''技术点'''
 
'''技术点'''
Line 136: Line 105:
  
 
= Motion Blur and Depth of Field =
 
= Motion Blur and Depth of Field =
[[File:Mblur_dof.jpg|200px|thumb|right|Mition Blur and Depth of Field]]
+
运动模糊和景深post process。可以调节焦平面和焦距范围。并演示了引擎中的instancing实现。在硬件支持instancing的时候会自动切换到硬件实现,否则使用CPU解开instance数据。
[[运动模糊]]和[[景深]][[post process]]。可以调节焦平面和焦距范围。并演示了引擎中的instancing实现。在硬件支持instancing的时候会自动切换到硬件实现,否则使用CPU解开instance数据。
+
 
+
'''难度'''
+
+
  
 
'''技术点'''
 
'''技术点'''
#[[运动模糊|Motion Blur]]
+
#Motion Blur
#[[景深|Depth of field]]
+
#Depth of field
 
#Summed-Area Table
 
#Summed-Area Table
 
#软件/硬件instancing
 
#软件/硬件instancing
Line 157: Line 122:
  
 
= Ocean =
 
= Ocean =
[[File:Ocean.jpg|200px|thumb|right|Ocean]]
 
 
演示水面的渲染。水面的运动通过在GPU上实时地做FFT来模拟。核心来自于NVIDIA的Demo。
 
演示水面的渲染。水面的运动通过在GPU上实时地做FFT来模拟。核心来自于NVIDIA的Demo。
 
'''难度'''
 
 
  
 
'''技术点'''
 
'''技术点'''
Line 170: Line 131:
 
#雾
 
#雾
 
#镜头眩光
 
#镜头眩光
#[[文件打包系统]]
 
  
 
'''需求'''
 
'''需求'''
Line 179: Line 139:
  
 
= Parallax =
 
= Parallax =
[[File:Parallax.jpg|200px|thumb|right|Parallax]]
 
 
Parallax mapping,扩展了normal map技术。
 
Parallax mapping,扩展了normal map技术。
 
'''难度'''
 
容易
 
  
 
'''技术点'''
 
'''技术点'''
Line 199: Line 155:
  
 
= Particle Editor =
 
= Particle Editor =
[[File:Particleeditor.jpg|200px|thumb|right|Particle Editor]]
 
 
粒子系统编辑器
 
粒子系统编辑器
 
'''难度'''
 
 
  
 
'''技术点'''
 
'''技术点'''
Line 218: Line 170:
  
 
= PNTriangles =
 
= PNTriangles =
[[File:Pn_triangles.jpg|200px|thumb|right|PNTriangles]]
 
 
用D3D11的Tessellator实现了Curved PN Triangles,把低模在运行期细分成高模曲面。
 
用D3D11的Tessellator实现了Curved PN Triangles,把低模在运行期细分成高模曲面。
 
'''难度'''
 
 
  
 
'''技术点'''
 
'''技术点'''
 
#PN Triangles算法
 
#PN Triangles算法
#D3D11 hardware tessellation
+
#Tessellation
#Instanced tessellation
+
 
#Hull Shader/Domain Shader
 
#Hull Shader/Domain Shader
  
 
'''需求'''
 
'''需求'''
*Geforce 8系列以上或RadeonHD 4系列以上。
+
*Geforce GTX 4系列以上或RadeonHD 5系列以上。
  
 
'''渲染引擎支持'''
 
'''渲染引擎支持'''
Line 237: Line 184:
  
 
= PostProcessing =
 
= PostProcessing =
[[File:Postprocessing.jpg|200px|thumb|right|Post Processing]]
 
 
演示[[后处理]]的能力。支持的特效有:
 
演示[[后处理]]的能力。支持的特效有:
 
*Ascii Arts,把渲染的图像拟合成ascii字符的表示。
 
*Ascii Arts,把渲染的图像拟合成ascii字符的表示。
Line 245: Line 191:
 
*Night Vision,模拟夜视仪看到的效果。
 
*Night Vision,模拟夜视仪看到的效果。
 
*Old Fashion,老照片效果。
 
*Old Fashion,老照片效果。
 
'''难度'''
 
 
  
 
'''技术点'''
 
'''技术点'''
Line 263: Line 206:
  
 
= ProceduralTex =
 
= ProceduralTex =
[[File:Proceduraltex.jpg|200px|thumb|right|Procedural Texture]]
 
 
在GPU上使用Perlin noise来产生多种[[Procedural texture]]。
 
在GPU上使用Perlin noise来产生多种[[Procedural texture]]。
 
'''难度'''
 
容易
 
  
 
'''技术点'''
 
'''技术点'''
 
#Perlin noise
 
#Perlin noise
#[[Procedural texture]]
+
#Procedural texture
  
 
'''需求'''
 
'''需求'''
Line 280: Line 219:
  
 
= Refract =
 
= Refract =
[[File:Refract.jpg|200px|thumb|right|Refract]]
 
 
折射的演示。支持Fresnel和色散现象。
 
折射的演示。支持Fresnel和色散现象。
 
'''难度'''
 
 
  
 
'''技术点'''
 
'''技术点'''
Line 290: Line 225:
 
#色散
 
#色散
 
#HDR渲染
 
#HDR渲染
#[[Tone mapping]]
+
#Tone mapping
 
#HDR纹理压缩
 
#HDR纹理压缩
 
#双面折射
 
#双面折射
Line 301: Line 236:
  
 
= Shadow cube map =
 
= Shadow cube map =
[[File:Shadowcubemap.jpg|200px|thumb|right|Shadow cube map]]
+
把传统的shadow map扩展到cube map上,模拟了全方向的点光源和光源的投射。另一个改进是加入了[Variance Shadow Map]。
把传统的shadow map扩展到cube map上,模拟了全方向的点光源和光源的投射。另一个改进是加入了[[Variance Shadow Map]]。
+
 
+
'''难度'''
+
+
  
 
'''技术点'''
 
'''技术点'''
Line 319: Line 250:
  
 
= Sub-surface =
 
= Sub-surface =
[[File:Subsurface.jpg|200px|thumb|right|Sub-surface]]
+
次表面散射的实时渲染。
[[次表面散射]]的实时渲染。
+
 
+
'''难度'''
+
+
  
 
'''技术点'''
 
'''技术点'''
#[[次表面散射]]
+
#Sub-surface scattering
 
#Bump map
 
#Bump map
  
Line 336: Line 263:
  
 
= Text =
 
= Text =
[[File:Text.jpg|200px|thumb|right|Text]]
+
演示了基于signed distance field的字体显示方法。
演示了基于signed distance field的[[字体系统|字体显示方法]]。
+
 
+
'''难度'''
+
容易
+
  
 
'''技术点'''
 
'''技术点'''
Line 352: Line 275:
  
 
= Vertex displacement =
 
= Vertex displacement =
[[File:Vertexdisplacement.jpg|200px|thumb|right|Vertex displacement]]
 
 
在vertex shader中用sin计算顶点和法线的偏移。
 
在vertex shader中用sin计算顶点和法线的偏移。
 
'''难度'''
 
容易
 
  
 
'''技术点'''
 
'''技术点'''
Line 369: Line 288:
  
 
= Video texture =
 
= Video texture =
[[File:Videotexture.jpg|200px|thumb|right|Video Texture]]
+
演示了Show engine,解码后的视频作为纹理贴到3D物体上。其中用到的视频来自开源电影Big Buck Bunny。
演示了Show engine,解码后的视频作为纹理贴到3D物体上。其中用到的视频来自开源电影[http://www.bigbuckbunny.org/ Big Buck Bunny]。
+
 
+
'''难度'''
+
容易
+
  
 
'''技术点'''
 
'''技术点'''

Revision as of 01:07, 11 December 2010

注意

如果要在没有安装Microsoft Visual C++ 2010的机器上运行二进制版本的例子,需要事先安装Microsoft Visual C++ 2010 Redistributable Package。

  • x86版本可以从[1]下载。
  • x64版本可以从[2]下载。

Deferred Shading

Deferred shading渲染框架。

技术点

  1. Deferred Lighting
  2. SSAO
  3. Adaptive Anti-alias
  4. 任意光源
  5. Soft shadow

需求

  • Geforce 6600以上或Radeon 9500以上。

渲染引擎支持

  • D3D11/OpenGL。

Depth peeling

顺序无关的透明物体渲染。

技术点

  1. Depth peeling
  2. MRT
  3. UI

需求

  • Geforce 6600以上或Radeon 9500以上。

渲染引擎支持 D3D11/OpenGL。

Distance mapping

GPU Gems 2中提到的distance mapping。在pixel shader中根据预处理的距离场进行局部球面光线跟踪。这里我做的扩展是可以表现出边缘的轮廓。

技术点

  1. Distance mapping
  2. 轮廓检测
  3. Normal map压缩 (3.4.0之后)

需求

  • Geforce FX以上或Radeon 9500以上。推荐使用Geforce 6以上。

渲染引擎支持

  • D3D11/OpenGL。

Fractal

在GPU中计算分形图形。

技术点

  1. 双缓存切换

需求

  • Geforce FX以上或Radeon 9500以上。推荐使用Geforce 6以上。

渲染引擎支持

  • D3D11/OpenGL/OpenGLES2。

GPU Particle System

基于GPU的粒子系统。

技术点

  1. 粒子系统
  2. GPU多遍计算
  3. Vertex texture fetch
  4. Deferred particle

需求

  • Geforce 6以上或Radeon HD2400以上。

渲染引擎支持 D3D11/OpenGL。

JudaTex Viewer

Juda Texture查看器。

技术点

  1. Juda Texture
  2. 鼠标交互

需求

  • Geforce FX以上或Radeon 9500以上。

渲染引擎支持

  • D3D11/OpenGL。

Model viewer

一个MeshML模型查看器,支持Skinned mesh和Normal map。初始模型来自于http://www.cgrealm.cn。

技术点

  1. GPU骨骼动画
  2. 模型格式的读取
  3. Normal map的渲染
  4. UI

需求

  • Geforce FX以上或Radeon 9500以上。

渲染引擎支持

  • D3D11/OpenGL/OpenGLES2。

Motion Blur and Depth of Field

运动模糊和景深post process。可以调节焦平面和焦距范围。并演示了引擎中的instancing实现。在硬件支持instancing的时候会自动切换到硬件实现,否则使用CPU解开instance数据。

技术点

  1. Motion Blur
  2. Depth of field
  3. Summed-Area Table
  4. 软件/硬件instancing
  5. Script engine
  6. UI

需求

  • Geforce 6600以上或Radeon 9500以上。

渲染引擎支持

  • D3D11/OpenGL。

Ocean

演示水面的渲染。水面的运动通过在GPU上实时地做FFT来模拟。核心来自于NVIDIA的Demo。

技术点

  1. 水面渲染
  2. Compute shader
  3. GPU上的FFT
  4. 反射贴图
  5. 镜头眩光

需求

  • Geforce 6以上或Radeon HD2400以上。实时编辑需要Geforce 8以上或Radeon HD4以上。

渲染引擎支持

  • D3D11/OpenGL。

Parallax

Parallax mapping,扩展了normal map技术。

技术点

  1. Parallax mapping
  2. Normal map压缩 (KlayGE 3.4.0之后)

需求

  • Geforce FX以上或Radeon 9500以上。

渲染引擎支持

  • D3D11/OpenGL/OpenGLES2。

已知问题

  • 在ATI的卡上OpenGL插件显示全黑。

Particle Editor

粒子系统编辑器

技术点

  1. 粒子系统
  2. 复杂的UI
  3. Soft particle
  4. Geometry shader

需求

  • Geforce FX以上或Radeon 9500以上。推荐使用Geforce 6以上。

渲染引擎支持

  • D3D11/OpenGL。

PNTriangles

用D3D11的Tessellator实现了Curved PN Triangles,把低模在运行期细分成高模曲面。

技术点

  1. PN Triangles算法
  2. Tessellation
  3. Hull Shader/Domain Shader

需求

  • Geforce GTX 4系列以上或RadeonHD 5系列以上。

渲染引擎支持

  • D3D11/OpenGL/OpenGLES2。

PostProcessing

演示后处理的能力。支持的特效有:

  • Ascii Arts,把渲染的图像拟合成ascii字符的表示。
  • 卡通渲染。使用两遍的方法,第一遍得出几何位置,第二遍进行光照和勾边。
  • Tiling,砖块的效果。
  • HDR。
  • Night Vision,模拟夜视仪看到的效果。
  • Old Fashion,老照片效果。

技术点

  1. post process
  2. 用GPU进行ascii匹配
  3. Cartoon post process
  4. 深度和法线间断点的查找
  5. MRT

需求

  • Geforce 6600以上或Radeon 9500以上。

渲染引擎支持

  • D3D11/OpenGL。

ProceduralTex

在GPU上使用Perlin noise来产生多种Procedural texture

技术点

  1. Perlin noise
  2. Procedural texture

需求

  • Geforce FX以上或Radeon 9500以上。

渲染引擎支持

  • D3D11/OpenGL/OpenGLES2。

Refract

折射的演示。支持Fresnel和色散现象。

技术点

  1. 反射、折射和Fresnel
  2. 色散
  3. HDR渲染
  4. Tone mapping
  5. HDR纹理压缩
  6. 双面折射

需求

  • Geforce FX以上或Radeon 9500以上。推荐使用Geforce 6以上。

渲染引擎支持

  • D3D11/OpenGL。

Shadow cube map

把传统的shadow map扩展到cube map上,模拟了全方向的点光源和光源的投射。另一个改进是加入了[Variance Shadow Map]。

技术点

  • 全方向的shadow map
  • VSM
  • 纹理投射

需求

  • Geforce FX 5600以上或Radeon 9500以上。推荐使用Geforce 6以上。

渲染引擎支持

  • D3D11/OpenGL。

Sub-surface

次表面散射的实时渲染。

技术点

  1. Sub-surface scattering
  2. Bump map

需求

  • Geforce FX 5600以上或Radeon 9500以上。推荐使用Geforce 6以上。

渲染引擎支持

  • D3D11/OpenGL。

Text

演示了基于signed distance field的字体显示方法。

技术点

  1. Font

需求

  • Geforce FX以上或Radeon 9500以上。

渲染引擎支持

  • D3D11/OpenGL/OpenGLES2。

Vertex displacement

在vertex shader中用sin计算顶点和法线的偏移。

技术点

  1. 顶点偏移
  2. 通过导函数直接计算法线

需求

  • Geforce 4 Ti以上或Radeon 9200以上。

渲染引擎支持

  • D3D11/OpenGL/OpenGLES2。

Video texture

演示了Show engine,解码后的视频作为纹理贴到3D物体上。其中用到的视频来自开源电影Big Buck Bunny。

技术点

  1. DirectShow解码到纹理

需求

  • Geforce 4 Ti以上或Radeon 9200以上。

渲染引擎支持

  • D3D11/OpenGL/OpenGLES2。

已知问题

  • 在D3D11中无法全屏。