| 1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>8.10. Making a Movie</title><link rel="stylesheet" href="../xml/XSLCustomizationLayer/G4HTMLStylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="Geant4 User's Guide for Application Developers"><link rel="up" href="ch08.html" title="Chapter 8. Visualization"><link rel="prev" href="ch08s09.html" title="8.9. Polylines, Markers and Text"><link rel="next" href="ch09.html" title="Chapter 9. Examples"><script language="JavaScript">
|
|---|
| 2 | function remote_win(fName)
|
|---|
| 3 | {
|
|---|
| 4 | var url = "AllResources/Detector/geometry.src/" + fName;
|
|---|
| 5 | RemoteWin=window.open(url,"","resizable=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,width=520,height=520")
|
|---|
| 6 | RemoteWin.creator=self
|
|---|
| 7 | }
|
|---|
| 8 | </script></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">8.10.
|
|---|
| 9 | Making a Movie
|
|---|
| 10 | </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch08s09.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><th width="60%" align="center">Chapter 8.
|
|---|
| 11 | Visualization
|
|---|
| 12 | </th><td width="20%" align="right"> <a accesskey="n" href="ch09.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.MkMovie"></a>8.10.
|
|---|
| 13 | Making a Movie
|
|---|
| 14 | </h2></div></div></div><p>
|
|---|
| 15 | These instructions are suggestive only. The following procedures
|
|---|
| 16 | have not been tested on all platforms. There are clearly some
|
|---|
| 17 | instructions that apply only to Unix-like systems with an X-Windows
|
|---|
| 18 | based windowing system. However, it should not be difficult to take
|
|---|
| 19 | the ideas presented here and extend them to other platforms and
|
|---|
| 20 | systems.
|
|---|
| 21 | </p><p>
|
|---|
| 22 | The procedures described here need graphics drivers that
|
|---|
| 23 | can produce picture files that can be converted to a form suitable
|
|---|
| 24 | for an MPEG encoder. There may be other ways of capturing the
|
|---|
| 25 | screen images and we would be happy to hear about them. Graphics
|
|---|
| 26 | drivers currently capable of producing picture files are:
|
|---|
| 27 |
|
|---|
| 28 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td>
|
|---|
| 29 | <span class="bold"><strong>Driver</strong></span>
|
|---|
| 30 | </td><td>
|
|---|
| 31 | <span class="bold"><strong>File type</strong></span>
|
|---|
| 32 | </td></tr><tr><td>
|
|---|
| 33 | DAWNFILE
|
|---|
| 34 | </td><td>
|
|---|
| 35 | prim then eps using <span class="bold"><strong>dawn</strong></span>
|
|---|
| 36 | </td></tr><tr><td>
|
|---|
| 37 | HepRepFile
|
|---|
| 38 | </td><td>
|
|---|
| 39 | HepRep1
|
|---|
| 40 | </td></tr><tr><td>
|
|---|
| 41 | HepRep
|
|---|
| 42 | </td><td>
|
|---|
| 43 | HepRep2
|
|---|
| 44 | </td></tr><tr><td>
|
|---|
| 45 | OGLX
|
|---|
| 46 | </td><td>
|
|---|
| 47 | eps
|
|---|
| 48 | </td></tr><tr><td>
|
|---|
| 49 | RayTracer
|
|---|
| 50 | </td><td>
|
|---|
| 51 | jpeg
|
|---|
| 52 | </td></tr><tr><td>
|
|---|
| 53 | VRMLFILE
|
|---|
| 54 | </td><td>
|
|---|
| 55 | vrml
|
|---|
| 56 | </td></tr></tbody></table></div><p>
|
|---|
| 57 | </p><p>
|
|---|
| 58 | So far, only DAWNFILE, OGLX and RayTracer have been "road tested".
|
|---|
| 59 | Once in a standard format, such as eps, the
|
|---|
| 60 | <span class="bold"><strong>convert</strong></span> program from
|
|---|
| 61 | <a href="http://www.imagemagick.org" target="_top">
|
|---|
| 62 | ImageMagick
|
|---|
| 63 | </a>
|
|---|
| 64 | can convert to ppm files suitable for
|
|---|
| 65 | <span class="bold"><strong>mpeg2encode</strong></span>.
|
|---|
| 66 | </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.MkMovie.OGLX"></a>8.10.1.
|
|---|
| 67 | OGLX
|
|---|
| 68 | </h3></div></div></div><p>
|
|---|
| 69 | Make a macro something like this:
|
|---|
| 70 |
|
|---|
| 71 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 72 | /control/verbose 2
|
|---|
| 73 | /vis/open OGLSX 600x600-0+0
|
|---|
| 74 | /vis/drawVolume
|
|---|
| 75 | /vis/viewer/reset
|
|---|
| 76 | /vis/viewer/set/style surface
|
|---|
| 77 | /vis/viewer/set/projection perspective 50 deg
|
|---|
| 78 | /control/alias phi 30
|
|---|
| 79 | /control/loop movie.loop theta 0 360 1
|
|---|
| 80 | </pre></div><p>
|
|---|
| 81 |
|
|---|
| 82 | which invokes movie.loop, which is something like:
|
|---|
| 83 |
|
|---|
| 84 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 85 | /vis/viewer/set/viewpointThetaPhi {theta} {phi}
|
|---|
| 86 | /vis/viewer/zoom 1.005
|
|---|
| 87 | /vis/ogl/printEPS
|
|---|
| 88 | </pre></div><p>
|
|---|
| 89 | </p><p>
|
|---|
| 90 | This produces lots of eps files. Then...
|
|---|
| 91 |
|
|---|
| 92 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 93 | <a href="./make_mpeg2encode_parfile.sh" target="_top">make_mpeg2encode_parfile.sh</a> G4OpenGL_*eps
|
|---|
| 94 | </pre></div><p>
|
|---|
| 95 | </p><p>
|
|---|
| 96 | Then edit mpeg2encode.par to specify file type and size, etc.:
|
|---|
| 97 |
|
|---|
| 98 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 99 | $ diff mpeg2encode.par~ mpeg2encode.par
|
|---|
| 100 | 7c7
|
|---|
| 101 | < 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
|
|---|
| 102 | ---
|
|---|
| 103 | > 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
|
|---|
| 104 | 15,17c15,17
|
|---|
| 105 | < /* horizontal_size */
|
|---|
| 106 | < /* vertical_size */
|
|---|
| 107 | < 8 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */
|
|---|
| 108 | ---
|
|---|
| 109 | > 600 /* horizontal_size */
|
|---|
| 110 | > 600 /* vertical_size */
|
|---|
| 111 | > 1 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */
|
|---|
| 112 | </pre></div><p>
|
|---|
| 113 | </p><p>
|
|---|
| 114 | Then convert to ppm:
|
|---|
| 115 |
|
|---|
| 116 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 117 | for i in G4OpenGL*eps;
|
|---|
| 118 | do j=`basename $i .eps`; command="convert $i $j.ppm"; echo $command; $command; done
|
|---|
| 119 | </pre></div><p>
|
|---|
| 120 | </p><p>
|
|---|
| 121 | Then
|
|---|
| 122 |
|
|---|
| 123 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 124 | mpeg2encode mpeg2encode.par G4OpenGL.mpg
|
|---|
| 125 | </pre></div><p>
|
|---|
| 126 | </p><p>
|
|---|
| 127 | Then, on Mac, for example:
|
|---|
| 128 |
|
|---|
| 129 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 130 | open G4OpenGL.mpg
|
|---|
| 131 | </pre></div><p>
|
|---|
| 132 |
|
|---|
| 133 | opens a QuickTime player.
|
|---|
| 134 | </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.MkMovie.DAWNFILE"></a>8.10.2.
|
|---|
| 135 | DAWNFILE
|
|---|
| 136 | </h3></div></div></div><p>
|
|---|
| 137 | You need to invoke <span class="bold"><strong>dawn</strong></span> in "direct" mode,
|
|---|
| 138 | which picks up parameters from .DAWN_1.history, and suppress the GUI:
|
|---|
| 139 |
|
|---|
| 140 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 141 | alias dawn='dawn -d'
|
|---|
| 142 | export DAWN_BATCH=1
|
|---|
| 143 | </pre></div><p>
|
|---|
| 144 | </p><p>
|
|---|
| 145 | Change OGLSX to DAWNFILE in the above set of Geant4 commands and
|
|---|
| 146 | run. Then convert to ppm files as above:
|
|---|
| 147 |
|
|---|
| 148 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 149 | for i in g4_*.eps;
|
|---|
| 150 | do j=`basename $i .eps`; command="convert $i $j.ppm"; echo $command; $command; done
|
|---|
| 151 | </pre></div><p>
|
|---|
| 152 | </p><p>
|
|---|
| 153 | Then make a .par file:
|
|---|
| 154 |
|
|---|
| 155 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 156 | <a href="./make_mpeg2encode_parfile.sh" target="_top">make_mpeg2encode_parfile.sh</a> g4_*ppm
|
|---|
| 157 | </pre></div><p>
|
|---|
| 158 |
|
|---|
| 159 | and edit mpeg2encode.par:
|
|---|
| 160 |
|
|---|
| 161 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 162 | $ diff mpeg2encode.par~ mpeg2encode.par
|
|---|
| 163 | 7c7
|
|---|
| 164 | < 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
|
|---|
| 165 | ---
|
|---|
| 166 | > 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
|
|---|
| 167 | 9c9
|
|---|
| 168 | < 1 /* number of first frame */
|
|---|
| 169 | ---
|
|---|
| 170 | > 0 /* number of first frame */
|
|---|
| 171 | 15,16c15,16
|
|---|
| 172 | < /* horizontal_size */
|
|---|
| 173 | < /* vertical_size */
|
|---|
| 174 | ---
|
|---|
| 175 | > 482 /* horizontal_size */
|
|---|
| 176 | > 730 /* vertical_size */
|
|---|
| 177 | </pre></div><p>
|
|---|
| 178 | </p><p>
|
|---|
| 179 | Then encode and play:
|
|---|
| 180 |
|
|---|
| 181 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 182 | mpeg2encode mpeg2encode.par DAWN.mpg
|
|---|
| 183 | open DAWN.mpg
|
|---|
| 184 | </pre></div><p>
|
|---|
| 185 | </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.MkMovie.RyTrcX"></a>8.10.3.
|
|---|
| 186 | RayTracerX
|
|---|
| 187 | </h3></div></div></div><p>
|
|---|
| 188 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 189 | /control/verbose 2
|
|---|
| 190 | /vis/open RayTracerX 600x600-0+0
|
|---|
| 191 | # (Raytracer doesn't need a scene; smoother not to /vis/drawVolume.)
|
|---|
| 192 | /vis/viewer/reset
|
|---|
| 193 | /vis/viewer/set/style surface
|
|---|
| 194 | /vis/viewer/set/projection perspective 50 deg
|
|---|
| 195 | /control/alias phi 30
|
|---|
| 196 | /control/loop movie.loop theta 0 360 1
|
|---|
| 197 | </pre></div><p>
|
|---|
| 198 |
|
|---|
| 199 | where movie.loop is as above. This produces lots of jpeg files (but
|
|---|
| 200 | takes 3 days!!!). Then...
|
|---|
| 201 |
|
|---|
| 202 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 203 | <a href="./make_mpeg2encode_parfile.sh" target="_top">make_mpeg2encode_parfile.sh</a> g4RayTracer*jpeg
|
|---|
| 204 | </pre></div><p>
|
|---|
| 205 | </p><p>
|
|---|
| 206 | Then edit mpeg2encode.par to specify file type and size, etc.:
|
|---|
| 207 |
|
|---|
| 208 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 209 | $ diff mpeg2encode.par.orig mpeg2encode.par
|
|---|
| 210 | 7c7
|
|---|
| 211 | < 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
|
|---|
| 212 | ---
|
|---|
| 213 | > 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
|
|---|
| 214 | 15,17c15,17
|
|---|
| 215 | < /* horizontal_size */
|
|---|
| 216 | < /* vertical_size */
|
|---|
| 217 | < 8 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */
|
|---|
| 218 | ---
|
|---|
| 219 | > 600 /* horizontal_size */
|
|---|
| 220 | > 600 /* vertical_size */
|
|---|
| 221 | > 1 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */
|
|---|
| 222 | </pre></div><p>
|
|---|
| 223 | </p><p>
|
|---|
| 224 |
|
|---|
| 225 | Then convert to ppm, encode and play:
|
|---|
| 226 |
|
|---|
| 227 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 228 | for i in g4*jpeg;
|
|---|
| 229 | do j=`basename $i .jpeg`; command="convert $i $j.ppm"; echo $command; $command; done
|
|---|
| 230 | mpeg2encode mpeg2encode.par g4RayTracer.mpg
|
|---|
| 231 | open g4RayTracer.mpg
|
|---|
| 232 | </pre></div><p>
|
|---|
| 233 | </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch08s09.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="ch08.html"><img src="AllResources/IconsGIF/up.gif" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="ch09.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">8.9.
|
|---|
| 234 | Polylines, Markers and Text
|
|---|
| 235 | </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="AllResources/IconsGIF/home.gif" alt="Home"></a></td><td width="40%" align="right" valign="top"> Chapter 9.
|
|---|
| 236 | Examples
|
|---|
| 237 | </td></tr></table></div></body></html>
|
|---|