POPPUR爱换

标题: 转一个:Humus写的R2VB/VTF demo [打印本页]

作者: hourousha    时间: 2006-3-15 10:09
标题: 转一个:Humus写的R2VB/VTF demo
A bit over three years ago I made the Infinite Terrain demo, which generated new terrain on the CPU as it needed it and uploaded to a vertex buffer. With R2VB there's now a possibility to generate terrain on the GPU, and that's what this demo does. First a pixel shader generates a noise function representing the height into a texture. This texture is then sampled in a second pass to generate the normals. The normal and height is written to a RGBA16F render target which is later used as a vertex buffer. If half floats are not supported in the vertex declaration RGBA32F is used instead, and if R2VB is not supported VTF is used instead.

This demo should run on Radeon 9500 and up and GeForce 6 series and up.

地址:
Infinite Terrain II

顺便问一下,gzeasy怎么了?
作者: RacingPHT    时间: 2006-3-15 11:59
提示: 作者被禁止或删除 内容自动屏蔽
作者: Edison    时间: 2006-3-15 12:10
if R2VB is not supported VTF is used instead,为什么会有支持VTF而不支持R2VB的呢?
作者: RacingPHT    时间: 2006-3-15 12:25
提示: 作者被禁止或删除 内容自动屏蔽
作者: 来不及思考    时间: 2006-3-15 12:37
提示: 作者被禁止或删除 内容自动屏蔽
作者: niwei_123    时间: 2006-3-15 12:52
提示: 作者被禁止或删除 内容自动屏蔽
作者: hourousha    时间: 2006-3-15 12:58

  1. #define R2VB_ENABLE  0x70ff0001
  2. #define R2VB_DISABLE 0x70ff0000

  3. #define R2VB_DMAP 0
  4. #define R2VB_VTX0 1
  5. #define R2VB_VTX1 2
  6. #define R2VB_VTX2 3
  7. #define R2VB_VTX3 4

  8. #define R2VB_MAP_STREAM(stream, sampler) (0x71ff0000 | stream | (sampler << 4))
  9. #define R2VB_UNMAP_STREAM(stream) (0x71ff0050 | stream)
复制代码

检测R2VB支持

  1. if (d3d->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, D3DRTYPE_SURFACE, (D3DFORMAT) MAKEFOURCC('R','2','V','B')) == D3D_OK)
复制代码

调用方法

  1. renderer->setVertexBuffer(1, terrainVB);
  2. dev->SetRenderState(D3DRS_POINTSIZE, R2VB_ENABLE);
  3. dev->SetRenderState(D3DRS_POINTSIZE, R2VB_MAP_STREAM(1, R2VB_DMAP));
  4. dev->SetTexture(D3DDMAPSAMPLER, ((Direct3DRenderer *) renderer)->getD3DTexture(terrainRT));
复制代码


从这个例子中比较出的fps相差是‘相当’的大,大概x700p是6600的6倍左右吧
作者: niwei_123    时间: 2006-3-15 13:09
提示: 作者被禁止或删除 内容自动屏蔽
作者: RacingPHT    时间: 2006-3-15 13:35
提示: 作者被禁止或删除 内容自动屏蔽
作者: hourousha    时间: 2006-3-15 13:57
原帖由 RacingPHT 于 2006-3-15 13:35 发表
默认6600GT大概是47fps左右
不过帧率十分不稳定, 走一段就要lag一下。

PS: humus看来要发明太阳能手电筒了...

另: hourousha 的6600不是有问题么

后来调整了一下主板BIOS中关于PCIE部分的设置就没问题了,至少post VS cache运作是ok了,算了一下。单个VS的效率Nv4x似乎比R4xx要高一点,不过6600的rasterazation速度似乎很不理想——这倒不是很重要咯,70多M的速度也够了。
运行这个程序,6600(450:500)的fps在35左右,不时跳到18,19的样子(不走也跳)。而X700p则相当平稳,保持在190fps左右。

以下引自humus在B3D上的发言
Out of pure curiosity I implemented VTF too, which was pretty straightforward. So it should run on GeForce 6 and up too now. Performance nowhere close to R2VB though. The 6600 got 27fps, compared to 272fps on an X850XT

作者: RacingPHT    时间: 2006-3-15 14:15
提示: 作者被禁止或删除 内容自动屏蔽
作者: niwei_123    时间: 2006-3-15 14:21
提示: 作者被禁止或删除 内容自动屏蔽
作者: RacingPHT    时间: 2006-3-15 14:31
提示: 作者被禁止或删除 内容自动屏蔽
作者: P2MM    时间: 2006-3-15 15:47
哈哈哈哈哈 超级牛人:thumbsup:
作者: P2MM    时间: 2006-3-15 22:24
拿X1600Pro跑了一下,分辨率1280x1024:a)



作者: 太虚公    时间: 2006-3-15 22:46
E文看死人的
等大量回帖看中文
作者: RacingPHT    时间: 2006-3-22 10:21
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 POPPUR爱换 (https://we.poppur.com/) Powered by Discuz! X3.4