source: trunk/Documentation/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch08s10.html@ 901

Last change on this file since 901 was 901, checked in by garnier, 17 years ago

Add Geant4 Documentation at 8.12.2008

File size: 9.5 KB
Line 
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">
2function 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. 
9Making 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. 
11Visualization
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. 
13Making a Movie
14</h2></div></div></div><p>
15These instructions are suggestive only. The following procedures
16have not been tested on all platforms. There are clearly some
17instructions that apply only to Unix-like systems with an X-Windows
18based windowing system. However, it should not be difficult to take
19the ideas presented here and extend them to other platforms and
20systems.
21</p><p>
22The procedures described here need graphics drivers that
23can produce picture files that can be converted to a form suitable
24for an MPEG encoder. There may be other ways of capturing the
25screen images and we would be happy to hear about them. Graphics
26drivers 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>
58So far, only DAWNFILE, OGLX and RayTracer have been "road tested".
59Once 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">
62ImageMagick
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. 
67OGLX
68</h3></div></div></div><p>
69Make 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
82which 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>
90This 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>
96Then 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
1007c7
101&lt; 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
102---
103&gt; 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
10415,17c15,17
105&lt; /* horizontal_size */
106&lt; /* vertical_size */
107&lt; 8 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */
108---
109&gt; 600 /* horizontal_size */
110&gt; 600 /* vertical_size */
111&gt; 1 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */
112</pre></div><p>
113</p><p>
114Then convert to ppm:
115
116</p><div class="informalexample"><pre class="programlisting">
117for 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>
121Then
122
123</p><div class="informalexample"><pre class="programlisting">
124mpeg2encode mpeg2encode.par G4OpenGL.mpg
125</pre></div><p>
126</p><p>
127Then, on Mac, for example:
128
129</p><div class="informalexample"><pre class="programlisting">
130open G4OpenGL.mpg
131</pre></div><p>
132
133opens 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. 
135DAWNFILE
136</h3></div></div></div><p>
137You need to invoke <span class="bold"><strong>dawn</strong></span> in "direct" mode,
138which picks up parameters from .DAWN_1.history, and suppress the GUI:
139
140</p><div class="informalexample"><pre class="programlisting">
141alias dawn='dawn -d'
142export DAWN_BATCH=1
143</pre></div><p>
144</p><p>
145Change OGLSX to DAWNFILE in the above set of Geant4 commands and
146run. Then convert to ppm files as above:
147
148</p><div class="informalexample"><pre class="programlisting">
149for 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>
153Then 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
159and edit mpeg2encode.par:
160
161</p><div class="informalexample"><pre class="programlisting">
162$ diff mpeg2encode.par~ mpeg2encode.par
1637c7
164&lt; 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
165---
166&gt; 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
1679c9
168&lt; 1 /* number of first frame */
169---
170&gt; 0 /* number of first frame */
17115,16c15,16
172&lt; /* horizontal_size */
173&lt; /* vertical_size */
174---
175&gt; 482 /* horizontal_size */
176&gt; 730 /* vertical_size */
177</pre></div><p>
178</p><p>
179Then encode and play:
180
181</p><div class="informalexample"><pre class="programlisting">
182mpeg2encode mpeg2encode.par DAWN.mpg
183open 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. 
186RayTracerX
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
199where movie.loop is as above. This produces lots of jpeg files (but
200takes 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>
206Then 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
2107c7
211&lt; 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
212---
213&gt; 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */
21415,17c15,17
215&lt; /* horizontal_size */
216&lt; /* vertical_size */
217&lt; 8 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */
218---
219&gt; 600 /* horizontal_size */
220&gt; 600 /* vertical_size */
221&gt; 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
225Then convert to ppm, encode and play:
226
227</p><div class="informalexample"><pre class="programlisting">
228for i in g4*jpeg;
229 do j=`basename $i .jpeg`; command="convert $i $j.ppm"; echo $command; $command; done
230mpeg2encode mpeg2encode.par g4RayTracer.mpg
231open 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. 
234Polylines, 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. 
236Examples
237</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.