Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

anim10.sh 2.4 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  1. #!/usr/bin/env bash
  2. #
  3. # GMT animations all start with designing plots that are created using the
  4. # PostScript language. It is therefore vector graphics with no limitations
  5. # imposed by pixel resolutions. However, to make an animation we must render
  6. # these PostScript plots into raster images (we use PNG) and a pixel resolution
  7. # enters. Unlike printed media (laserwriters), the dots-per-unit in an animation
  8. # is much lower, and compromizes are made when vector graphics must be turned
  9. # into pixels. GMT's movie module (and psconvert for still images) offers the
  10. # option of sub-pixeling. It means the image is temporarily enlarged to have
  11. # more pixels than requested, then shrunk back down. These steps tend to make
  12. # the lower-resolution images better than the raw rendering. Here we show
  13. # the effect of different sub-pixel settings - notice how the movies with
  14. # little or no sub-pixeling "jitters" as time goes by.
  15. # The resulting movie was presented at the Fall 2019 AGU meeting in an eLighting talk:
  16. # P. Wessel, 2019, GMT science animations for the masses, Abstract IN21B-11.
  17. # The finished movie is available in our YouTube channel as well:
  18. # https://youtu.be/FLzYVo7wXAg
  19. # The movie took ~2 minutes to render on a 24-core MacPro 2013.
  20. # Demonstrate the effect of sub-pixeling
  21. # 1. Create the angle file
  22. cat << 'EOF' > pre.sh
  23. gmt begin
  24. gmt math -T0/30/0.05 T 15 ADD = angles.txt
  25. gmt end
  26. EOF
  27. # 2. Set up the main frame script
  28. cat << 'EOF' > main.sh
  29. gmt begin
  30. echo "BELL" | gmt text -R-26/-12/63/67 -JM6i -F+f144p+cCM -Bafg \
  31. -X2i -Y1.25i -p${MOVIE_COL0}/${MOVIE_COL1}+w20W/65N+v3i/1.5i
  32. echo -15 65 100 | gmt plot -SE- -Gred -p
  33. echo -25 66.5 -20 66.5 | gmt plot -SV0.5i+s+e+h0.5 -Gblue -W3p -p
  34. gmt end
  35. EOF
  36. gmt movie main.sh -C540p -Njitter_H0 -Tangles.txt -Sbpre.sh -D24 -Fmp4 -G+p2p -Z -W -Lc0+jTL+t%05.1f+o1c -Ls"0 sub-pixels"+jBR+o1c
  37. for H in 2 4 8; do
  38. gmt movie main.sh -C540p -Njitter_H${H} -Tangles.txt -Sbpre.sh -D24 -Fmp4 -G+p2p -H${H} -Z -W -Lc0+jTL+t%05.1f+o1c -Ls"${H} sub-pixels"+jBR+o1c
  39. done
  40. # 4. Assemble the four movie frames into a 2x2 HD layout via ffmpeg
  41. ffmpeg -loglevel warning -i jitter_H0.mp4 -i jitter_H2.mp4 -filter_complex hstack=inputs=2 top.mp4
  42. ffmpeg -loglevel warning -i jitter_H4.mp4 -i jitter_H8.mp4 -filter_complex hstack=inputs=2 bot.mp4
  43. ffmpeg -loglevel warning -i top.mp4 -i bot.mp4 -filter_complex vstack=inputs=2 anim10.mp4
  44. rm -f top.mp4 bot.mp4 jitter_H?.mp4 main.sh pre.sh angles.txt
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...