Librat is a free-ware Monte Carlo Ray Tracing Library developed at UCL Geography, by Prof. P. Lewis and Dr. M. Disney. The official documentation on Librat can be found here.

Source: http://graphics.stanford.edu/~henrik/ 

I had faced some difficulty, trying to get Librat up and running on my Ubuntu and so once I did, I decided to write a simplified set of instructions for others to follow. So here goes.


Installation

Download the installation bash script from here: http://www2.geog.ucl.ac.uk/~plewis/bpms/src/lib/configure

1. Make it executable:
 $ chmod +x configure.sh 

2. Run the script:
 $ /.configure.sh
You should find the directory 'bpms' under /home/yourUsrNm/ after completion of the script.

3. Download hipstats executable from http://www2.geog.ucl.ac.uk/~plewis/bpms/bin/x86_64/. Paste it in the home/yourUsrNm/bpms/bin/yourSystemArch directory

4. Set Path
 sudo gedit .bashrc
Append the following lines to .bashrc
export PATH=${PATH}:/home/yourUsrNm/bpms/bin/yourSystemArch
export PATH=${PATH}:/home/yourUsrNm/bpms/bin/csh
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/usrnm/bpms/src/lib
export BPMS=/home/yourUsrNm/bpms
#{Replace yourUsrNm with your Username}
#{Replace yourSystemArch with your system architecture | Can be found b 'uname -my'}
Save, Close and Reload .bashrc. ~/.bashrc

Running

1. Download and extract test examples say in a directory 'lidar' {preferably in the home directory} from here: http://www2.geog.ucl.ac.uk/~plewis/bpms/src/start/tests/lidar/lidar.tar.Z

cd into the extracted directory

echo 16 0 0 100000 200000 200000 512 512 1 heightmap2.hips | ../bpms/src/start/start -v testslope.obj

Explanation of the syntax can be found here: http://www2.geog.ucl.ac.uk/~plewis/bpms/src/start/tests/lidar/lidar1.html

It will generate the heightmap2.hips file.

hipstats < heightmap2.hips

This should give something on the lines of ' Frame 0 : n=262144 mean=549.504 SD=57666.326 Min=-99999.219 Max=99998.898'

2. Lets now convert the .hips file into a viewable image

linear < heightmap2.hips | hips2pbm > image.pbm

A file 'image.pbm' would be generated. You can view the file using

display image.pbm

3. Convert the image into a .gif using

convert image.pbm image.gif

You can now open the image.gif file to see the generated image.

If you see an image as expected, everything has worked fine. Go ahead and start working with Librat! Have a great day! :D