Advertisement

glCopyTexImage2D()

Started by December 27, 2005 11:11 PM
5 comments, last by taupehead 18 years, 9 months ago
glCopyTexImage2D() causes a huge performance hit for me when trying to copy to a resolution outside of 256x256. even something like 512x256 will cause severe slowdown. i may just be stuck with this, because my card is only a tnt2 32mb, but it just seems weird. it seems like too much of a performance hit going from 256x256. i'd like to know if i'm doing something wrong or if there's any way around this.
glCopyTexImage2D() is not a wonderous thing that will allways work at lighting speed.
No, it's acturaly something that is not that great in terms of realtime rendering, and should only be used for screen shots and the like.

a coupple of things happens when you call it.

1. it has to wait for the gpu to finnish. <- this is bad
2. it transfers the data from the backbuffer to an array trough an non optimal interface, thus stalling the gpu. <- = bad
3. it converts the array to a texture and stalls the gpu further. <- still bad
4. it causes a statechange and further stalls the gpu slightly. <- bad but not that bad.

And you do this on a TNT2 card with only 32MB, it's like asking for an ass whipping.
And yes your stuck with it, try to find a way around using this, is it absolutley nessesary to do it at all.
FBO perhaps if it works with your card.
Advertisement
thanks. i don't think a tnt2 supports FBO. i want to do filter effects, depth of field, faked motion blur, etc. so i'm trying to preserve the exact quality of the display. i was thinking of stringing together multiple 256 or 128 copies of the screen as an overlay, hoping that would be faster. but i haven't tried it yet, and now i'm guessing not. the only other option i know of is using glAccum, but this is even worse for perfomance with my setup. hopefully there are other options.
like for example, is it possible to AND/OR (or whatever) the new framebuffer to the previous, without using the accumulation buffer? i know that my card is hopelessly outdated, but when i look at a game like the original psx metal gear solid, i'm wondering how they pulled off all those framebuffer effects. of course in that case, the game is running in 320x240 with highly optimized code. i guess at that resolution this might be possible for me, but i'd rather 640x480.

edit: now that i've asked that, i realize that if i didn't clear the framebuffer each pass it would accomplish something like that, but i couldn't store it. i really don't know what to do.

[Edited by - taupehead on December 28, 2005 1:12:49 PM]
here's a more direct question: does anyone know how effects like thermal-optic camouflage, motion blur, bloom and depth of field are done on the ps2's hardware in a game like metal gear solid 2? i have know idea how limited the ps2 is, or how comparable it is to what i could do on my setup, but these are the things i want.

focusing on the optic camo, how is the envrionment offset achieved? through a clipping method, rendering to textures, or what?

i've asked questions like this before, which is why i started messing with rendering the framebuffer, but i'm pretty lost.
The ps2 uses a something close to a GF2 or 3 i think but with some slightly different stats, and it is allso optimized for use in a console, so i would persume that it has some kind of feedback or something like that enabeling you to capture a screen pretty fast, perhaps even to use the front buffer as a texture since the ps2 is a little limited in it's memory (hint: an upgraded N64 has more gfx memory than the ps2).

I have never played MSG2, but i have skimmed across a few screens, and the only "thermo optics" i saw there used only a clever use of cliping with the stencil buffer, and some nifty textures.
Infact most games have never used render to texture until the last year or so with the arival of the third generation FPS game enignes (the first one out there was doom3).

Most console game makers do cheat in the most ingenious ways, like placing a static particle system where you know there will be a bloom effect, or mixing prerenderd video with 3d to make pretty explotions, or making use of carefully made textures.

For the TNT2 there are not that many options, perhaps p-buffers might work, but they are a hassle to work with.
this page has a p-buffer demo on it, if it runs, your good to go.
http://www.paulsprojects.net/opengl/rtotex/rtotex.html
If not then your more or less out of options(your working with a tnt2), and you have to start wondering, can't i get an old gf2 or something somewhere for less than free. :)

[Edited by - lc_overlord on January 1, 2006 6:19:38 PM]
Advertisement
i'm slowly working my way toward a new rig, but it's not happening very soon. i might just settle for a lower resolution, because i'd rather have these effects than not. and unfortunately my card doesn't support FBO's or the p-buffer.

most of mgs2's framebuffer effects are (real-time) cutscene-only. it uses bloom, motion blur, a more-or-less unique DOF effect, and whatever else. the most heavy use of these effects during actual gameplay comes in underwater sequences. also in-game there's a subtle motion blur effect for character motion in certain instances. i'm not sure how it's done, but it uses an interlace effect as best as i can describe. i can't remember how the stealth camo looks in-game, but in cutscenes here's an example:
http://img.gamespot.com/gamespot/images/screenshots/ps2/metalgearsolid2/mgs2_0223_screen019.jpg

not the best example, but does that use the stencil buffer? that's one thing i've been looking into trying because it works so much faster. the only question there is if it can be used for bloom effects, etc. the motion blur in that screen also looks physical, rather than a frame effect, but i don't know. i'll have to take another look with the document of mgs2 (which features all of the cutscenes from the game in pausable form with complete camera control). from this i know that the game definitely uses bloom and some motion blur in a real-time overlay, even during cutscenes.

whether or not these effects truly come from render to texture, i don't know, but that brings me to another question. are the glReadPixles, glCopyPixels and glDrawPixels functions somehow faster than using glCopyTexImage2D and texture binding?

i really admire the way mgs2 looks in almost every aspect, which is why i always mention it.

and here's an example of the interlacing effect during gameplay that i mentioned earlier: http://ps2media.ign.com/media/previews2/image/mgs2/mgs2final_2.jpg

[Edited by - taupehead on January 4, 2006 11:25:04 AM]

This topic is closed to new replies.

Advertisement