Contact us
Leave a message

Bitte benutzen:

Mein öffentlicher Kryptographie-Schlüssel


Mitglied bei

Abendfüllende Spielfilme mit POV-Ray...

...werden zwar noch etwas auf sich warten lassen, aber auch kleinere Produktionen bestehen oft schon aus mehreren Szenen mit jeweils mehreren Einstellungen. Zwar bietet POV-Ray von sich aus bereits ein rudimentäres Animations-System, vermittels dessen auf den Zeitindex innerhalb des zu erstellenden Filmchens zugegriffen werden kann, doch werden zum Rendern oft zusätzliche Informationen (wie die seit Beginn einer Szene oder Einstellung verstrichene Zeit oder die laufende Nummer des aktuellen Frames) benötigt. "povmov.pl" ist ein Perl-Skript, dass es erlaubt, einen aus mehreren Szenen/Einstellungen bestehenden Film zu rendern und eben diese Informationen in die zum jeweiligen Frame gehörende POV-Ray-Szenenbeschreibungsdatei einzublenden.

Der Ursprung...

...hieß "Mutant Mycoplasma from Mars" und war ein absolut trashiges Horror-SciFi-B-Movie-Projekt einer Arbeitskollegin an der Komplement-Biologie-Arbeitsgruppe in der Cardiff Medical School. Zu Anfang des Film sollte gezeigt werden, wie eine Mars-Sonde der Nasa versehentlich einen marsianischen Mikroorganismus zur Erde bringt:

Zum Erstellen des schon recht komplexen, knapp zweiminütigen Filmchens hatte ich -- damals noch in Turbo-Pascal -- ein Progämmchen geschrieben, das eine Datei, die die Szenen-Struktur eines Films beschreibt, einliest, POV-Ray zum Rendern der einzelnen Frames mit entsprechenden Parametern aufruft und dabei verschiedene Informationen über die jeweilige Position innerhalb des Films übergibt.

povmov.pl

Im Rahmen der Arbeit an einem Beispielspiel für das Xaya-Projekt habe ich das Ganze dann in Perl (plattformunabhängig!) neu implementiert (Quellcode auf meiner GitLab-Seite). Wie das Skript grundlegen benutzt wird, wird in der Ausgabe des argumentlosen Aufrufs von povmov.pl erklärt:

Ausgabe von povmov.pl bei argumentlosem Aufruf

povmov.pl -- povray movie rendering helper script (version 1.0)
===============================================================================
Usage: povmov.pl [options] movie_description_file
Settings specified in the movie_description_file (see "povmov.mdf" for syntax
examples) can be overridden by the following options:
--verbose|-v:             Be verbose, tell what you are currently doing
--looped|-l:              Consider movie as looped
--width|-w <x>:           Render frames with a width of <x> pixels [320]
--height|-h <y>:          Render frames with a height of <y> pixels [200]
--fps|-r <n>:             Movie has a frame rate of <n> frames per second [12]
--out-prefix|-o <pre>:    Prepend <pre> to the frames' filenames [povmov]
--out-extension|-e <ext>: Append .<ext> to the frames' filenames [png]
--from|-f <init>:         Start rendering at scene/shot specified by <init> [*]
--to|-t <final>:          Rendering until scene/shot specified by <final> [*]
Initial/final frame specification format: (*|<n>[:(*|<m>)])
Examples: -f * -t * renders everything
          -f * -t 8 renders from start to scene 8 (including)
          -f * -t 8:* (same as above)
          -f 8 -t 8 renders scene 8 only
          -f 7:2 to 8 renders from scene 7, shot 2, to scene 8 (including)
          -f 7:2 to * renders from scene 7, shot 2, to end of movie
Run "povmov.pl povmov.mdf" for a sample render and see "povmov.pov" for how
to use povmov.pl in your scene files.

Den Aufbau einer Film-Beschreibungsdatei kann man sich -- wie oben vorgeschlagen -- anhand der mitgelieferten "povmov.mdf" verdeutlichen:

povmov.mdf

#=== General section ==================================================

#----------------------------------------------------------------------
# The following settings can be overwritten by according
# command line options

verbose = 1            # Make lotsa output (1) or be silent (0)
out_prefix =  povmov   # Prefix for individual frame files
out_extension = png    # Extension for individual frame files
fps = 12               # Frames per second
width = 320            # Frame width
height = 200           # Frame height
looped = 0             # Whether (1) or not (0) movie is looped
from = *               # Render from start...
to = *                 # ...to end of movie


