A way to manipulate the screen after everything got rendered?

Started by Monsieur OUXX, Thu 04/06/2020 12:12:49

Previous topic - Next topic

Monsieur OUXX

I was thinking of the best way to apply some sort of shader. In other words : The requirement is to scan the pixels of the screen after it's been rendered, and write some new values into the buffer.

- It has been done in the past, with the "underwater" module. This module boldly reconstructs the entire scene (background+objects+characters) in what is effectively a "software" render routine that substitutes itself to AGS' native rendering. Pretty costly in terms of cpu. Also I'm not sure if the game's variables have been updated at this point in time so there might be a one-frame delay. Not too noticeable but kinda sloppy.
- The screenshot feature only exports to a file,
- And using late_repeatedly_execute places you at the right moment in the frame's lifecycle but you don't have a way of accessing the buffer.

So what am I missing? Is there a way of doing that?
 

Crimson Wizard

#1
DynamicSprite.CreateFromScreenShot is probably what you may use. But iirc it IS 1 frame late, because it's created out of data prepared during previous render. This is most of what you can get in script.
EDIT: back in a day there was no "later_repeatedly_execute", guess this is why it was made so (and also because it works faster this way). Hypothetically, I think, it may be possible to reimplement this with an up-to-date render if called from late_rep_exec, but such feature does not exist right now.

But I'd like to also clarify some technical stuff. There's no universal raw "buffer" that you can alter. Such buffer is implementation specific, and technically only exists in software mode. Plugins can access and alter it directly, but it does not work the same with Direct3D/OpenGL. The universal method would be not to alter rendered image in-place, but insert items in the render process / change render properties.

Monsieur OUXX

Quote from: Crimson Wizard on Thu 04/06/2020 12:35:10
DynamicSprite.CreateFromScreenShot is probably what you may use. But iirc it IS 1 frame late, because it's created out of data prepared during previous render. This is most of what you can get in script.
EDIT: back in a day there was no "later_repeatedly_execute", guess this is why it was made so (and also because it works faster this way). Hypothetically, I think, it may be possible to reimplement this with an up-to-date render if called from late_rep_exec, but such feature does not exist right now.

But I'd like to also clarify some technical stuff. There's no universal raw "buffer" that you can alter. Such buffer is implementation specific, and technically only exists in software mode. Plugins can access and alter it directly, but it does not work the same with Direct3D/OpenGL. The universal method would be not to alter rendered image in-place, but insert items in the render process / change render properties.

Thanks
 

SMF spam blocked by CleanTalk