[904] | 1 | <!-- ******************************************************** --> |
---|
| 2 | <!-- --> |
---|
| 3 | <!-- [History] --> |
---|
| 4 | <!-- Converted to DocBook: Katsuya Amako, Aug-2006 --> |
---|
[921] | 5 | <!-- Updates for Qt: Laurent Garnier, Dec-2008 --> |
---|
[904] | 6 | <!-- --> |
---|
| 7 | <!-- ******************************************************** --> |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | <!-- ******************* Section (Level#1) ****************** --> |
---|
| 11 | <sect1 id="sect.MkMovie"> |
---|
| 12 | <title> |
---|
| 13 | Making a Movie |
---|
| 14 | </title> |
---|
| 15 | |
---|
| 16 | <para> |
---|
| 17 | These instructions are suggestive only. The following procedures |
---|
| 18 | have not been tested on all platforms. There are clearly some |
---|
| 19 | instructions that apply only to Unix-like systems with an X-Windows |
---|
| 20 | based windowing system. However, it should not be difficult to take |
---|
| 21 | the ideas presented here and extend them to other platforms and |
---|
| 22 | systems. |
---|
| 23 | </para> |
---|
| 24 | |
---|
| 25 | <para> |
---|
| 26 | The procedures described here need graphics drivers that |
---|
| 27 | can produce picture files that can be converted to a form suitable |
---|
| 28 | for an MPEG encoder. There may be other ways of capturing the |
---|
| 29 | screen images and we would be happy to hear about them. Graphics |
---|
| 30 | drivers currently capable of producing picture files are: |
---|
| 31 | |
---|
[921] | 32 | <ulink url="http://bmrc.berkeley.edu/frame/research/mpeg/mpeg_encode.html">More informations about MPEG encoder</ulink> |
---|
| 33 | |
---|
[904] | 34 | <informaltable> |
---|
| 35 | <tgroup cols="2"> |
---|
| 36 | <tbody> |
---|
| 37 | <row> |
---|
| 38 | <entry> |
---|
| 39 | <emphasis role="bold">Driver</emphasis> |
---|
| 40 | </entry> |
---|
| 41 | <entry> |
---|
| 42 | <emphasis role="bold">File type</emphasis> |
---|
| 43 | </entry> |
---|
| 44 | </row> |
---|
| 45 | <row> |
---|
| 46 | <entry> |
---|
| 47 | DAWNFILE |
---|
| 48 | </entry> |
---|
| 49 | <entry> |
---|
| 50 | prim then eps using <emphasis role="bold">dawn</emphasis> |
---|
| 51 | </entry> |
---|
| 52 | </row> |
---|
| 53 | <row> |
---|
| 54 | <entry> |
---|
| 55 | HepRepFile |
---|
| 56 | </entry> |
---|
| 57 | <entry> |
---|
| 58 | HepRep1 |
---|
| 59 | </entry> |
---|
| 60 | </row> |
---|
| 61 | <row> |
---|
| 62 | <entry> |
---|
| 63 | HepRep |
---|
| 64 | </entry> |
---|
| 65 | <entry> |
---|
| 66 | HepRep2 |
---|
| 67 | </entry> |
---|
| 68 | </row> |
---|
| 69 | <row> |
---|
| 70 | <entry> |
---|
| 71 | OGLX |
---|
| 72 | </entry> |
---|
| 73 | <entry> |
---|
| 74 | eps |
---|
| 75 | </entry> |
---|
| 76 | </row> |
---|
| 77 | <row> |
---|
| 78 | <entry> |
---|
[921] | 79 | Qt |
---|
| 80 | </entry> |
---|
| 81 | <entry> |
---|
| 82 | jpeg, eps, ppm, ... |
---|
| 83 | </entry> |
---|
| 84 | </row> |
---|
| 85 | <row> |
---|
| 86 | <entry> |
---|
[904] | 87 | RayTracer |
---|
| 88 | </entry> |
---|
| 89 | <entry> |
---|
| 90 | jpeg |
---|
| 91 | </entry> |
---|
| 92 | </row> |
---|
| 93 | <row> |
---|
| 94 | <entry> |
---|
| 95 | VRMLFILE |
---|
| 96 | </entry> |
---|
| 97 | <entry> |
---|
| 98 | vrml |
---|
| 99 | </entry> |
---|
| 100 | </row> |
---|
| 101 | </tbody> |
---|
| 102 | </tgroup> |
---|
| 103 | </informaltable> |
---|
| 104 | </para> |
---|
| 105 | |
---|
| 106 | <para> |
---|
| 107 | So far, only DAWNFILE, OGLX and RayTracer have been "road tested". |
---|
| 108 | Once in a standard format, such as eps, the |
---|
| 109 | <emphasis role="bold">convert</emphasis> program from |
---|
| 110 | <ulink url="http://www.imagemagick.org"> |
---|
| 111 | ImageMagick |
---|
| 112 | </ulink> |
---|
| 113 | can convert to ppm files suitable for |
---|
| 114 | <emphasis role="bold">mpeg2encode</emphasis>. |
---|
| 115 | </para> |
---|
| 116 | |
---|
| 117 | |
---|
| 118 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 119 | <sect2 id="sect.MkMovie.OGLX"> |
---|
| 120 | <title> |
---|
| 121 | OGLX |
---|
| 122 | </title> |
---|
| 123 | |
---|
| 124 | <para> |
---|
| 125 | Make a macro something like this: |
---|
| 126 | |
---|
| 127 | <informalexample> |
---|
| 128 | <programlisting> |
---|
| 129 | /control/verbose 2 |
---|
| 130 | /vis/open OGLSX 600x600-0+0 |
---|
| 131 | /vis/drawVolume |
---|
| 132 | /vis/viewer/reset |
---|
| 133 | /vis/viewer/set/style surface |
---|
| 134 | /vis/viewer/set/projection perspective 50 deg |
---|
| 135 | /control/alias phi 30 |
---|
| 136 | /control/loop movie.loop theta 0 360 1 |
---|
| 137 | </programlisting> |
---|
| 138 | </informalexample> |
---|
| 139 | |
---|
| 140 | which invokes movie.loop, which is something like: |
---|
| 141 | |
---|
| 142 | <informalexample> |
---|
| 143 | <programlisting> |
---|
| 144 | /vis/viewer/set/viewpointThetaPhi {theta} {phi} |
---|
| 145 | /vis/viewer/zoom 1.005 |
---|
| 146 | /vis/ogl/printEPS |
---|
| 147 | </programlisting> |
---|
| 148 | </informalexample> |
---|
| 149 | </para> |
---|
| 150 | |
---|
| 151 | <para> |
---|
| 152 | This produces lots of eps files. Then... |
---|
| 153 | |
---|
| 154 | <informalexample> |
---|
| 155 | <programlisting> |
---|
| 156 | <ulink url="./make_mpeg2encode_parfile.sh">make_mpeg2encode_parfile.sh</ulink> G4OpenGL_*eps |
---|
| 157 | </programlisting> |
---|
| 158 | </informalexample> |
---|
| 159 | </para> |
---|
| 160 | |
---|
| 161 | <para> |
---|
| 162 | Then edit mpeg2encode.par to specify file type and size, etc.: |
---|
| 163 | |
---|
| 164 | <informalexample> |
---|
| 165 | <programlisting> |
---|
| 166 | $ diff mpeg2encode.par~ mpeg2encode.par |
---|
| 167 | 7c7 |
---|
| 168 | < 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
| 169 | --- |
---|
| 170 | > 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
| 171 | 15,17c15,17 |
---|
| 172 | < /* horizontal_size */ |
---|
| 173 | < /* vertical_size */ |
---|
| 174 | < 8 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */ |
---|
| 175 | --- |
---|
| 176 | > 600 /* horizontal_size */ |
---|
| 177 | > 600 /* vertical_size */ |
---|
| 178 | > 1 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */ |
---|
| 179 | </programlisting> |
---|
| 180 | </informalexample> |
---|
| 181 | </para> |
---|
| 182 | |
---|
| 183 | <para> |
---|
| 184 | Then convert to ppm: |
---|
| 185 | |
---|
| 186 | <informalexample> |
---|
| 187 | <programlisting> |
---|
| 188 | for i in G4OpenGL*eps; |
---|
| 189 | do j=`basename $i .eps`; command="convert $i $j.ppm"; echo $command; $command; done |
---|
| 190 | </programlisting> |
---|
| 191 | </informalexample> |
---|
| 192 | </para> |
---|
| 193 | |
---|
| 194 | <para> |
---|
| 195 | Then |
---|
| 196 | |
---|
| 197 | <informalexample> |
---|
| 198 | <programlisting> |
---|
| 199 | mpeg2encode mpeg2encode.par G4OpenGL.mpg |
---|
| 200 | </programlisting> |
---|
| 201 | </informalexample> |
---|
| 202 | </para> |
---|
| 203 | |
---|
| 204 | <para> |
---|
| 205 | Then, on Mac, for example: |
---|
| 206 | |
---|
| 207 | <informalexample> |
---|
| 208 | <programlisting> |
---|
| 209 | open G4OpenGL.mpg |
---|
| 210 | </programlisting> |
---|
| 211 | </informalexample> |
---|
| 212 | |
---|
| 213 | opens a QuickTime player. |
---|
| 214 | </para> |
---|
| 215 | |
---|
| 216 | </sect2> |
---|
| 217 | |
---|
[921] | 218 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 219 | <sect2 id="sect.MkMovie.Qt"> |
---|
| 220 | <title> |
---|
| 221 | Qt |
---|
| 222 | </title> |
---|
[904] | 223 | |
---|
[921] | 224 | <para> |
---|
| 225 | The Qt driver provides one of the easiest ways to make a movie. |
---|
| 226 | Of course, you first need to add the Qt libraries and link with Qt, |
---|
| 227 | but once you have that, Qt provides a ready-made function to store all updates of the OpenGL |
---|
| 228 | frame into the movie format. |
---|
| 229 | You then use loops (as defined in OGLX section above) or even move/rotate/zoom you scene |
---|
| 230 | by mouse actions to form your movie. |
---|
| 231 | </para> |
---|
| 232 | <para> |
---|
| 233 | The Qt driver automatically handles all of the movie-making steps described in the OGLX section of this document - storing the files, converting them and assembling the finished movie. |
---|
| 234 | You just have to take care of installing an mpeg_encoder. |
---|
| 235 | </para> |
---|
| 236 | <para> |
---|
| 237 | To make a movie : |
---|
| 238 | <itemizedlist spacing="compact"> |
---|
| 239 | <listitem><para> |
---|
| 240 | Right click to display a context menu, "Action"->"Movie parameters". |
---|
| 241 | </para></listitem> |
---|
| 242 | <listitem><para> |
---|
| 243 | Select MPEG encoder path if it was not found. |
---|
| 244 | </para></listitem> |
---|
| 245 | <listitem><para> |
---|
| 246 | Select the name of the output movie. |
---|
| 247 | </para></listitem> |
---|
| 248 | <listitem><para> |
---|
| 249 | Let go! Hit SPACE to Start/Pause recording, RETURN to STOP |
---|
| 250 | </para></listitem> |
---|
| 251 | </itemizedlist> |
---|
| 252 | </para> |
---|
| 253 | <para> |
---|
| 254 | Then, open your movie (on Mac, for example): |
---|
| 255 | |
---|
| 256 | <informalexample> |
---|
| 257 | <programlisting> |
---|
| 258 | open G4OpenGL.mpg |
---|
| 259 | </programlisting> |
---|
| 260 | </informalexample> |
---|
| 261 | |
---|
| 262 | opens a QuickTime player. |
---|
| 263 | </para> |
---|
| 264 | |
---|
| 265 | </sect2> |
---|
| 266 | |
---|
| 267 | |
---|
[904] | 268 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 269 | <sect2 id="sect.MkMovie.DAWNFILE"> |
---|
| 270 | <title> |
---|
| 271 | DAWNFILE |
---|
| 272 | </title> |
---|
| 273 | |
---|
| 274 | <para> |
---|
| 275 | You need to invoke <emphasis role="bold">dawn</emphasis> in "direct" mode, |
---|
| 276 | which picks up parameters from .DAWN_1.history, and suppress the GUI: |
---|
| 277 | |
---|
| 278 | <informalexample> |
---|
| 279 | <programlisting> |
---|
| 280 | alias dawn='dawn -d' |
---|
| 281 | export DAWN_BATCH=1 |
---|
| 282 | </programlisting> |
---|
| 283 | </informalexample> |
---|
| 284 | </para> |
---|
| 285 | |
---|
| 286 | <para> |
---|
| 287 | Change OGLSX to DAWNFILE in the above set of Geant4 commands and |
---|
| 288 | run. Then convert to ppm files as above: |
---|
| 289 | |
---|
| 290 | <informalexample> |
---|
| 291 | <programlisting> |
---|
| 292 | for i in g4_*.eps; |
---|
| 293 | do j=`basename $i .eps`; command="convert $i $j.ppm"; echo $command; $command; done |
---|
| 294 | </programlisting> |
---|
| 295 | </informalexample> |
---|
| 296 | </para> |
---|
| 297 | |
---|
| 298 | <para> |
---|
| 299 | Then make a .par file: |
---|
| 300 | |
---|
| 301 | <informalexample> |
---|
| 302 | <programlisting> |
---|
| 303 | <ulink url="./make_mpeg2encode_parfile.sh">make_mpeg2encode_parfile.sh</ulink> g4_*ppm |
---|
| 304 | </programlisting> |
---|
| 305 | </informalexample> |
---|
| 306 | |
---|
| 307 | and edit mpeg2encode.par: |
---|
| 308 | |
---|
| 309 | <informalexample> |
---|
| 310 | <programlisting> |
---|
| 311 | $ diff mpeg2encode.par~ mpeg2encode.par |
---|
| 312 | 7c7 |
---|
| 313 | < 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
| 314 | --- |
---|
| 315 | > 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
| 316 | 9c9 |
---|
| 317 | < 1 /* number of first frame */ |
---|
| 318 | --- |
---|
| 319 | > 0 /* number of first frame */ |
---|
| 320 | 15,16c15,16 |
---|
| 321 | < /* horizontal_size */ |
---|
| 322 | < /* vertical_size */ |
---|
| 323 | --- |
---|
| 324 | > 482 /* horizontal_size */ |
---|
| 325 | > 730 /* vertical_size */ |
---|
| 326 | </programlisting> |
---|
| 327 | </informalexample> |
---|
| 328 | </para> |
---|
| 329 | |
---|
| 330 | <para> |
---|
| 331 | Then encode and play: |
---|
| 332 | |
---|
| 333 | <informalexample> |
---|
| 334 | <programlisting> |
---|
| 335 | mpeg2encode mpeg2encode.par DAWN.mpg |
---|
| 336 | open DAWN.mpg |
---|
| 337 | </programlisting> |
---|
| 338 | </informalexample> |
---|
| 339 | </para> |
---|
| 340 | |
---|
| 341 | </sect2> |
---|
| 342 | |
---|
| 343 | |
---|
| 344 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 345 | <sect2 id="sect.MkMovie.RyTrcX"> |
---|
| 346 | <title> |
---|
| 347 | RayTracerX |
---|
| 348 | </title> |
---|
| 349 | |
---|
| 350 | <para> |
---|
| 351 | <informalexample> |
---|
| 352 | <programlisting> |
---|
| 353 | /control/verbose 2 |
---|
| 354 | /vis/open RayTracerX 600x600-0+0 |
---|
| 355 | # (Raytracer doesn't need a scene; smoother not to /vis/drawVolume.) |
---|
| 356 | /vis/viewer/reset |
---|
| 357 | /vis/viewer/set/style surface |
---|
| 358 | /vis/viewer/set/projection perspective 50 deg |
---|
| 359 | /control/alias phi 30 |
---|
| 360 | /control/loop movie.loop theta 0 360 1 |
---|
| 361 | </programlisting> |
---|
| 362 | </informalexample> |
---|
| 363 | |
---|
| 364 | where movie.loop is as above. This produces lots of jpeg files (but |
---|
| 365 | takes 3 days!!!). Then... |
---|
| 366 | |
---|
| 367 | <informalexample> |
---|
| 368 | <programlisting> |
---|
| 369 | <ulink url="./make_mpeg2encode_parfile.sh">make_mpeg2encode_parfile.sh</ulink> g4RayTracer*jpeg |
---|
| 370 | </programlisting> |
---|
| 371 | </informalexample> |
---|
| 372 | </para> |
---|
| 373 | |
---|
| 374 | <para> |
---|
| 375 | Then edit mpeg2encode.par to specify file type and size, etc.: |
---|
| 376 | |
---|
| 377 | <informalexample> |
---|
| 378 | <programlisting> |
---|
| 379 | $ diff mpeg2encode.par.orig mpeg2encode.par |
---|
| 380 | 7c7 |
---|
| 381 | < 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
| 382 | --- |
---|
| 383 | > 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
| 384 | 15,17c15,17 |
---|
| 385 | < /* horizontal_size */ |
---|
| 386 | < /* vertical_size */ |
---|
| 387 | < 8 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */ |
---|
| 388 | --- |
---|
| 389 | > 600 /* horizontal_size */ |
---|
| 390 | > 600 /* vertical_size */ |
---|
| 391 | > 1 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */ |
---|
| 392 | </programlisting> |
---|
| 393 | </informalexample> |
---|
| 394 | </para> |
---|
| 395 | |
---|
| 396 | <para> |
---|
| 397 | |
---|
| 398 | Then convert to ppm, encode and play: |
---|
| 399 | |
---|
| 400 | <informalexample> |
---|
| 401 | <programlisting> |
---|
| 402 | for i in g4*jpeg; |
---|
| 403 | do j=`basename $i .jpeg`; command="convert $i $j.ppm"; echo $command; $command; done |
---|
| 404 | mpeg2encode mpeg2encode.par g4RayTracer.mpg |
---|
| 405 | open g4RayTracer.mpg |
---|
| 406 | </programlisting> |
---|
| 407 | </informalexample> |
---|
| 408 | </para> |
---|
| 409 | |
---|
| 410 | |
---|
| 411 | </sect2> |
---|
| 412 | </sect1> |
---|