Saving images with different resolution/sampling than displayed window? #1007
Replies: 5 comments 1 reply
-
You can combine multiple RenderGraph (one for main Window, and one for offscreen render) within one CommandGraph, or use multiple CommandGraph, they all can share the same Device. The vsgrendertotexture is probably a better place to start than trying to create vsgheadless, though the screenshot side will still be helpful. As a general rule you'll want to avoid using multiple vsg::Device as it's far more efficient to use one vsg::Device per physical device, as most systems just a single GPU this is best. If you want to take the screenshot occassionally rather than one every frame you can decorate the vsg::RenderGraph with a vsg::Switch and use it to toggle on/off traversal of the RenderGraph. |
Beta Was this translation helpful? Give feedback.
-
I submitted a new example named |
Beta Was this translation helpful? Give feedback.
-
Thanks for the example. Changing the extents of an offscreen render will required a new vsg::Framebuffer to be allocated and assigned to the associated vsg::RenderGraph, and for the subgraph to rebuild any GraphicsPipeline's so that the new ViewportState extents are assigned. The vsgheadless example has a code path that does this so have a look at for reference. |
Beta Was this translation helpful? Give feedback.
-
OK, I think I have it working now. I do have a concern still that it looks like I had to add this code up-front to ensure that the screen capture works if I resize the window before doing the first capture. Maybe there's a better way?
Despite that, this MR is ready to be reviewed or accepted. Thanks again @robertosfield ! |
Beta Was this translation helpful? Give feedback.
-
See my note about the example I have now: vsg-dev/vsgExamples#274 (comment) I took out the supersampling (kept the MSAA) and fixed up the camera sharing between the display and offscreen renders. The question of why the code below the "ensure the offscreen renderGraph is connected" comment is required still stands, but the example is ready to be reviewed. |
Beta Was this translation helpful? Give feedback.
-
I am trying to save an image of a scene that is rendered to the screen using vsg::Window but with a different resolution using a different level of multisampling. I started with the vsgscreenshot example, however I think a whole new
RenderPass
is required and so, I restarted from the vsgheadless example with a second device (enabled in VSG with VSG_MAX_DEVICES=2). I tried creating a second vsg::Viewer with it's own CommandGraph but with the same sceneGraph and camera however I get a segfault where a DescriptorSetLayout is null when compiling the PipelineLayout. I'm working up an example at the moment, but I thought I'd post here now in case I'm doing something obviously wrong or if there is a better way for saving an image (not just a pixel-for-pixel copy of what is displayed on the screen).Beta Was this translation helpful? Give feedback.
All reactions