Sign in to follow this  

printscreen doesnt actually grab everything?

This topic is 4133 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I'm having intermittent problems with the printscreen function in windows capturing partially rendered frames. I initialize fullscreen Direct3D (9c+MDX1.1) in the usual way... and typically render with vsync disabled, (so I can see how much 'excess' perf i have left to take up with cool stuff). When I take a screen capture, I sometimes only get some batches actually impacting the scene. Its always the last few batches rendered that dont get in the image. Other games (other than mine) dont seem to suffer from this. If I'm doing something dumb, can you point me in the right direction to solve this? Thanks Chris

Share this post


Link to post
Share on other sites
Thanks, but that doesnt solve my problem.

I'm well aware of being able to implement my own screenshot functionality using offscreen tricks.

What I want, is to be able to use the windows printscreen functionality, and not have it screw up.

I thought the problem could be that my app was drawing directly to the front buffer (which would have been really dumb, and probably not even possible anymore ;P)... because that's the effect I get. However, I have a normal swap chain, automagically created by D3D. The problem is just as apparent when using an *extra* back-buffer (for decoupling the present rate from the monitor refresh without tearing).

It seems to be worse when the framerate is very high (700-900 fps is possible in particularly boring scenes in my engine, and I frequently have bits of the image missing in these cases)

If vsync is on, then it doesnt happen *nearly as much*, but then my app is sitting around blocking on IDirect3DDevice9::Present() for a good chunk of the time :)

Does anyone actually know anything about how printscreen interacts with fullscreen D3D, and *why* it might be doing this.

Regards,
Chris

Share this post


Link to post
Share on other sites
Quote:
Original post by sirob
Sounds like regular tearing to me. That's what VSync is for -- to eliminate tearing.

Tearing is only a visual artifact due to the way the screen refreshes. In memory there is only ever one active frontbuffer, which (should) be copied when you press printscreen. It is impossible to 'capture' tearing via a screengrab/printscreen.

Share this post


Link to post
Share on other sites
Hi, and thanks for your suggestion, although I assert that you are wrong.

It's not the same as tearing. Tearing only affects the perceived result on a monitor, and is caused by updating the image in the front buffer, while the raster is partway through updating it.

Let me reiterate what's going on:

1. I am running my engine in fullscreen. Everything is rendering correctly.
2. I press 'print screen', and then quit the game.
3. I paste the clipboard image into my favorite image editor (photoshop if its open, otherwise paint)
4. WHOLE OBJECTS ARE MISSING FROM THE SCENE. Sometimes, things that are drawn last, like the GUI, are completely missing.

Does anyone have any real suggestion as to why this is happening, and how to fix it?

Regards,
Chris

Share this post


Link to post
Share on other sites
As you say, if you've got a backbuffer then this shouldn't happen. I can only guess (just a guess though) that you have some kind of external app which is capturing the print screen key and doing a custom (and broken) implementation of print screen.

Possibly not a very helpful suggestion: but does the same problem occur with the referance renderer?

Share this post


Link to post
Share on other sites
Hi OrangyTang;

I considered that...

So, clean system:

Windows XP SP2
Visual Studio 2005
DirectX SDK June 2006
nVIDIA 91-series drivers for 6800GT

Still does it.
I thought it might have something to do with the nview desktop management, but it makes no difference whether its on or off - sometimes, things are missing.

I have observed it doing the same thing on a number of machines, so I assume its some caveat in the device initialization.

Changing SwapEffect doesnt appear to affect it, nor does changing the backbuffer count.

Any other ideas?

(It also used to happen with my old radeon, so its not just these new nvidia cards/their drivers)

Regards,
Chris

Share this post


Link to post
Share on other sites
Is this only occurring if your framerate is exceedingly high? Does the problem still occur if vsync is enabled?

This is pure speculation, but I'd guess it may be possible for the "copy to clipboard" operation to grab corrupted data if the front buffer becomes the back buffer and gets cleared by your code before the copy operation completes.

Apologies for the first suggestion, but reading "other games" I assumed you were wondering how other games implement screen captures.

Share this post


Link to post
Share on other sites
By 'other games', i mean, that when you hit printscreen, it just does the Right Thing, and puts the current screen image on the clipboard.

Games having custom screenshot functions seems like a hack around this.

Is it something you've encountered?

Yes, exceedingly high framerates seem to make it worse.

Its not like I'm getting corruption of the image. It's like im getting the backbuffer instead, with whatever batches have already been committed, and the others missing.

-Chris

Share this post


Link to post
Share on other sites
The granularity of the missing stuff seems to be a *batch*, which is kind of weird.

Typical examples are that either my entire GUI is missing,
or the scrollable regions of my listboxes are missing (seperate batch, to allow hardware clipping to help)... or missile trails & other particles.

Surely someone else has encountered this, or do you not take screens of fullscreen D3D apps?

I suppose its plausible there's something in your device creation that you do "because thats how you do it", that may have long ago been a voodoo chicken maneuver to get rid of this problem.

-Chris

Share this post


Link to post
Share on other sites
Quote:
Original post by Qatal
Games having custom screenshot functions seems like a hack around this.
Then I think you'll find that there are a LOT of games out there with this 'hack' in them. The standard Windows way of capturing the screen image simply will not work in many 3D games, without special coding to render the frame to an offscreen buffer. Windows cannot synchronise its image capturing with your program's constant re-rendering of the scene. Many games implement their own screen capturing for precisely this reason, even if they intercept the usual print-screen keypress to make it look like its running the standard Windows code to do it, it quite possibly isn't.

The advice given by richardurich is what you should follow, as he really does seem to know what he's talking about.

When it comes to capturing images of programs that render to an 'overlay' then it gets even worse. You a big black rectangle where the image would be, every time. Try taking a screenshot of your desktop with a DScalar running windowed on it for example! Such are the limitations of Windows' screen capturing.

Share this post


Link to post
Share on other sites

This topic is 4133 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this