游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1649|回复: 4

How to optimize tile rendering?

[复制链接]

23

主题

63

帖子

68

积分

注册会员

Rank: 2

积分
68
发表于 2007-3-21 09:53:00 | 显示全部楼层 |阅读模式
I am developping a 2D tile-based game with dx9 and get a headache.
My map(1024*768) consists of many tiles. If I call drawprimitive for each tile to draw it directly to the backbuffer, a performance penalty will hurt me. So now i create a surface(1024*768) and set it as the render target and call DrawPrimitives to draw every tile to this surface and after this I can draw this surface to the backbuffer with only one drawprimitive. But this needs a lot of video memory. If this game is running on a computer with a graphic card of less than 64M, the surface can`t be created, and some strange effect will be met.
So any of U have any suggestion for me. Thanks a lot!

10

主题

69

帖子

69

积分

注册会员

Rank: 2

积分
69
发表于 2007-3-21 10:44:00 | 显示全部楼层

Re:How to optimize tile rendering?

how many vertex(the max numbers) be used in one render target?

3

主题

89

帖子

89

积分

注册会员

Rank: 2

积分
89
QQ
发表于 2007-3-21 12:27:00 | 显示全部楼层

Re:How to optimize tile rendering?

Using an intermediate render target is equal to rendering directly to back buffer.
Tiles which share same source image can be rendered together.
Use DrawPrimitivesUP to render dynamic vertex arrays consists of several quads. The bandwidth is sufficient to transfer small amount of vertices.
Small source images can be merged into large textures (i.e. 1024x1024, MANAGED POOL recommended) to reduce DrawPrimitivesUP calls.

8

主题

716

帖子

716

积分

高级会员

Rank: 4

积分
716
发表于 2007-3-21 13:12:00 | 显示全部楼层

Re:How to optimize tile rendering?

It's not about vertics and RT. Too many DP called caused this issue.
For your reference:
1. atlas your all image of tiles
2. one vertex buffer of your scene used the same one texture with only different world position and uv
3. so you can render your 2d scene by few DP
4. draw these viewable tiles by camera (where you are)

Please hang over your bed:
25k batches/s @ 100% 1GHz CPU

8

主题

390

帖子

390

积分

中级会员

Rank: 3Rank: 3

积分
390
发表于 2007-3-21 17:37:00 | 显示全部楼层

Re:How to optimize tile rendering?

chiglish.wo xi huan.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-26 19:14

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表