PovRay Reference 2015-11-04

This post will cover many things that I have learned over the years using povray. The goal is to keep things simple and generate nice looking renders without too much complexity. I will also cover how to load simulation data for rendering.


When using radiosity I do not put in any extra light sources, povray describes this as Radiosity without conventional lighting. I find that this creates cleaner looking renders. In some cases where hard shadows are required or you want to have fine control over lighting you can add lights as needed.

Radiosity References

I usually start with the flowing settings and tweak from there. For most scenes I use a brightness value of 2.0 or 2.5 as there are no extra lights. Tweaking gray_threshold can be useful if you have bright objects and are getting too much color bleed.

#include "rad_def.inc"
// radiosity (global illumination) settings
global_settings { 
	Rad_Settings(Radiosity_OutdoorHQ, off, off)
	//Increase object brightness (default 1.0)
	brightness 2.0
	// values < 1.0 reduce the influence of colors on indirect light (aka color bleed)
	gray_threshold 1.0 
//Create a white background to add env lighting
background { color rgb<1,1,1>  }

CMake, CUDA Separable Compilation Error "relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC" 2015-10-22

When using CUDA separable compilation in newer versions of CUDA (> 5.0) I was getting the following error. Note that I am using CMake to generate my Makefiles

relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC

Most resources I found told to add the “–compiler-options -fPIC” option to NVCC

SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}; --compiler-options -fPIC)

But this did not fix the problem, it turns out that in CMake versions prior to 3.2 there is a bug in the way that separable compilation is handled with CUDA. Unfortunately the version of CentOS that we run on our cluster does not had a newer version of CMake available in the default repository. My crude fix was to compile CMake manually and install it to ~/bin/ in my home directory.

Wanted to document it here for future reference, it was not immediately apparent that it was a CMake issue.


Personal Slurm Reference 2015-10-18

Slurm reference and useful things for running jobs on the labs cluster. Might be useful for other people, posting here for future reference.

Base slurm batch file

#SBATCH -N 1                      # This requests one node
#SBATCH -n 8                      # Request 8 cores on a node
#SBATCH -t 0-10:00                # Walltime days-hours:minutes
#SBATCH --job-name=job_name       # Name of the job
#SBATCH --array=0-100             # Array job with 100 tasks
cd $SLURM_SUBMIT_DIR              # Change directory to the one where the script was executed
./ThingToRun $SLURM_ARRAY_TASK_ID # Executable that will be run for this job

Reveal.js Vimeo slideshow 2015-10-17

In the lab we’ve sometimes had to show videos at open-house like events for the department or when visitors come. I’d implemented a slideshow using reveal.js and froogaloop in the past but the code was lost to time. I figured that this time I would document it for future use.

For completeness a working example is here

Beyond the Reveal.js and Froogaloop documentations this page has a useful example.


  • Start when user hits the right/left arrow or the play button is clicked on the first video
  • Pause the current video if the next/previous slide is pressed before the current video ends
  • Specify videos in a list that can easily be added/removed from

Asynchronous Simulation And Storage 2015-10-12

This post is about solving a problem that has always been at the back of my mind: How can I speed up my simulations when I have large amounts of File I/O to perform. In many cases I have to write simulation data at 60 FPS for rendering purposes and it can take many seconds to compress and write out a large set of data while it only takes a second or two to simulate.

In this post I will show a simple snippet of code that builds upon an earlier post about using gzwrite to compress data.