m.nviz.script(1)

πŸ’– m.nviz.script πŸ’–

okay bestie, welcome to the GRASS GIS User's Manual page for m.nviz.script, and no cap this one is the movie-director module 🎬✨ she builds you a fly-through script that NVIZ then plays like a little cinematic masterpiece. main character energy fr fr πŸ¦‹


🌸 NAME 🌸

m.nviz.script β€” creates a fly-through script to run in NVIZ. πŸŽ₯

πŸŽ€ 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 those images πŸ’Ύ
  • -c β€” Fly at constant elevation (ht)
  • -k β€” Include a command in the script that spits out a KeyFrame file πŸ”‘
  • -o β€” Render images off-screen
  • -e β€” Enable vector and sites drawing
  • --overwrite β€” let output files overwrite files that already exist (permission to be messy πŸ’…)
  • --help β€” print the usage summary
  • --verbose β€” verbose module output
  • --quiet β€” quiet module output
  • --ui β€” force launching the GUI dialog

🧚 Parameters: 🧚

  • input=name [required] β€” name of the input raster map
  • output=name [required] β€” name of the output script
  • name=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 terrain
  • frames=integer [required] β€” number of frames
  • start=integer β€” start frame number (default=0)

🌈 DESCRIPTION 🌈

so m.nviz.script lets you easily create a script that can be run in NVIZ to fly through a terrain. πŸ”οΈ the NVIZ flight path can be handed to it right on the command line as comma separated coordinates. and then β€” the optional glow-up β€” the program can also create a KeyFrame file for you (after the script runs). that KeyFrame file can be loaded into the Keyframe Animation panel for fine tuning or editing. obsessed. πŸ’–

the script that m.nviz.script generates can be run from the NVIZ command line (nviz script=script_name) or, once NVIZ is already up and running, by selecting Scripting->Play Script. periodt. ✨


πŸ’… OPTIONS πŸ’…

🚩 Flags: 🚩

  • -f β€” Full render. the script will draw all loaded NVIZ data and save the scene to a PPM image. πŸ“Έ
  • -c β€” Fly at constant elevation. with this flag the camera gets set to an elevation given by the ht= parameter. the default (no flag) is to fly at ht= 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 .kanimator extension. πŸ”‘
  • -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, ok? πŸ‘€
  • 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 is NVIZ (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 -c flag 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 one is lowkey useful in full render mode when you're creating an animation in sections β€” like, maybe you wanna start at frame number 2000. 🎞️
  • route β€” the comma separated geographic coordinates for keyframe locations.

πŸ”₯ EXAMPLE πŸ”₯

to 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 the following:

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

🫢 NOTES / HINTS 🫢

  • the user must select at least four key-frame locations (points), otherwise an error is generated. four minimum bestie, them's the rules 🚨
  • if the GRASS region is changed, the m.nviz.script command must be re-run.
  • the current GRASS region and the user supplied parameters are included as a comment at the top of the output script. this info can be used to easily re-create the animation. cute AND useful πŸ’–
  • the camera position is calculated backwards from the supplied position(s). it is possible that the camera position will lie outside the current window, in which case a non-fatal error is generated (Error: selected point is outside region). this error can result in jerky movements during the animation 😭 to fix it, reduce the dist= parameter or increase the current region.

πŸ¦‹ Loading the script into NVIZ πŸ¦‹

the user can run the script at arbitrary resolution. to re-run it at higher spatial resolution or with different settings, you first load the surface and set the resolution, lighting, etc. then internally the script generated by m.nviz.script is run. alternatively, you can run nviz with a previously saved state plus 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 creates a new script for kanimator (keyframe animator). 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 let the user save and re-load a kanimator script. once loaded, the key frames will appear in the GUI and can then be edited there. iconic ✨


⭐ SEE ALSO ⭐

wxGUI 3D viewer (NVIZ)


πŸ‘‘ AUTHOR πŸ‘‘

Bob Covill


🌈 SOURCE CODE 🌈

available at: m.nviz.script source code (history)

accessed: Saturday Jan 17 05:41:37 2026

main index | miscellaneous index | topics index | keywords index | graphical index | full index

Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual


and that's the whole page bestie πŸ₯ΉπŸ’œ this was GRASS 8.4.2 of the Reference Manual, accessed Saturday Jan 17 05:41:37 2026, brought to you by the Β© 2003-2025 GRASS Development Team. now go make that animation, you absolute legend πŸ’…πŸŽ¬βœ¨

πŸ“¦ where this page comes from