#----------------------------------------------------------------------
# The following settings *cannot* be adjusted via command line, but
# are initialized by povmov.pl with suitable, OS dependend values.
# If no MS Windows system is detected, a ~nix style syntax is used.
# If you are running some exotic OS you may want to explicitly specify
# how to do certain things:

# --- How to call POV_Ray

# Default value for M$ Windows:
# pov_command = pvengine /EXIT +A +FN -HI%c -I%i -O%o -W%w -H%h

# POV-Ray, default for non-Windos OSs:
# pov_command = povray  +A +FN -HI%c -I%i -O%o -W%w -H%h

# Placeholders:
# %c - include file name (frame-specific)
# %i - input file name (scene-specific, see below)
# %o - output filename (constructed from out_prefix and out_extension)
# %w - frame width
# %h - frame height

# --- How to copy a file

# Default value for M$ Windows:
# copy_command = copy /Y %s %t

# Copying a file under non-Windos OSs:
# cp -f  %s %t

# Placeholders:
# %s - source file name
# %t - target file name


#=== Movie section ====================================================

# The movie sections consists of one or more scene definitions.
# Each scene is associated with a POV-Ray scene description file (which
# may -- and, for short movies, frequently will -- be the same for all
# scenes). Each scene consists of one or more shots with a given
# duration (in seconds). If a shot is static, i.e. there is no visual
# change between its frames, assign it a *negative* duration; this will
# have the effect that the shot gets rendered only once and all other
# frames are created by just copying the resulting image file (that's
# what the copy_command explained above is good for).


#----------------------------------------------------------------------
# This is the definition of the first scene (i.e. scene no 0)

scene = povmov.pov # This scene's geometry is defined in "povmov.pov"

# This scene has four shots

  shot = 2  # First shot (shot no 0) has a duration of 2 seconds
  shot = 1  # Second shot (shot no 1) has a duration of 1 second
  shot = 1  # Third shot (shot no 2) has also a duration of 1 second
  shot = -1 # Fourth shot (shot no 3) is a 1 second static shot

#----------------------------------------------------------------------
# Now more scene definitions may follow:
#
# scene = somefile.pov
#   shot = 7
#   shot = 1.5
#   shot = ...
#   ...
#
# scene = ...

Schließlich werden beim Aufruf von POV-Ray zum Rendern eines Frames folgende Variablen per Include-Datei automatisch initialisiert (und stehen damit in der jeweiligen POV-Ray-Szenenbeschreibungsdatei zur Verfügung):

Von povmov.pl initialisierte POV-Ray-Variablen

movieDescriptionFile - name of movie description file (e.g. "povmov.mdf")
movieTime            - current time (in seconds) in movie
movieFrame           - current frame number in movie
relMovieTime         - relative time in movie [0..1]
movieDuration        - duration of whole movie (in seconds)
movieFrames          - total number of frames in movie
scenesInMovie        - number of scenes in movie

scene                - number of current scene (starting from 0)
sceneFile            - file associated with current scene (i.e. *this* file)
sceneTime            - current time (in seconds) relative to scene start
sceneFrame           - current frame number relative to scene start
relSceneTime         - relative time relative to scene start [0..1]
sceneDuration        - duration of current scene (in seconds)
sceneFrames          - total number of frames in current scene
shotsInScene         - number of shots in current scene

shot                 - number of current shot (starting from 0)
shotTime             - current time (in seconds) relative to shot start
shotFrame            - current frame number relative to shot start
relShotTime          - relative time relative to shot start [0..1]
shotDuration         - duration of current shot (in seconds)
shotFrames           - total number of frames in current shot

Die mitgelieverte POV-Ray-Szenenbescheibungsdatei "povmov.pov" benutzt einige (wenige) dieser Variablen, um die Frames eines kleinen Demo-Filmchens zu rendern (rechts). Einfach mal selbst "povmov.pl povmov.mdf" aufrufen und die Einzelbilder mit einem geeigneten Tool zu einem Film zusammensetzen -- etwa mit ffmpeg:

ffmpeg -framerate 18 -pattern_type glob -i 'povmov*.png' -b:v 1M video.webm