<?xml version="1.0" encoding="utf-8"?>
<section version="5.0"
         xsi:schemaLocation="http://docbook.org/ns/docbook http://docbook.org/xml/5.0/xsd/docbook.xsd"
         xml:id="usage.rendering" xmlns="http://docbook.org/ns/docbook"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:ns="http://docbook.org/ns/docbook">
  <title>Rendering images and movies</title>

  <para>
    <informalfigure>
      <screenshot><mediaobject><imageobject>
      <imagedata fileref="images/rendering/render_tab.png" format="PNG" />
      </imageobject></mediaobject></screenshot>
    </informalfigure>
	  OVITO can produce images and movies for publications and presentations. This is done from the 
    <emphasis>Render</emphasis> tab of the command panel as shown on the right.
  </para>
  
  <simplesect xml:id="usage.rendering.render_settings">
    <title>Render settings</title>     
      <para>
      The rendering tab contains the <link linkend="core.render_settings">Render settings</link> panel, which lets you control various 
      aspects of image generation like the output resolution and the background color.
      The <guibutton>Render Active Viewport</guibutton> button starts the rendering process for the viewport that is currently active.
      OVITO will open a window to display the generated image, which can be saved to disk or copied to the clipboard.
      You can optionally specify an output filename beforehand in the <link linkend="core.render_settings">Render settings</link> panel, 
      under which the generted image or movie will be saved. 
    </para>
    <para>
      OVITO provides several different rendering engines you can choose from. The default one is the <link linkend="rendering.opengl_renderer">OpenGL renderer</link>, 
      which is also used by the interactive viewports for real-time display. This renderer is very fast and produces pictures that are more or less identical to
      what you see in the interactive viewports. An alternative option is the <link linkend="rendering.tachyon_renderer">Tachyon renderer</link>, a software-based
      raytracing engine. It can generate high-quality rendering including shadows, ambient occlusion shading and depth of field. But it typically takes much longer to 
      generate an image with this renderer. A third option is the <link linkend="rendering.povray_renderer">POV-Ray rendering backend</link>, which offloads the rendering to the external POV-Ray raytracing program,
      which must be installed on your computer.
      <informalfigure role="inline">
      <informaltable frame="none">
        <tgroup cols="2">
          <tbody>
            <row valign="bottom">
              <entry>OpenGL renderer:</entry>
              <entry>Tachyon renderer:</entry>
              <entry>POV-Ray renderer:</entry>
            </row>
            <row valign="top">
              <entry><mediaobject><imageobject><imagedata fileref="images/rendering/renderer_example_opengl.png" format="PNG" /></imageobject></mediaobject></entry>
              <entry><mediaobject><imageobject><imagedata fileref="images/rendering/renderer_example_tachyon.png" format="PNG" /></imageobject></mediaobject></entry>
              <entry><mediaobject><imageobject><imagedata fileref="images/rendering/renderer_example_povray.png" format="PNG" /></imageobject></mediaobject></entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>
      </informalfigure>
    </para>
  </simplesect>

  <simplesect xml:id="usage.rendering.animation">
    <title>Creating movies</title>     
    <para>
      When a simulation sequence has been loaded into OVITO, the program can render an animated movie of it and save it to a video file. 
      Select <guilabel>Complete animation</guilabel> in the <link linkend="core.render_settings">Render settings</link> panel and set a file name and encoding format for the 
      output video. OVITO's built-in video encoder supports common video formats such as AVI and MPEG. 
    </para>
    <para>
      To set the playback speed (frames per second) of the output video, click the <link linkend="animation.animation_settings_dialog">Animation settings</link> button.
      Alternatively, you can produce a series of image files, one per frame, and combine them to a video later using an external video encoding tool.
      More information on OVITO's animation capabilities can be found <link linkend="usage.animation">here</link>.
    </para>
  </simplesect>

  <simplesect xml:id="usage.rendering.show_render_frame">
    <title>Viewport preview mode</title>
    <para>
      <informalfigure><informaltable frame="none">
        <tgroup cols="2">
          <tbody>
            <row valign="bottom">
              <entry>Interactive viewport (preview mode):</entry>
              <entry>Rendered image:</entry>
            </row>
            <row valign="top">
            <entry><mediaobject><imageobject><imagedata fileref="images/rendering/show_render_frame_example.png" format="PNG" scale="40" /></imageobject></mediaobject></entry>
            <entry><mediaobject><imageobject><imagedata fileref="images/rendering/show_render_frame_output.png" format="PNG" scale="40" /></imageobject></mediaobject></entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable></informalfigure>
      To preview the precise area of the active viewport that will be visible in the rendered image or movie, you can activate
      the <menuchoice><guimenuitem>Preview Mode</guimenuitem></menuchoice> for this viewport. 
      This option can be found in the <link linkend="usage.viewports.menu">viewport menu</link>, which can be opened by clicking
      the viewport's caption in the upper left corner.
     </para>
   </simplesect>
  
</section>
