Multitexturing Performance
Oh my GOD! Am I correct in saying multitexturing is expensive? I used two texture units on 132,000 polygons GL_TEXTURE0_ARB and GL_TEXTURE1_ARB and I went from 115fps to 44fps! and when I added in the thrid unit 24fps! Ouch!
That sounds a bit extreme... are you using a texture shader of some sort or just texture_env_combine? What card? How big are your textures? What are the texture filter modes?
Quote:Originally posted by OneSadCookie
That sounds a bit extreme... are you using a texture shader of some sort or just texture_env_combine? What card? How big are your textures? What are the texture filter modes?
No texture shaders, just standard
Code:
glTexEnvf(GL_MODLUATE) and
float largest_supported_anisotropy;
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &largest_supported_anisotropy);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, largest_supported_anisotropy);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, imageWidth, imageHeight, GL_BGRA_EXT, GL_UNSIGNED_BYTE, imageData);I am using Anisotropic filtering, as you can see. 9700Pro 128MB, 512x512 textures and I have about 13 of them. Also I get a value of 8 on my maxtexture units for the 9700Pro card. I read on OpenGL.org that the value returned is not guarented? So ATI's page I think says 16 texture units? But when I goto GL_TEXUTRE8_ARB I get nothing so I am thinking it has 8. I am using a display list. I also have 1 light enabled.
My guess is that it's the anisotropy killing you. Try turning it off and see what difference that makes.
Nope, I only gained 7fps by turning off the filtering? I now have only two units running and doing multitexturing on my water and my fps went from 73fps to 24fps? Their is only two units running. Would doing a glBindTexture() over and over to reassign a new texture for someother polygons on the same unit case a performance hit?
When you disable the texture units what is the correct way?
When you disable the texture units what is the correct way?
Code:
glDisable(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE0_ARB);
// or
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_2D);
I get similar performace drops with multitexturing, it actually runs faster if I just use two passes. (GF3)
Quote:Originally posted by David
I get similar performace drops with multitexturing, it actually runs faster if I just use two passes. (GF3)
What you mean by two passes is
Code:
drawPolygon();//polygon #1 vertex and texture #1data
drawPolygon();//polygon #1 vertex and texture #2 data
//vs
drawPolygon(); //polygon #1 vertex and mulittexture unit 1 and unit 2 data
Calling bindTexture over and over probably will be a significant performance hit.
I'll tell you it's not multitexturing causing your problem, because Quake III runs at more than 24FPS on your system, and that multitextures virtually every polygon.
I'll tell you it's not multitexturing causing your problem, because Quake III runs at more than 24FPS on your system, and that multitextures virtually every polygon.
Quote:Originally posted by OneSadCookie
Calling bindTexture over and over probably will be a significant performance hit.
I'll tell you it's not multitexturing causing your problem, because Quake III runs at more than 24FPS on your system, and that multitextures virtually every polygon.
I wouldn't think so either. Not with the hardware I am running. I am trying to nail it down to what is causing me my headaches. I have a list of my terrain and added in multitexturing to that and killed my fps by half again.
What is the correct syntax for glDisable() on the mulittexture units? I am using glDisable(GL_TEXTURE_2D);
Back to work!:
There is a point of minimizing returns with multitexture. In Quake3 on my GF3 I get almost double the FPS in low resolutions with multitexturing disabled. At high resolutions (>1024x768) multitexture is faster than multiple passes.
I'm guessing multitexture only shows an improvement once the card is fill limited, otherwise muti-pass is just as fast (or faster), assuming the scene is drawn minimizing texture binds.
I've gotten similar results in my own apps, so the only conclusion I've come to is that you should have a multitexture path in your app, but also include a multi-pass path and a user toggle.
I'm guessing multitexture only shows an improvement once the card is fill limited, otherwise muti-pass is just as fast (or faster), assuming the scene is drawn minimizing texture binds.
I've gotten similar results in my own apps, so the only conclusion I've come to is that you should have a multitexture path in your app, but also include a multi-pass path and a user toggle.
Well I just finished implementing multipass and multitexturing into the engine and multipass is faster! Why? I get 42fps with multipass and 24 with multitexturing? Also if I go up in resolution I lose fps and if I go down I gain some but not huge. e.g. 1280x1024 is where I am running at is 77fps and 1024x768 is 88 or so.
Now get this if I use multitexturing and enable lights or disable lights I get a cool 22fps! Wow!
Now get this if I use multitexturing and enable lights or disable lights I get a cool 22fps! Wow!
Run it through OpenGL Profiler and it will tell you EXACTLY what is going on instead of all the guessing that is currently the case.
Quote:Originally posted by henryj
Run it through OpenGL Profiler and it will tell you EXACTLY what is going on instead of all the guessing that is currently the case.
Trust me when I say this "I wish I could". I don't have a Mac right now. I am waiting on a G5 PowerMac. I sold my G4 so I could get the most money for it just before WWDC. I am using a PCee. I doubt their are any apps that work on the PC like OpenGL profiler. Instead of doing nothing with my time until I get another Mac I am coding my engine on the PC until I can get a Mac.
I am going to ask this because I am unsure but am thinking I might be hitting a fill limit? So if someone with more knowledge on this could comment on it that would be great. I am rendering a 256x256 map with GL_TRIANGLE_STRIP so thats 132,000 polygons correct? Now I am using glMultiTexCoord2fARB() to multitexture my terrain with two tex units. I am doing the same for my water but thats around 20,000 polygons. The terrain is in a display list and I got 22fps, I took it out of the display list and got 22fps? Then I reduced the map size to 128x128 and my fps jumped to around 70fps? So is this suggesting I have already hit my fill amount on a Radeon9700Pro?
This is how I do it in Mosquito Fighter, and performance drop is not very dramatic, but I never use more than 3 passes so far.
GLInt arbID [] = { GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_TEXTURE2_ARB, GL_TEXTURE3_ARB };
for(i=ni; i>0; i--) {
glActiveTextureARB( arbID[i] );
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture );
DrawObject();
}
for(i=ni; i>0; i--) {
glActiveTextureARB( arbID[i-1] );
glDisable(GL_TEXTURE_2D);
}
GLInt arbID [] = { GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_TEXTURE2_ARB, GL_TEXTURE3_ARB };
for(i=ni; i>0; i--) {
glActiveTextureARB( arbID[i] );
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture );
DrawObject();
}
for(i=ni; i>0; i--) {
glActiveTextureARB( arbID[i-1] );
glDisable(GL_TEXTURE_2D);
}
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Can't get multitexturing to work | Coyote | 4 | 3,380 |
Nov 16, 2009 11:48 PM Last Post: arekkusu |
|
| Using glTexCoordPointer with multitexturing | TomorrowPlusX | 6 | 11,673 |
Dec 5, 2006 09:42 AM Last Post: NYGhost |
|
| Lighting and Multitexturing problem | Scribendi | 0 | 2,312 |
Sep 25, 2005 09:22 PM Last Post: Scribendi |
|
| OpenGL Multitexturing Details w/Alpha | WakingJohn | 22 | 9,690 |
Dec 4, 2004 10:52 AM Last Post: WakingJohn |
|
| Sparseness of Multitexturing documentatin in Red Book | WhatMeWorry | 2 | 2,884 |
Nov 10, 2004 01:54 PM Last Post: arekkusu |
|

