Welcome, Guest.
Username: Password: Remember me

TOPIC: Is it possible to make Effect take a screenshot?

Is it possible to make Effect take a screenshot? 1 year 1 month ago #1

Hi everyone,

I've been working with ReShade 1.1 for a while now and am finally updating to the newest version (ReShade 3.0.5 as of this moment). I'm relearning a little bit of stuff for the new modular setup for ReShade 3 and as part of that I'm picking up some old works in progress, updating them for use with ReShade 3, and continuing some unfinished work on them.

For a part of that, one thing I am trying to work on is meant to compare one frame to another, but not necessarily 2 consecutive frames. This may not be possible with the current set up for ReShade, but if it is, then I want to try and get a few things working for that.

Now from MotionBlur I know that I can (at least temporarily) save one frame to a RenderTarget texture and then call that texture later. How long does this persist? I believe that it only persists from one frame to the next, because each frame is processed through the effects again, and the effect would then save and overwrite the texture each time.

So what I'm thinking of possibly trying is to make my effect save a screenshot output. I know we can load image files (or at least used to be able to) using the syntax:
texture   textureName  < string source = "relativeFilePath/fileName.extension";  	> {Width = specifiedWidth;Height = specifiedHeight;Format = textureFormat;};
But I think that this would have the same problem as simply using an internal texture, in that it would be overwritten each frame when the effect is processed. And then it would have the added problem of the slowness of saving a screenshot.

Nevertheless, if it is possible to make an effect save a texture (screenshot, basically), and save it to a file output, I'd like to know how to do this.

Also, is there currently any way to save basic data, such as a text parameter of some sort, to an external file and load it back in? Is there any way to preserve variable data from one runtime to another through file IO?

Any info/insight regarding these issues is appreciated.

Thanks,
Drake
Last Edit: 1 year 1 month ago by DrakePhoenix.
The administrator has disabled public write access.

Is it possible to make Effect take a screenshot? 1 year 1 month ago #2

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2910
  • Thank you received: 1683
Texture are stored for as long as ReShade is loaded and are not overwritten unless you explicitly tell ReShade to do so (e.g. by writing to it in a render pass). They persist frames. It is not possible to save texture data to a file however. Only way to achieve this would be to add a toggable technique that simply prints the texture content to the screen, so you can save it via a screenshot.
Cheers, crosire =)
The administrator has disabled public write access.

Is it possible to make Effect take a screenshot? 1 year 1 month ago #3

OK, then. But the problem I see with the persistence of textures is that as soon as an effect Technique that assigns content/value to a texture runs again, then it will change/update the texture. Since effects run every frame, how do get a texture to persist content for more than one frame change? Per REFERENCE.md there doesn't appear to be a way to access time-based functions to try and make a delayed process based on something like the mod of current system time being equal to a certain value (for one otherwise possible option in C++ or C#). The apparent limitations of HLSL are annoying me a little, but nothing to be done I suppose. Unless you have any suggestions.

Anyway, thank you for the response and the info.

Drake
The administrator has disabled public write access.

Is it possible to make Effect take a screenshot? 1 year 1 month ago #4

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2910
  • Thank you received: 1683
You can achieve something along those lines by setting a timeout on the technique that should do single-frame-processing. This will ensure it's only called once and then immediately disabled.
technique WriteToTextureOnce < enabled = true; timeout = 1; >
{
    pass { ... }
}
Cheers, crosire =)
The administrator has disabled public write access.
The following user(s) said Thank You: DrakePhoenix

Is it possible to make Effect take a screenshot? 1 year 1 month ago #5

Ah, ok, that makes sense then.

Thanks very much crosire :)

Drake
The administrator has disabled public write access.