This is a GUI application and you don’t need to use any command-line options.
But you can — to automate some tasks, like capturing screenshots.
Run with command-line option --help
to see the full list of options.
You can specify a model filename, or URL to load at the command-line. You can combine this with some other options documented below, e.g. to make a screenshot of given model.
4.1. Capturing screenshots and movies of 3D scenes and animations
You can use command-line options to make a screenshot or record a movie of the loaded scene.
- --screenshot TIME FILE-NAME
-
Capture a screenshot of the loaded scene and exit.
- --screenshot-range TIME-BEGIN TIME-STEP FRAMES-COUNT FILE-NAME
-
Capture a series of screenshots of the loaded scene and exit. The output can be a series of images specified like output_@counter(4).png
(see movies from image sequence for details about @counter(<padding>)
macro) or a movie file.
To save a movie file, ffmpeg
must be installed. See ffmpeg section for details.
Movie recorded this way is guaranteed to be captured with stable number of frames per second. This is different than using independent programs to capture rendering output, which generally relies on the system being "fast enough" to be able to render useful number of frames per second, recording them at the same time.
We take FRAMES-COUNT
screenshots. The first screenshot is at time TIME-BEGIN
, second screenshot is at TIME-BEGIN + TIME-STEP
, next one is at TIME-BEGIN + 2 * TIME-STEP
etc.
- --screenshot-transparent
-
Make screenshots taken have a transparent background.
Together with one of these 2 options, you definitely want to pass also a model file to load, otherwise we’ll just make a screenshot of the default empty (black) scene.
4.1.1. Examples
Take a simple screenshot of a scene, at it’s default camera:
castle-model-viewer my_model.gltf --screenshot 0 output.png
You can also take multiple screenshots or even multiple movies in a single run. For this, just use the above options multiple times.
Make a movie of 2 seconds of animation, with 25 frames per second:
castle-model-viewer my_model.castle-anim-frames --screenshot-range 0 0.04 50 output_@counter(4).png
Capture 2 movies from the same animation:
castle-model-viewer my_model.castle-anim-frames \
--screenshot-range 0 0.04 50 output_@counter(4).avi \
--screenshot-range 10 0.04 50 output_@counter(4).avi
This generates two files: output1.avi
with 2 second animation from 0.0 to 2.0 time, and output2.avi
with 2 second animation from 10.0 to 12.0 time.
4.1.2. Hints
-
To control the camera of your screenshot, place initial camera information in the model (glTF, X3D, VRML, Collada support this).
You can use --viewpoint
command-line option (see below) to choose a specific named viewpoint for screenshot.
You can generate wanted Viewpoint
node also by using castle-model-viewer
, just set your camera (in interactive mode) the way you like and use menu item "Clipboard → Print Current Camera…".
-
X3D has also the Background
node to control the color or textures of the skybox.
-
To control the size of resulting screenshot, use --geometry
command-line parameter (documented in standard options understood by our GUI programs).
-
To make your screenshot look best, you may want to use anti-aliasing, see --anti-alias
option below.
4.2. Other options
- --hide-menu
-
Hide the top menubar. Useful for full-screen presentations.
- --anti-alias AMOUNT
-
Use full-screen anti-aliasing. You can also configure it from the menu "File → Preferences → Anti aliasing". Using this command-line option is mainly useful together with`--screenshot` option.
Argument AMOUNT
is an integer >= 0. Value 0
means "no anti-aliasing", this is the default. Larger integer values (maximum is 4) make the result look better.
There is no guarantee what specific values of AMOUNT
exactly mean, as this depends on your graphic card capabilities. Just test each method and decide which looks best on your system and is fast enough.
- --viewpoint VIEWPOINT-NAME
-
Specify the name or a number of the viewpoint that will be bound (used) when the scene is loaded.
By default, when this option is not used, we follow X3D standard and use the first viewpoint found in the file (but not in the inlined files).
When the given VIEWPOINT-NAME
is a number, it is treated as the index of viewpoint to be used (0 means the first viewpoint, 1 means the 2nd viewpoint and so on). Otherwise, VIEWPOINT-NAME
is treated as a node name (node name is given by "DEF Xxx"
in X3D, and it cannot start with a digit, so this is unambiguous).
In interactive mode, remember that you don’t need this option — instead you can use comfortable "Navigation → Jump To Viewpoint" menu.
- --no-x3d-extensions
-
Do not use Castle Game Engine extensions to X3D.
For example we will not use Tangent
, flipVertically
,gravityTransform
when importing glTF to X3D. This affects both rendering and converting to X3D using "File → Save As…" menu item. This makes X3D output valid in all X3D browsers, albeit a little less functional.