Performance problems with render to texture method

Nibbie
Posts: 1
Joined: 2010.06
Post: #1
My game currently gets a solid 60 fps. I want to be able to take the current screen of the game and apply some effects to it (like warping). To do this I am using an FBO to render everything to a texture, and then drawing that texture to the screen.

However, as soon as I do this my fps drops to around 50, which due to the fact that I am using CADisplayLink to drive my render loop is the same as the game doing 30fps.

The texture I am rendering to is 1024x1024 since I am mostly developing for the iPad right now (haven't tested on the iPhone yet).

Does this seem right? Should the fps really drop that much just to render to a texture and then render the texture?

Are there any common pits that people fall into when doing render to texture? I have blending turned off ... anything else?

Thanks
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #2
You can't realistically expect rendering to occur at 60 FPS if you are trying to draw anything interesting. The more you make it do, the more it gets bogged down in processing, the less it can draw. If you skip one frame because you couldn't draw in time, you instantly drop down to something less than 60, right? So really, you need to update your game at a constant rate, but draw whenever the opportunity arises. See:

heh and heh
Quote this message in a reply
Member
Posts: 166
Joined: 2009.04
Post: #3
mbw234 Wrote:My game currently gets a solid 60 fps. I want to be able to take the current screen of the game and apply some effects to it (like warping). To do this I am using an FBO to render everything to a texture, and then drawing that texture to the screen.

However, as soon as I do this my fps drops to around 50, which due to the fact that I am using CADisplayLink to drive my render loop is the same as the game doing 30fps.

The texture I am rendering to is 1024x1024 since I am mostly developing for the iPad right now (haven't tested on the iPhone yet).

Does this seem right? Should the fps really drop that much just to render to a texture and then render the texture?

Are there any common pits that people fall into when doing render to texture? I have blending turned off ... anything else?

Thanks

That's normal ... rtt targets will drop your FPS by about 5-7 just for having one, regardless of your render complexity.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #4
You are using a lot more fillrate by doing that RRT pass, so it is expected that it would drop some.

I disagree that it's impossible to do anything interesting at 60fps. Twilight Golf used a ton of fillrate to do it's shadow effects and we are able to get a pretty solid 60fps on the 3GS and 40-60 on earlier devices depending on the level.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #5
Skorche Wrote:I disagree that it's impossible to do anything interesting at 60fps. Twilight Golf used a ton of fillrate to do it's shadow effects and we are able to get a pretty solid 60fps on the 3GS and 40-60 on earlier devices depending on the level.

Stutter stutter stutter on my first gen iPod Touch on many levels. Rolleyes
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #6
My point wasn't that you can't do anything at 60 FPS. My point was that you need to learn to compensate for when you can't. Mad <-- sorry, does this look like frustration? ... if you are trying to do something that causes you to skip a frame, you skip a frame. That means you aren't drawing at 60 FPS anymore. What part of that concept did I not convey?
Quote this message in a reply
Member
Posts: 129
Joined: 2009.03
Post: #7
I got 60 FPS and used RTT, two things that helped were:

1. Not using a big texture. I split my background up in to a grid of smaller RTT textures (128px * 64px), that I only render to if something changes. Rendering to bigger textures caused a drop below 60 FPS.

2. I render my textures to the back buffer without using any kind of alpha blending. Someone adviced me this wouldn't make a difference, but it did!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  iPad,render to texture, low framerate ldynasa 0 2,547 Nov 13, 2010 12:34 AM
Last Post: ldynasa
  Render to texture failing headkaze 7 7,439 Sep 1, 2010 09:47 PM
Last Post: headkaze
  Texture performance JPvdB 5 3,070 Feb 22, 2010 12:49 PM
Last Post: cmiller
  Render to texture performance iPhoneGG 2 3,728 May 18, 2009 03:31 PM
Last Post: ShiftZ
  OpenGl ES Texture Problems jhbau1000 4 4,155 Mar 24, 2009 02:41 PM
Last Post: AnotherJake