Executable for "Tokap Sphere Stack with Bullet Physics Release" at http://code.google.com/p/tokap-the-once-known-as-pong/downloads/list (this version is the release version and should run without needing the Visual C++ 2008 Redistributable package for x86)
Quasi-random, more or less unbiased blog about real-time photorealistic GPU rendering
Sunday, July 31, 2011
TOKAP with Bullet: Mirror physics
Update to my previous post, just to show that the scene remains fully customizable at runtime:
Saturday, July 30, 2011
Bullet Physics demo 3: Collapsing stack of balls + EXE
Yesterday I got a new idea for a real-time path traced Bullet physics animation: a collapsing stack of spheres. The plan:
I've implemented the scene and physics in both the tokaspt and the Simplex Paternitas path tracers to see the difference in framerate and realism.
Picture from Tokap (some circular artefacts which look kinda cool :) :
Picture from the Futuristic Buildings (Simplex Paternitas) path tracer:
All videos below were rendered in real-time on my poor little 8600M GT, probably one of the weakest CUDA-enabled cards in existence. Every animation below should run smoothly and at much higher quality on a GTX 260 or higher:
Tokap with Bullet 4 spp:
Futuristic Buildings with Bullet 12 spp:
Futuristic Buildings with Bullet 24 spp:
Futuristic Buildings with Bullet 4 spp, Eagle's view:
Download the executable for "TOKAP Bullet Sphere Stack" at http://code.google.com/p/tokap-the-once-known-as-pong/downloads/list
UPDATE: Some people have reported that the Bullet demos don't work on their systems, receiving the following message:
"Activation context generation failed for "programme name".
Dependent Assembly Microsoft.VC90.DebugCRT, processorArchitecture="x86", publicKeyToken = "1fc8b3b9a1e18e3b", type="win32", version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis."
This error is due to the fact that the demos were compiled with the Bullet library in debug mode and are dependent on the Visual C++ 2008 runtime library. Downloading the Microsoft Visual C++ 2008 Redistributable Package (x86) from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=29 should solve the issue.
Friday, July 29, 2011
Bullet Physics in Simplex Paternitas path tracer
Someone on youtube suggested to make a version of the physics animation from my previous post where the scene is only lit by the small white ball on top. For this purpose I've incorporated the Bullet library to the Simplex Paternitas path tracer of Jacco Bikker. The results are pretty wicked:
This video was rendered on a 8600M GT, 12 spp, 480x360 resolution:
Without caustic noise (only reflective and diffuse balls, 12 spp, 640x480 resolution on 8600M GT):
The new executable and source code are available at http://code.google.com/p/tokap-the-once-known-as-pong/downloads/list
Damn this stuff is really addictive!
Thursday, July 28, 2011
TOKAP with Bullet demo 2
While working on the car physics for the Futuristic Buildings demo, I've decided to first finish something that I wanted to do for a long time: a real-time version of a Bullet Physics animation created by Chiaroscuro (Phymec on Youtube) which was rendered off-line with SmallptGPU (OpenCL path tracing) and can be seen at
http://www.youtube.com/watch?v=33rU1axSKhQ
http://www.youtube.com/watch?v=33rU1axSKhQ
I've recreated the scene in TOKAP, added physical properties to the balls with Bullet Physics et voilà:
The above video was rendered on a ultra-low end GPU (8600M GT). The animation should run at 60 fps on a GTX 580 at 8spp at default resolution. Physically accurate lighting + physics in real-time!!!
Caustics:
Download the executable at:
The above video was rendered on a ultra-low end GPU (8600M GT). The animation should run at 60 fps on a GTX 580 at 8spp at default resolution. Physically accurate lighting + physics in real-time!!!
Caustics:
Download the executable at:
Wednesday, July 27, 2011
Latest version of Futuristic Buildings with AABB
I've implemented tight fitting AABB hitboxes around the car and the two buildings, which gives a nice performance boost of about 50-200%, depending on the viewpoint. Since the car can be moved (with the I, J, K, L keys), the AABB around the car is moving with it and its position is updated every frame.
Download the executables and the source code for "Futuristic Buildings v2.9 with AABB" from http://code.google.com/p/tokap-the-once-known-as-pong/downloads/list
Real car physics are coming up next. After those are in, OBBs (oriented bounding boxes) or oriented cylinders (depending on which one's cheaper to intersect) are on the todo list for some crazy real-time path traced physics simulations.
Tuesday, July 26, 2011
VoxelPipe paper and a preview of real-time path traced global illumination
Just read Nvidia's HPG 2011 paper "VoxelPipe: A Programmable Pipeline for 3D Voxelization" by Jacopo Pantaleoni. One thing that immediately caught attention was the preview of a real-time global illumination system, in which primary rays are traced against the regular triangle version of the scene, but secondary incoherent rays are traced against a voxelized version of the scene which is much more efficient intersection-wise. Scene voxelization is performed every frame (it takes only a few milliseconds even for multi-million triangle scenes), so this allows for completely dynamic scenes with (path traced) global illumination in real-time. From the paper:
"Finally, in Figure 5 we show a proof of concept of a real-time global illumination system that we plan to disclose in the near future. The system relies on our voxelization pipeline to create a proxy of the scene geometry that is used to trace incoherent rays. The proxy is rebuilt every frame, allowing support of fully dynamic geometry, materials and lighting."
Combined with previous work from Pantaleoni on PantaRay (an out-of-core GPU ray tracing renderer for precomputing GI with LOD techniques, which was used in "Avatar") and on HLBVH and a yet to be released paper from Pantaleoni and Garanzha on "Simpler and Faster HLBVH with Work Queues" (which describes a system for real-time raytracing of dynamic scenes), this new voxelization technique could do wonders for real-time high quality global illumination and also for unbiased real-time GPU renderers.
Writing real-time path tracing demos
Several readers of this blog (woohoo I've got readers ;-) have asked me what skills you need to learn to make the demos that I've posted. To those, I want to give some C++ pointers (pun intended) in this post.
Six months ago, I didn't know anything about programming (let alone C++). After seeing some amazing real-time path tracing demos on the net (like Jacco Bikker's Brigade), I wanted to write my own stuff because I had some ideas that I wanted to see materialized (such as the Pong game for which I got the help from Kerrash, a programmer with CUDA experience). I didn't want to be too dependent on other programmers so I decided to learn C++ on my own in my spare time. I've read some C++ tutorials on the net and some excellent books that have been a great help in understanding the C++ language and writing your own programs. This is the list of books and websites that I've read:
- "Beginning programming with C++ for Dummies", an excellent beginner's book, easy to read, explains the concept of object-oriented programming very well
- "C++ without Fear", another great book, which delves deeper into the basics than the first book and also discusses code optimization
- tutorials on www.learncpp.com, this is a great website with lots of small Q&A's, and also discusses smaller subjects like enums
- "Practical C++ Programming", this is a little bit harder than the first two books (especially the exercises)
Other books that were recommended by others (that I haven't read yet):
- "Thinking in C++"
- "Accelerated C++"
- "Effective C++"
Reading these books and doing the exercises with perseverance, I slowly got a hold on the C++ language. Frankly I'm amazed that the language becomes almost second nature so quickly. I'm still getting compiler errors that I don't understand, but luckily there is Google, which quickly solves the problem in most cases.
In order to write a real-time path tracing demo, learning C++ is not enough. Some basic knowledge about ray tracing and path tracing is necessary as well. "Realistic Ray Tracing" by Shirley is an excellent resource for this. There are also lots of powerpoint presentations about ray tracing and Monte Carlo rendering on the net.
Not having the patience to reinvent the wheel of real-time path tracing, I wanted to base my path tracing demos on existing open source code that I knew was ultrafast and ultra-efficient. So I did some research on the net. This is what I came up with:
- tokaspt, an excellent real-time CUDA path tracer
- smallpt, a very short but complete CPU path tracer by Kevin Beason (not real-time)
- smallptGPU, a real-time OpenCL path tracer by Dade from LuxRender
- Javor's CUDA path tracer (click on the thumbnail to download the demo)
- Understanding the Efficiency of Ray Traversal on GPUs, ultra-fast CUDA path tracing code by Timo Aila and Samuli Laine
- Brigade path tracer, real-time CPU/GPU(cuda) path tracer by Jacco Bikker
- Kajiya demo, a real-time CUDA path tracer by Jacco Bikker and Jeroen van Schijndel, very well optimized
- Simplex Paternitas, another real-time CUDA path tracer by Jacco Bikker, this is an excellent starting point for learning to write new code and add new objects and animations (and see the results immediately). You don't have to touch the CUDA part of the code (although it's quite easy to understand once you're familiar with C++). Every frame, all the framedata is passed from C++ to CUDA, so you only need to know C++ to write new animations and to add a physics library like Bullet Physics.
Adding the Bullet Physics library to the code (as shown in my latest demo) and learning the Bullet API was actually not so difficult in retrospect (the Hello World example included in the Bullet SDK was very helpful in this respect). Right now, I'm incorporating the vehicle physics from the Bullet SDK into the Futuristic Buildings demo (which is based on the code framework of the Simplex Paternitas demo). It's kinda working right now, but I won't make a vid until I'm satisfied. The AABB hitboxes for the car and buildings are almost working as well (after identifying which variable triggered the ray shooting functions using the hitboxes).
To summarize, learning the basics of C++ is a must. You have to invest some time in it (it took me about 3 months of learning in my spare time to get a good grasp on the basics and an additional month to read and understand someone else's code and adding own stuff). Understanding the structure of a program (which functions call other functions, which loop is the control flow entering, what stuff has to be initialized before rendering the first frame, how are variables efficiently shared between files, ...) is extremely important. From that point, you'll need creativity and perseverance to make an interesting demo and the possibilities will only be limited by imagination. A cool idea would be this one (this should be possible with fewer planks (20-30) in real-time once I've added support for oriented bounding boxes to represent the planks).
Monday, July 25, 2011
Paper on accelerating path tracing using eye path reprojection available
The paper "Accelerating path tracing by eye path reprojection" by Niklas Henrich et al., which I blogged about earlier is available from http://www.rendering.ovgu.de/publikationen.html. The algorithm achieves similar quality as regular path tracing in half the time and can easily be ported to the GPU. The authors also plan to incorporate their technique into a real-time raytracer.
Saturday, July 23, 2011
Videos on GTS 450
I've made two video's of somewhat better quality, resolution and framerate on the GTS 450, which is about 5x faster than a 8600M GT in Tokap (and about 8x faster in Futuristic Buildings).
The animation is now being rendered at 60 fps, 8 spp per frame and 512x256 resolution. The physics simulation itself runs internally at 60 fps, so the physics are rendered in "true" real-time.
Video of Future Buildings v2 ( 8 spp per frame, 640x480 resolution, still no acceleration structures):
The source code for "TOKAP with Bullet Physics" is available at http://code.google.com/p/tokap-the-once-known-as-pong/downloads/list
Wednesday, July 20, 2011
Bullet Physics! It works!!!
I've been wanting to integrate the Bullet Physics library in the real-time path tracing demo's like Tokap and Unbiased Truck Soccer for a while now (since February actually), but I lacked the programming knowledge and experience to make it work back then. Today I've finally made it work, which will open up lots of new gameplay ideas for future demo's.
I retrofitted TOKAP (the real-time path traced 3D Pong) with the Bullet physics library and the results are awesome, even though I have only tested it on a very low-end 8600M GT.
Below is a very low-res video captured in real-time on a 8600M GT at 256x256 resolution and 4spp (I will soon make a higher quality video with a GTS450):
The physics simulation can be stepped and paused by holding down the UP key. You can walk around the scene during simulation or when the simulation is paused as shown in the video. The simulation is deterministic, so it will produce the exact same result every time it runs.
Now that I've passed this hurdle, the possibilities are endless and I will finally be able to implement proper car physics (see http://raytracey.blogspot.com/2011/03/unbiased-truck-soccer-first-physics.html).
UPDATE: The source code is also available at http://code.google.com/p/tokap-the-once-known-as-pong/downloads/list
Tuesday, July 19, 2011
Update 2 on Futuristic Buildings
There are no 'hitboxes' (aabb acceleration structure) around the car and the buildings yet, which is responsible for the greatly reduced framerate. The path tracing performance should get a nice boost once they are implemented.
Video rendered on the ultra low end 8600M GT (4 spp at 480x360):
Download the new demo at http://code.google.com/p/tokap-the-once-known-as-pong/downloads/list
Next on my todo list:
- implement AABB hitboxes to boost performance
- make the car "drivable" with the keyboard and track the car with the camera
- get Bullet physics in for some real gameplay (this is quite tricky)
- implement oriented bounding boxes (ray-OBB intersection is similar to ray-AABB intersection but there is an additional cost because every ray first needs to be multiplied by the inverse transformation matrix of the OBB). OBBs will be needed for creating physics animations involving collapsing buildings like this one
Video rendered on the ultra low end 8600M GT (4 spp at 480x360):
Download the new demo at http://code.google.com/p/tokap-the-once-known-as-pong/downloads/list
Next on my todo list:
- implement AABB hitboxes to boost performance
- make the car "drivable" with the keyboard and track the car with the camera
- get Bullet physics in for some real gameplay (this is quite tricky)
- implement oriented bounding boxes (ray-OBB intersection is similar to ray-AABB intersection but there is an additional cost because every ray first needs to be multiplied by the inverse transformation matrix of the OBB). OBBs will be needed for creating physics animations involving collapsing buildings like this one
- (add more sorts of geometric primitives: cylinders, cones, tori, capsules)
- (add more complex materials like coated glossy with roughness and fresnel parameters)
- (add a GUI with sliders using nv widgets)
- (make an OpenCL version)
UPDATE:
The car mechanics are sorta working now. The choppy framerate in the video below is due to the fact that it's still being rendered on a 8600M GT and because there aren't any acceleration structures yet. I bet this will run smooth as butter on a GTX 580 :D. I also temporarily removed the second skyscraper until the AABB acceleration structures are properly implemented:
Download the executable demo "Futuristic Buildings Drivable Car" from http://code.google.com/p/tokap-the-once-known-as-pong/downloads/list
Monday, July 18, 2011
Update on Futuristic Buildings
Update on my previous post: I brought back my beloved car character from Unbiased Truck Soccer. Some images (rendered blazingly fast at 16 spp per frame):
One 720p image (16 spp, almost no noise to be found):
There still isn't an acceleration structure for the car (in this case an axis aligned bounding box), which degrades the path tracing performance a little, but the code for should be done soon. After that I'm going to make the car user controllable. There's also a new 'futuristic building' which degrades performance even more, so it will need a hitbox as well:
One 720p image (16 spp, almost no noise to be found):
I still have to create a tight fitting bounding box around the car to increase the path tracing performance (although the performance is still quite good without it). The source code of Simplex Paternitas also provides examples of rotation matrices and scripted camera animation sequences, so there are lots of cool things left to explore. The car will eventually be user controllable with a camera following the car and in contrast to my previous demos featuring the car (Unbiased Truck Soccer etc.), it will also be able to rotate instead of just translate.
UPDATE: The rotation of the car is now working. Below is a video that was rendered on my 8600M GT with only 4 samples per pixel per frame (framerate is about 5 fps at 640x480 resolution).
UPDATE: The rotation of the car is now working. Below is a video that was rendered on my 8600M GT with only 4 samples per pixel per frame (framerate is about 5 fps at 640x480 resolution).
There still isn't an acceleration structure for the car (in this case an axis aligned bounding box), which degrades the path tracing performance a little, but the code for should be done soon. After that I'm going to make the car user controllable. There's also a new 'futuristic building' which degrades performance even more, so it will need a hitbox as well:
Sunday, July 17, 2011
"Futuristic Buildings" a new real-time path traced demo
I've decided to put my freshly learned C++ skills to the test, and what better way is there than modifying the source code of an already awesome program, in this case the recently released real-time path tracer "Simplex Paternitas" by Jacco Bikker. For "Futuristic Buildings" I modified some of the animation from Simplex Paternitas, added some new animations and also a new "skyscraper" building with moving spheres.
The purpose of this demo was to emphasize the extraordinary capabilities of this path tracer, in particular the ultra-high-quality global illumination with color bleeding and dynamic soft shadows at real-time framerates. The demo renders almost noise-free images at 16 samples per pixel and should render them very fast when you have a high end GPU (>30 fps I guess, I only tested it with a 8600 M GT).
Some images:
Download "Futuristic Buildings" at
http://code.google.com/p/tokap-the-once-known-as-pong/downloads/list
A CUDA enabled GPU is required as the path tracing happens entirely on the GPU.
This is work in progress of course, I'm planning to add another building and a user-controllable character (the truck from Unbiased Truck Soccer :) . A video should follow soon.
The purpose of this demo was to emphasize the extraordinary capabilities of this path tracer, in particular the ultra-high-quality global illumination with color bleeding and dynamic soft shadows at real-time framerates. The demo renders almost noise-free images at 16 samples per pixel and should render them very fast when you have a high end GPU (>30 fps I guess, I only tested it with a 8600 M GT).
Some images:
Download "Futuristic Buildings" at
http://code.google.com/p/tokap-the-once-known-as-pong/downloads/list
A CUDA enabled GPU is required as the path tracing happens entirely on the GPU.
This is work in progress of course, I'm planning to add another building and a user-controllable character (the truck from Unbiased Truck Soccer :) . A video should follow soon.
Friday, July 15, 2011
Simplex Paternitas, a real-time path traced animation by Jacco Bikker
Jacco Bikker (developer of the Brigade path tracer and Arauna ray tracer) has released a cool video and executable demo of a real-time path traced animation called "Simplex Paternitas" created for iGathering 2011 (a demoscene festival organised at IGAD):
http://www.youtube.com/watch?v=PaTz9tJ7_KY
The demo in the video runs smoothly on just one GTX 470. Links to the executable demo and source code can be found in the video description. I've tried the 32 spp demo on my laptop with 8600M GT and got around 2 fps! :)
Soft shadows, refraction and caustics
Accurate color bleeding from the blue and red walls is clearly visible in the shadows of the characters and reflective sphere
The animation reminds me of vintage CG from the eighties (like this one) which was rendered with either rasterization or Whitted-style ray tracing and needed several CPU hours per frame, while this is path traced in just a few milliseconds per frame.
http://www.youtube.com/watch?v=PaTz9tJ7_KY
The demo in the video runs smoothly on just one GTX 470. Links to the executable demo and source code can be found in the video description. I've tried the 32 spp demo on my laptop with 8600M GT and got around 2 fps! :)
Soft shadows, refraction and caustics
Accurate color bleeding from the blue and red walls is clearly visible in the shadows of the characters and reflective sphere
The animation reminds me of vintage CG from the eighties (like this one) which was rendered with either rasterization or Whitted-style ray tracing and needed several CPU hours per frame, while this is path traced in just a few milliseconds per frame.
UPDATE: I tinkered a bit with the scene parameters (different colors and materials and brighter sky). The image is taken at 28 samples per pixel. There is some slight greenish color bleeding from the ground onto the bottom half of the spheres and the character (not Kirby :) I will upload a video very soon. Even at 16 spp, there is almost no noise in the outdoor scene except for refractive spheres.
Wednesday, July 13, 2011
Trailer for Reflect, the first real-time path traced game
A video of the Portal-inspired game "Reflect", which uses the Brigade path tracer has surfaced on Youtube (sassy soundtrack included):
http://www.youtube.com/watch?v=qntMz2QPA_E
The game is running on 2 Xeon (quad core) CPUs and 2 GTX 460s in this video. The number of indirect light bounces seems rather low, but the mere fact that path tracing can be done at playable framerates and reasonable noise levels is quite a breakthrough. Real-time path tracing for games is finally becoming reality, and this is just the beginning. Congratz to the team behind Reflect!
UPDATE: there's another video of Reflect which is slightly less noisy: http://www.youtube.com/watch?v=z27EpDJprQg
http://www.youtube.com/watch?v=qntMz2QPA_E
The game is running on 2 Xeon (quad core) CPUs and 2 GTX 460s in this video. The number of indirect light bounces seems rather low, but the mere fact that path tracing can be done at playable framerates and reasonable noise levels is quite a breakthrough. Real-time path tracing for games is finally becoming reality, and this is just the beginning. Congratz to the team behind Reflect!
UPDATE: there's another video of Reflect which is slightly less noisy: http://www.youtube.com/watch?v=z27EpDJprQg
Monday, July 4, 2011
EGSR 2011 paper on real-time noise-free GPU path tracing
Just read an interesting paper called "Guided Image Filtering for Interactive High-quality Global Illumination" by Bauszat, Eisemann and Magnor, which was accepted at EGSR 2011. The paper describes a novel method for edge-aware filtering of noisy path traced images using the normal and depth buffers instead of the noise image itself. The indirect lighting is filtered separately from the direct lighting and the whole pipeline (path tracing + filtering) is implemented on the GPU using CUDA (the numbers in the paper are obtained with a GTX 285). The new method is compared to cross bilateral filtering and the edge-avoiding à-trous wavelet filter described in a HPG paper from last year and the results seem very promising.
I very much agree with the introduction to the paper:
"...many approximations exist to reproduce certain effects of the real global illumination and try to incorporate it into a classic rasterizer. Unfortunately, in order to speed up the computation they are either aiming at simulating only a single effect, like soft shadows [ED08] or ambient occlusion [RGS09] or they are are limited to certain constraints, requiring low-frequency lighting environments [SKS02], static scenes [LSK07] or precise parameter adjustment for varying scenes [RGK08]. Code complexity increases tremendously for systems that simulate global illumination effects using rasterization because multiple approximations need to be combined to achieve a sufficient visual quality. On the other hand path tracing naturally incorporates all these effects with a very simple rendering algorithm.
Another drawback of approximative algorithms is that they not necessarily converge to the correct result. Therefore, they will only become faster with better hardware but do not necessarily produce a higher quality result. Instead of trying to incorporate global illumination effects into a rendering pipeline which is not capable of physically correct rendering, it is a much more promising design to take a physically valid rendering approach and implement approximative algorithms on top to speed up the rendering. Designing them in an adjustable way results in a very future-oriented rendering paradigm."
Research in fast interactive GPU path tracing with minimal noise has made enormous advancements over the past year and I'm confident that real-time high-quality path traced global illumination for games will be feasible soon.
Subscribe to:
Posts (Atom)