Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Off-line rendering and block editor

Sign in to follow this  
Arjan B


A lot of progress in this new entry! We have implemented the octree, which makes our renderer scale well with a large number of objects in our scenes. We have finished our block editor, which allows us to create, save and load worlds to render. And finally, we added some form of offline rendering.

Off-line renderer - Be sure to watch in 720p!


I've implemented a system in which you give a set of (point, direction) pairs, which the camera will be at at some point. You also specify a list of times, which indicate the time it takes for the camera to go from one pair to the next. If you now specify the number of frames per second, the system will interpolate all camera positions and directions for all frames.

Using this system, I set the camera position and direction, let it run a given number of samples per pixel, save the resulting image as a .jpeg file, and then move on to the next position and direction. In the end, I use some other program (MonkeyJam) to paste all these images together into a movie file.

The YouTube movie you see above is rendered at 1280x720, with 200 samples per pixel, at 30 frames per second.

Block editor


We can move around, much like a ghost cam in some FPS. You use ASWD to move around, Spacebar and CTRL to ascend and descend, and the mouse to look around. Left mouse-click adds an object, while right mouse-click removes one.

Using other keys on the keyboard, you can choose which color the next object will have, its material type, its albedo (or brightness for a light), and its shape. You can also increase and decrease the brightness of the "skylight".


My friend did all the work on the octree. Since CUDA doesn't support recursion very well, we had to do all operations on this tree stackless.


We are happy with the results, though we did expect more speed gain from the switch to CUDA. Since we are not using textures or meshes, all we have in GPU memory is our octree, which is rather small. The time spent on memory access was rather insignificant compared to time spent on performing calculations. This made a lot of memory optimizations, which we learned about in class, not useful.

We think that the minor gains are to blame on the very branching nature of our kernels. Running one instruction on a whole lot of different data is fast, but if the instruction that we're at with the calculations for one pixel is different from another, we won't benefit from this. So whenever one ray hits a different type of material than another ray does, a different piece of code is run to sample the new direction. We think that the path tracer would be a whole lot faster if we could figure out ways to reduce the branching.
Sign in to follow this  


Recommended Comments

Nice! Stackless is definitely the way to go. For materials, this is something I had issues with as well, eventually I determined the best approach may simply be to have a "one size fits all", very generic material, and encode the material parameters for each object in textures. That way the nasty branching is converted into texture fetches, something GPU's can deal with (sort of). The catch with this is that you can't apply material-specific optimizations, which can be a big problem when doing importance sampling, but for a limited set of materials it would work pretty well I think, so it might be worth looking into.

Share this comment

Link to comment

Sounds like a good plan! But those courses are now done, which means I have a lot less time for this project. Since the performance is at acceptable levels, I will probably start with adding new features such as textures and meshes. Probably, I will then need to start working on some speedup and will give your suggestion a try. :)

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!