Maybe there's a way to implement a similar feature in Houdini? I'm imagining that the viewport exists somewhere as a GLWindow, we'd just need to get the frame buffer for that window, convert it to float color data, etc, as described in this function:
void saveImage(char* filepath, GLFWwindow* w) { int width, height; glfwGetFramebufferSize(w, &width, &height); GLsizei nrChannels = 3; GLsizei stride = nrChannels * width; stride += (stride % 4) ? (4 - stride % 4) : 0; GLsizei bufferSize = stride * height; std::vector<char> buffer(bufferSize); glPixelStorei(GL_PACK_ALIGNMENT, 4); glReadBuffer(GL_FRONT); glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer.data()); stbi_flip_vertically_on_write(true); stbi_write_png(filepath, width, height, nrChannels, buffer.data(), stride); }
How could one access the current GL Window for a viewport view via a script in Houdini? General thoughts on this kind of approach to quickly grabbing a screenshot for a viewport in Houdini?