[yt-users] Interactive Volume Rendering Screenshot

Nicole DyAnn Melso ndm2126 at columbia.edu
Tue Jan 2 13:28:20 PST 2018


Hello,



I am attempting to create a series of volume rendered images of my
simulation at different time steps so that I can compile them into a movie.
I want to use the maximum intensity fragment shader, which I believe is
only available in the yt interactive volume rendering with OpenGL (I've
looked into simply using a maximum intensity projection, but this is only
available on-axis). I would like to be able to take a screenshot of the
OpenGL window created when I run the yt interactive volume rendering, but
I'm having difficulty adding this feature to the volume rendering source
code in my local yt directory. Below is the modification I’ve made to the
code as well as a screenshot of the problem. I have no prior experience
with OpenGL.



*/yt/visualization/volume_rendering/interactive_vr.py*



846     def _retrieve_framebuffer(self):

847                    ox, oy, width, height = GL.
glGetIntegery(GL.GL_VIEWPORT)

848   +               my_buffer = GL.glReadBuffer(GL.GL_FRONT)

849    -               debug_buffer = GL.glReadPixels(0, 0, width, height,
GL.GL_RGB,    GL.GL_UNSIGNED_BYTE)

849    +              debug_buffer = GL.glReadPixels(0, 0, width, height,
GL.GL_RGB,    GL.GL_UNSIGNED_BYTE, my_buffer)

850                    arr = np.fromstring(debug_buffer, “unit8”, count,
width*height*3)

851                    return arr.reshape((width, height, 3))





*/yt/visualization/volume_rendering/interactive_loop.py*



187      def  __call__(self, scene, camera, callbacks):

188                  while not glfw.WindowShouldClose(self.window) or
self.should_quit:

189                              callbacks(self.window)

190                              if callbacks.draw:

191                                          camera.compute_matrices()

192                                          scene.set_camera(cameara)

193                                          scene.render()

194                                          glfw.SwapBuffers(self.window)

195                                          callbacks.draw = False

196   +                                     arr =
scene._retrieve_framebuffer()

197   +                                     write_bitmap(arr, “test.png”)

198                              glfw.PollEvents()

199                              yield self

200                              glfw.Terminate()


The simulation is a single rectangular box, but the screenshot I get with
the above code is multiple boxes that look like they should be overlaid?
Maybe there is a simpler method of accomplishing this? I'd appreciate any
suggestions.

Thanks,
Nicole Melso

-- 
Nicole Melso
NSF Graduate Research Fellow
Columbia Astronomy Department
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20180102/06ffd682/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 222357 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20180102/06ffd682/attachment-0002.png>


More information about the yt-users mailing list