I'm trying to simulate a specific effect: garry's mod crashing and a crash screen appearing.
This requires taking a screenshot of the player's screen using render.Capture (at least, that's the only way I found) and using using the resulting image information as a Material to draw in a panel.
Problem is, the only 2 ways I know of, to write information to a file, is either file_object:Write or file.Write, both of which only save information to the client in the DATA folder. The only folder you can read Material information from is the materials folder. I hope you see the dilemma.
Is there something I'm missing? Is saving a screenshot, then immediately attempting to use the screenshot as a Material, supposed to be off-limits, as I'm discovering?
The only other alternative I can think of is a Material or Texture function which accepts binary input (as that's how render.Capture saves the screen information), but digging through the wiki yielded no results.
Would really appreciate some help. I can provide my code as necessary.
render.Capture
Couldn't you just lock the player from moving the view etc, disabling all interactions with stuff and then drawing on top of that?
You can use materials in 'garrysmod/data' by doing 'Material("data/*")'.
Oh shit, I'll go ahead and try that. Wiki says Material looks in the materials folder for the file name, but maybe that's some kind of escape?
You could also look how motion blur shipped with the game does it.
SneakySquid had it.
My next problem is figuring out how to delete all the screenshots that get created.
file.Delete?
Or just use the method from https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/postprocess/motion_blur.lua and you don't have to write any files at all.
I think I may migrate to this instead. This method seems easier on the system and, once understood, appears to take less steps to complete.
I just have 0 idea how most of the render library works, or know how textures/materials work in-depth, so a lot of this is gonna be trial+error.
Thanks for the link, though.
RenderTarget renders player's viewport, but what if wanted to render HUD too?
Did not consider this, the HUD is wanted. I'll see how his suggestion works out. As it stands, it's working as a screenshot.
Sorry, you need to Log In to post a reply to this thread.