SpiderPig Posted April 29 Share Posted April 29 If I capture a screenshot with framebuffer->Capture(), is there a way I get the result within a shader without first getting it as a pixmap, then converting it to a texture, then giving it to a material? if (window->KeyHit(KEY_SPACE)) framebuffer->Capture(); auto caps = framebuffer->GetCaptures(); for (auto pixmap : caps) { auto path = GetPath(PATH_DESKTOP) + "/screenshot.jpg"; pixmap->Save(path); RunFile(path); } Maybe something like this might be possible? FRAGMENT SHADER if (capture_result_handle != -1){ vec4 capture_color = texture(capture_result_handle, frag_coords) } Quote Link to comment Share on other sites More sharing options...
Josh Posted April 30 Share Posted April 30 Can't you just use camera->SetRenderTarget to render to a texture? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted April 30 Author Share Posted April 30 Not really, I want to capture a screen shot before I open my inventory and then use that result as a background for my inventory that will be blurred. Like the window transparent effect in the editor. It won't be real time but that's fine. I'm just worried about spending the time waiting for the capture to be ready as a pixmap and then going through all the conversion and re-upload to the GPU when it's already there. Quote Link to comment Share on other sites More sharing options...
Josh Posted April 30 Share Posted April 30 This would not be too difficult to do, if you just had a hook that got called in the right place... Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted April 30 Author Share Posted April 30 You mean like a render hook that displayed the inventory when the capture was ready for the inventory shader to use? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 15 Author Share Posted May 15 Is this something I can do now or are you needing to implement something for it to work? Quote Link to comment Share on other sites More sharing options...
Josh Posted May 15 Share Posted May 15 This would require changes to the engine. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted May 15 Author Share Posted May 15 Ah okay. No problem Quote Link to comment Share on other sites More sharing options...
klepto2 Posted May 15 Share Posted May 15 Just an idea, you can use 2 cameras for this. 1. the normal realtime camera 2. a non realtime camera where you set the rendertarget to a new TextureBuffer. to the second camera you you attach the blur posteffect and assign the colorbuffer from the first (original) framebuffer via SetUnifrom("color", fb->GetColorAttachment(0)). whenever you open the inventory, you render the second camera once and the Texturebuffer of the second camera will have the processed blurred image. This could be extended to also work in realtime. as the 2nd camera can be using a complete empty world or a comeplere unique renderlayer, so no processing power is lost. 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
SpiderPig Posted May 15 Author Share Posted May 15 This sounds like a good idea! Especially if it could be done real time. I'll see if I can get it working. Thanks! Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 15 Author Share Posted May 15 I don't think the framebuffer has a GetColorAttachment method Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 15 Author Share Posted May 15 But the camera rendering once with the blur post effect does work. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.