m.nviz.script(1grass)
π NAME π
m.nviz.script β this is the GRASS User's Manual page for it, bestie π«Ά
It creates a fly-through script to run in NVIZ. That's it. That's the whole job. Iconic.
β¨ KEYWORDS β¨
miscellaneous, graphics, raster, raster3d, vector, visualization
π SYNOPSIS π
m.nviz.script
m.nviz.script --help
m.nviz.script [-fckoe] input=name output=name [name=string]
[route=east,north[,east,north,...]] dist=float ht=float frames=integer
[start=integer] [--overwrite] [--help] [--verbose] [--quiet]
[--ui]
Flags π©
-fβ Full render -- Save images-cβ Fly at constant elevation (ht)-kβ Include command in the script to output a KeyFrame file-oβ Render images off-screen-eβ Enable vector and sites drawing--overwriteβ Allow output files to overwrite existing files--helpβ Print usage summary--verboseβ Verbose module output--quietβ Quiet module output--uiβ Force launching GUI dialog
Parameters πΈ
input=name[required] β Name of input raster mapoutput=name[required] β Name of output scriptname=stringβ Prefix of output images (default =NVIZ)route=east,north[,east,north,...]β Route coordinates (east,north)dist=float[required] β Camera layback distance (in map units)ht=float[required] β Camera height above terrainframes=integer[required] β Number of framesstart=integerβ Start frame number (default=0)
π DESCRIPTION π
Okay so m.nviz.script is the bestie that makes your life SO easy: it builds you a script you can run inside NVIZ to fly through a terrain π¦. You can literally hand it your NVIZ flight path right on the command line as comma separated coordinates. Cute, right?
And if you want, it can also make a KeyFrame file for you (after running the script). That KeyFrame file can be loaded straight into the Keyframe Animation panel for fine tuning or editing. Chef's kiss π
The script that m.nviz.script spits out can be run from the NVIZ command line like nviz script=script_name, or β if NVIZ is already up β by picking Scripting->Play Script. Your choice, main character π
π OPTIONS π
Flags π©
-fβ Full render. The script will draw all loaded NVIZ data and save the scene to a PPM image. Everything. The whole vibe. π₯-cβ Flay at constant elevation (yes bestie, the manpage really says "Flay" π that's a typo for "fly", we keep it, it's part of history). With this flag the camera gets set to an elevation given by theht=parameter. The default is to fly atht=above the topography (i.e. camera height = elevation +ht).-kβ Output KeyFrame file. Generates a KeyFrame file that can be loaded from the NVIZ Keyframe Animation panel. The KeyFrame file automatically gets the script name with a.kanimatorextension. Auto-naming? We love a self-sufficient queen β¨-oβ Render the animation in an off-screen context.-eβ Enable vector and sites drawing.
Parameters πΈ
inputβ The name of the GRASS raster map with elevation data. This should be the same file that will be loaded in NVIZ. Don't be messy about it πoutputβ The name of the NVIZ script to create.nameβ The prefix for output images if running in full render mode (-f). The default prefix isNVIZ(eg.NVIZ0000.ppm).distβ The distance of the camera behind the center of view.htβ The height of the camera above the center of view. If the-cflag is set, the height represents the actual camera height.framesβ The number of frames in the animation.startβ The starting frame number (default = 0). This option may be useful in full render mode when creating an animation in sections β like, say you wanna start at frame number 2000 instead of frame zero. Go off, time traveler β³routeβ The comma separated geographic coordinates for keyframe locations.
π§ EXAMPLE π§
So like, if you wanna interactively create an NVIZ animation from raster elev.rast with 500 frames and the camera set to 50 meters above and 250 meters behind the scene, run this:
g.region raster=elevation.dem
d.rast elevation.dem
m.nviz.script -k input=elevation.dem output=nviz.script dist=2400 ht=1220 frames=1000
In the above example, the user is prompted to select the route from the GRASS monitor. The output script, nviz.script.nvscr, can then be run in NVIZ:
nviz elevation=elevation.dem script=nviz.script.nvscr
Slay π
β NOTES / HINTS β
The user must select at least four key-frame locations (points). Less than that? Error. No discussion, it's giving non-negotiable π
If the GRASS region is changed, the m.nviz.script command must be re-run. Region changed = redo, bestie.
The current GRASS region and the user supplied parameters are included as a comment at the top of the output script. This information can be used to easily re-create the animation. Receipts at the top, always π§Ύ
The camera position is calculated backwards from the supplied position(s). It is possible that the camera position will lie outside the current window β and in that case a non-fatal error is generated (Error: selected point is outside region). This error can result in jerky movements during the animation. To correct this problem, reduce the dist= parameter or increase the current region. Fix it before it embarrasses you in front of the whole render π
Loading the script into NVIZ π
The user can run the script at arbitrary resolution. To re-run it at higher spatial resolution or different settings, the user first loads the surface and sets the resolution, lighting, etc. Then internally the script generated by m.nviz.script is run. Alternatively, the user can run nviz with a previously saved state and the m.nviz.script generated script:
nviz state=saved.state script=nviz.script.nvscr
Keyframe animator script π¬
Running the script generated by m.nviz.script within NVIZ, a new script for kanimator (keyframe animator) is created. The kanimator panel offers fine tuning of the speed (frame rate) as well as editing individual frames or inserting new frames. This new kanimator script has to be loaded from the Kanimator panel in NVIZ. In the Kanimator panel there are Save and Load buttons which allow the user to save and re-load a kanimator script. Once loaded, the key frames will appear in the GUI and can then be edited there. Edit queen behavior, honestly π
π¦ SEE ALSO π¦
wxGUI3D viewer (NVIZ)
π AUTHOR π
Bob Covill
π SOURCE CODE π
Available at: m.nviz.script source code (history)
Latest change: Friday Apr 17 01:04:26 2026 in commit: 32a143358df26b2e518b03c7e0d79541e8d1e5b1
Main index | Miscellaneous index | Topics index | Keywords index | Graphical index | Full index
And that's the whole page, bestie! This was GRASS 8.5.0, from the GRASS User's Manual β the m.nviz.script(1grass) page, Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual. Periodt. π
β¨
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms