source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/Visualization/makingamovie.xml @ 1211

Last change on this file since 1211 was 921, checked in by garnier, 15 years ago

en test de gl2ps. Problemes de libraries

File size: 9.5 KB
Line 
1<!-- ******************************************************** -->
2<!--                                                          -->
3<!--  [History]                                               -->
4<!--    Converted to DocBook: Katsuya Amako, Aug-2006         -->
5<!--    Updates for Qt: Laurent Garnier, Dec-2008             -->
6<!--                                                          -->
7<!-- ******************************************************** -->
8
9
10<!-- ******************* Section (Level#1) ****************** -->
11<sect1 id="sect.MkMovie">
12<title>
13Making a Movie
14</title>
15
16<para>
17These instructions are suggestive only. The following procedures
18have not been tested on all platforms. There are clearly some
19instructions that apply only to Unix-like systems with an X-Windows
20based windowing system. However, it should not be difficult to take
21the ideas presented here and extend them to other platforms and
22systems.
23</para>
24
25<para>
26The procedures described here need graphics drivers that
27can produce picture files that can be converted to a form suitable
28for an MPEG encoder. There may be other ways of capturing the
29screen images and we would be happy to hear about them. Graphics
30drivers currently capable of producing picture files are:
31
32<ulink url="http://bmrc.berkeley.edu/frame/research/mpeg/mpeg_encode.html">More informations about MPEG encoder</ulink>
33
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>
79        Qt
80      </entry>
81      <entry>
82        jpeg, eps, ppm, ...
83      </entry>
84    </row>
85    <row>
86      <entry>
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>
107So far, only DAWNFILE, OGLX and RayTracer have been "road tested".
108Once in a standard format, such as eps, the
109<emphasis role="bold">convert</emphasis> program from
110<ulink url="http://www.imagemagick.org">
111ImageMagick
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>
121OGLX
122</title>
123
124<para>
125Make 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
140which 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>
152This 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>
162Then edit mpeg2encode.par to specify file type and size, etc.:
163
164<informalexample>
165<programlisting>
166$ diff mpeg2encode.par~ mpeg2encode.par
1677c7
168&lt; 1         /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
169---
170&gt; 2         /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
17115,17c15,17
172&lt;    /* horizontal_size */
173&lt;   /* vertical_size */
174&lt; 8         /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */
175---
176&gt; 600   /* horizontal_size */
177&gt; 600  /* vertical_size */
178&gt; 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>
184Then convert to ppm:
185
186<informalexample>
187<programlisting>
188for 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>
195Then
196
197<informalexample>
198<programlisting>
199mpeg2encode mpeg2encode.par G4OpenGL.mpg
200</programlisting>
201</informalexample>
202</para>
203
204<para>
205Then, on Mac, for example:
206
207<informalexample>
208<programlisting>
209open G4OpenGL.mpg
210</programlisting>
211</informalexample>
212
213opens a QuickTime player.
214</para>
215
216</sect2>
217
218<!-- ******************* Section (Level#2) ****************** -->
219<sect2 id="sect.MkMovie.Qt">
220<title>
221Qt
222</title>
223
224<para>
225The Qt driver provides one of the easiest ways to make a movie.
226Of course, you first need to add the Qt libraries and link with Qt,
227but once you have that, Qt provides a ready-made function to store all updates of the OpenGL
228frame into the movie format.
229You then use loops (as defined in OGLX section above) or even move/rotate/zoom you scene
230by mouse actions to form your movie.
231</para>
232<para>
233The 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.
234You just have to take care of installing an mpeg_encoder.
235</para>
236<para>
237To 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>
254Then, open your movie (on Mac, for example):
255
256<informalexample>
257<programlisting>
258open G4OpenGL.mpg
259</programlisting>
260</informalexample>
261
262opens a QuickTime player.
263</para>
264
265</sect2>
266
267
268<!-- ******************* Section (Level#2) ****************** -->
269<sect2 id="sect.MkMovie.DAWNFILE">
270<title>
271DAWNFILE
272</title>
273
274<para>
275You need to invoke <emphasis role="bold">dawn</emphasis> in "direct" mode,
276which picks up parameters from .DAWN_1.history, and suppress the GUI:
277
278<informalexample>
279<programlisting>
280alias dawn='dawn -d'
281export DAWN_BATCH=1
282</programlisting>
283</informalexample>
284</para>
285
286<para>
287Change OGLSX to DAWNFILE in the above set of Geant4 commands and
288run. Then convert to ppm files as above:
289
290<informalexample>
291<programlisting>
292for 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>
299Then 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
307and edit mpeg2encode.par:
308
309<informalexample>
310<programlisting>
311$ diff mpeg2encode.par~ mpeg2encode.par
3127c7
313&lt; 1         /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
314---
315&gt; 2         /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
3169c9
317&lt; 1         /* number of first frame */
318---
319&gt; 0         /* number of first frame */
32015,16c15,16
321&lt;    /* horizontal_size */
322&lt;   /* vertical_size */
323---
324&gt; 482   /* horizontal_size */
325&gt; 730  /* vertical_size */
326</programlisting>
327</informalexample>
328</para>
329
330<para>
331Then encode and play:
332
333<informalexample>
334<programlisting>
335mpeg2encode mpeg2encode.par DAWN.mpg
336open 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>
347RayTracerX
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
364where movie.loop is as above. This produces lots of jpeg files (but
365takes 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>
375Then edit mpeg2encode.par to specify file type and size, etc.:
376
377<informalexample>
378<programlisting>
379$ diff mpeg2encode.par.orig mpeg2encode.par     
3807c7
381&lt; 1         /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
382---
383&gt; 2         /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
38415,17c15,17
385&lt;    /* horizontal_size */
386&lt;   /* vertical_size */
387&lt; 8         /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */
388---
389&gt; 600   /* horizontal_size */
390&gt; 600  /* vertical_size */
391&gt; 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
398Then convert to ppm, encode and play:
399
400<informalexample>
401<programlisting>
402for i in g4*jpeg;
403  do j=`basename $i .jpeg`; command="convert $i $j.ppm"; echo $command; $command; done
404mpeg2encode mpeg2encode.par g4RayTracer.mpg
405open g4RayTracer.mpg
406</programlisting>
407</informalexample>
408</para>
409
410
411</sect2>
412</sect1>
Note: See TracBrowser for help on using the repository browser.