POV-Ray: Difference between revisions
Jump to navigation
Jump to search
m (→See also) |
(+Script to generate camera parameters for Povray) |
||
Line 8: | Line 8: | ||
* [http://mpa.itc.it/markus/povray/ Control scripts and example images by Markus Neteler] | * [http://mpa.itc.it/markus/povray/ Control scripts and example images by Markus Neteler] | ||
* [http://casoilresource.lawr.ucdavis.edu/drupal/node/80 Control scripts and example images by Dylan Beaudette] | * [http://casoilresource.lawr.ucdavis.edu/drupal/node/80 Control scripts and example images by Dylan Beaudette] | ||
== Script to generate camera parameters for Povray == | |||
This script is an easy way to get the camera parameters for povray. Use to personalize one of the control files downloadable above from M Neteler's old Web page: | |||
#!/bin/sh | |||
# | |||
# generate useful parameters for POVRAY control file | |||
# Markus Neteler 7/2003 | |||
# $Date: 2005-02-10 17:56:18 +0100 (Do, 10 Feb 2005) $ | |||
if [ -z "$GISBASE" ] ; then | |||
echo "You must be in GRASS GIS to run this program." >&2 | |||
exit 1 | |||
fi | |||
if [ $# -lt 1 -o "$1" = "help" -o "$1" = "-h" -o "$1" = "--help" ] ; then | |||
echo "Script to generate POVRAY control file coordinates" | |||
echo "Usage:" | |||
echo " r.out.povscript dtm " | |||
echo "" | |||
echo "The script reports values according to the current region" | |||
exit 1 | |||
fi | |||
DEM=$1 | |||
# get n,s,e,w | |||
eval `g.region -g` | |||
# get extents | |||
eval `g.region -ge` | |||
# get centers | |||
eval `g.region -gc` | |||
echo "" | |||
echo " n:$n" | |||
echo " +-----------------+" | |||
echo " | |" | |||
echo " w:$w | | e:$e" | |||
echo " | |" | |||
echo " | c <-*C | c: center ($center_easting $center_northing)" | |||
echo " | | C: camera (pos: x 75%, y 50%)" | |||
echo " | |" | |||
echo " | | N-S extent: $ns_extent" | |||
echo " +-----------------+" | |||
echo " s:$s" | |||
echo " <- E-W extent: $ew_extent ->" | |||
echo "" | |||
echo "Povray control file parameters:" | |||
CAM1="`echo $e $w $ew_extent | awk '{printf "%f", (($1 + $2)/2 + ($3/4))}'`" | |||
CAM3="`echo $n $s | awk '{printf "%f", ($1 + $2)/2}'`" | |||
DEMZVAL="`r.what $DEM east_north=$CAM1,$CAM3 | cut -d'|' -f4`" | |||
DEMZVALHIGH="`echo $DEMZVAL | awk '{printf "%f", $1 + 700}'`" | |||
LOOK1="`echo $e $w | awk '{printf "%f", ($1 + $2)/2}'`" | |||
LOOK3="`echo $n $s | awk '{printf "%f", ($1 + $2)/2}'`" | |||
SCALE1=$cols | |||
SCALE3=$rows | |||
SUN1=$CAM1 | |||
SUN3="`echo $s $ns_extent | awk '{printf "%f", ($1 - $2)}'`" | |||
echo "light_source: < $SUN1, 7000, $SUN3 >" | |||
echo "Camera: < $CAM1, $DEMZVALHIGH, $CAM3 >" | |||
echo "Look at: < $LOOK1, $DEMZVAL, $LOOK3 >" | |||
echo "DEM scale: < $ew_extent, 65535, $ns_extent >" | |||
echo "DEM translate: < $w, 0, $s >" | |||
== See also == | == See also == |
Revision as of 21:16, 21 April 2009
About
POV-Ray is the Persistence of Vision Raytracer. It makes pretty 3D maps.
GRASS has r.out.pov and v.out.pov modules for outputting maps to the software.
Tips and tutorials
- Control scripts and example images by Markus Neteler
- Control scripts and example images by Dylan Beaudette
Script to generate camera parameters for Povray
This script is an easy way to get the camera parameters for povray. Use to personalize one of the control files downloadable above from M Neteler's old Web page:
#!/bin/sh # # generate useful parameters for POVRAY control file # Markus Neteler 7/2003 # $Date: 2005-02-10 17:56:18 +0100 (Do, 10 Feb 2005) $ if [ -z "$GISBASE" ] ; then echo "You must be in GRASS GIS to run this program." >&2 exit 1 fi if [ $# -lt 1 -o "$1" = "help" -o "$1" = "-h" -o "$1" = "--help" ] ; then echo "Script to generate POVRAY control file coordinates" echo "Usage:" echo " r.out.povscript dtm " echo "" echo "The script reports values according to the current region" exit 1 fi DEM=$1 # get n,s,e,w eval `g.region -g` # get extents eval `g.region -ge` # get centers eval `g.region -gc` echo "" echo " n:$n" echo " +-----------------+" echo " | |" echo " w:$w | | e:$e" echo " | |" echo " | c <-*C | c: center ($center_easting $center_northing)" echo " | | C: camera (pos: x 75%, y 50%)" echo " | |" echo " | | N-S extent: $ns_extent" echo " +-----------------+" echo " s:$s" echo " <- E-W extent: $ew_extent ->" echo "" echo "Povray control file parameters:" CAM1="`echo $e $w $ew_extent | awk '{printf "%f", (($1 + $2)/2 + ($3/4))}'`" CAM3="`echo $n $s | awk '{printf "%f", ($1 + $2)/2}'`" DEMZVAL="`r.what $DEM east_north=$CAM1,$CAM3 | cut -d'|' -f4`" DEMZVALHIGH="`echo $DEMZVAL | awk '{printf "%f", $1 + 700}'`" LOOK1="`echo $e $w | awk '{printf "%f", ($1 + $2)/2}'`" LOOK3="`echo $n $s | awk '{printf "%f", ($1 + $2)/2}'`" SCALE1=$cols SCALE3=$rows SUN1=$CAM1 SUN3="`echo $s $ns_extent | awk '{printf "%f", ($1 - $2)}'`" echo "light_source: < $SUN1, 7000, $SUN3 >" echo "Camera: < $CAM1, $DEMZVALHIGH, $CAM3 >" echo "Look at: < $LOOK1, $DEMZVAL, $LOOK3 >" echo "DEM scale: < $ew_extent, 65535, $ns_extent >" echo "DEM translate: < $w, 0, $s >"