Planes, Textures, and Soft Shadows
My toy raytracer written in Scala got a few new features:
- Planes
- Textures
- “Soft Shadows” (distributed raytracing)
- Supersampling Anti-Aliasing
Textures don’t add much to the computation time, but distributed raytracing is a real performance killer (at least when implemented naively, as in my version). Essentially, when determining the surface color at a given point, instead of sending just one ray to a lightsource to see if it’s obstructed by any other object, many rays (typically at least 25) are sent out to an area that describes the light source (e.g. a box). The return values (black if the ray was obstructed, the light source color otherwise) are then averaged, leading to smooth transitions at the edges. And it does look nice… combined with supersampling (anti-aliasing) it now becomes easy to spend hours rendering a single image at, say, 1024×768 pixels.
Next idea: writing a parser combinator for (a subset of) POV-Ray’s Scene Description Language (SDL) to skip the painful step of modeling scenes in compiled code. This will also enable me to do some Scala coding again, since adding new features to the raytracer itself usually means spending much more time wrapping your head around math stuff than actually writing code.
Beware of avgnsx.exe
Wondering why my CPU usage peaked between 25 and 50% when using a download manager to max out the 16 MBit cable connection, it turned out that the “network scanner” in AVG 8 (free) is to blame. Even if the obnoxious link scanner (which loads every link in a Google search result and checks for “trojan” web sites) is disabled, AVG still monitors all network traffic on port 80.
The only solution (suggested in the AVG Free forum) is to reinstall AVG, choose a custom install and disable the link scanner… yikes.
Everything Is A Sphere
When I was down with a cold last week I dug out a book about computer graphics that I bought during my university time (3D Computer Graphics by Alan Watt). It provides a mathematical foundation for many core techniques in CG, and it got me interested again. About 8 years ago when I bought this book I wrote a small raytracer in C++, and since I am really in search for new hobbyist projects to teach myself Scala, I figured I could give it another shot.
Scala is a statically typed functional/object oriented language for the JVM and the CLR, and at least on the JVM it is known for providing performance similar to Java (in contrast to dynamic JVM languages such as Groovy or JRuby). This is the first scene that provides something my 8-year-old project couldn’t, namely a checkered surface (composed of two other surface instances). The code is pretty newbie-like and a bit unstructured, so for now I’ll leave it at that. FWIW, it took about 5 seconds to render this picture on my rather mundane home machine (Athlon X2 @ 2.2GHZ, Windows XP) using the 1.6.0_11 server JVM.
Not-so-white christmas, but still…
…it was great. Just for fun I mounted some really old tele lenses from my father on my EOS 450D, and managed (with great patience) to take some shots that were in-focus and reasonably illuminated.
The longest was a 300mm lens from his old Praktika, which went to about 1000mm with two tele-converters and considering the DSLR’s crop factor. Of course a tripod was mandatory, and I finally found a use for the 450D’s live view: sometimes it was easier to adjust the focus watching the back LCD screen, especially when the lighting was poor (I usually had to focus with the aperture wide open to be able to actually see something). With the ~1000mm I also had to use a 10-seconds-self-timer, because it would take the setup this long after pressing the button to stop swinging.
The outdoor photos were shot hand-held with a 135mm (before cropping) lens of a Yashica SLR. Photos 1-3 and 5 were taken with the 450’s kit lens.
Christmas is coming…
…that’s for sure. Still it feels a bit odd since we’re not even near the freezing point. The bad thing about this is that our “Punsch” (“glogg”?) doesn’t taste too well all by itself, it needs supporting low temperatures to ease the pain of its sweet, uber-aromatic taste.
Pure
After a pronounced hiatus from PC gaming for a variety of reasons, among them disappointment with recent PC releases, a stubborn resistance against MMOGs, and a slightly outdated home PC, it seems that my gaming passion returned. Two reasons: Pure and the Xbox-360 Controller.
Realizing that I wouldn’t fill my weekends playing with my amazing new camera, wouldn’t continue my bike tours around Vienna, wouldn’t be happy watching TV series and movies and reading all day when it’s -10 degrees outside, I considered gaming again. For most of my youth I was an avid gamer (always PC, for whatever reason) and equally interested in reading or writing about games as in playing them. This lead to my involvement in two German-speaking sites about PC games, Top of Games (retired) and Gametective (still active, although a bit low on updates and seriously hurting because of its 5-year-old codebase).
Having never been a console gamer, I envied the dynamics and excitement the current gaming consoles attracted during the past few years. While I almost fell asleep playing through the first (demo) level of Crysis, it seemed that all the good people (unless those in MMOGs and simulations) went to consoles first, for whatever reasons – probably market share, working copy protection and platform uniformity. Sure, I still played Civilization 4, had a few months of active racing in Race 07, and was blown away by Bioshock, but apart from that it felt like “more of the same”. I seriously considered (maybe still do) getting a Xbox 360 or Playstation 3, both formidable gaming platforms. My main reasons for not getting one are my cheap TV and (I have to admit) the game pricing. It seems that any new PS3 game, for example, prices between 60 and 70 Euros. A few months ago, that was over US$ 100 for a single game! I could get 10 books or DVDs for that. Also, looking closer at recent Xbox and PS3 releases, my excitement was dwindling. While there are many high-quality releases, few caused enough excitement to justify their premium price for me (although I’d love to do a few laps in Wipeout HD).
Although my home PC is now over 3 years old (I upgraded to a dual-core processor and more RAM for little money), the blocker for current PC games was the nVidia 7900GS card, which simply doesn’t have the power to run all the shaders and post-processing of current games at a full LCD resolution of 1680×1050. The first step obviously was a new graphics card. ATI recently introduced a new midprice GPU with lots of raw power for a reasonable price, the Radeon 4850. I settled for a variant by PowerColor with a silent cooler and wow!, Crysis does look amazing (but still bores me). Also, Adobe’s Lightroom feels a lot snappier.
But the real cause for my excitement is (the console port of) Pure and the Xbox 360 controller for Windows. First of all, the Xbox controller is the best value for money compared to any game controller I ever bought (followed by the amazing first Sidewinder joystick). For less than 30 Euros, you get two analog sticks (which also act as a button when pushed down), an 8-way pad, six buttons on top, two analog “triggers” (ideal for throttle and brakes) and another two buttons above them, and on top of that “rumble” functionality.
Finally, Pure.
It’s been a while since a game made me feel so good by doing all the tiny things which separate great games from good and mediocre ones. Pure is an ATV mud racer by Brighton-based Black Rock Studios. You race against AI or human opponents on fantastic tracks around the world, and get “boost” (some kind of nitro) by doing mid-air stunts. Sounds boring? It’s not.
First of all, being a port from the Xbox 360 Pure is a perfect match for the Xbox 360 controller. Although the button mapping is not entirely obvious, it takes about five minutes to get through the tutorial and and learn the basic moves. Then, instead of tormenting the player with gameplay details, the player is thrown into racing action. Of course, at first you don’t really know what you’re doing (or how you’re doing it), but you score a few points and get a sense of achievement soon.
Pure thrives on technical perfection: the graphics are jaw-dropping and smooth without a single hiccup. The music creates the right sense of “reckless fun” and seems to decrease in volume during long jumps, just to kick right in after the landing (or maybe I’m imagining this?). The controls are both complex and controllable. Everything in this game is optimized for fun: when you get thrown off the bike, the penalty is relatively low. You lose a few seconds and some boost, but return to the game at the crash site and at racing speed. It is almost impossible to lose the racing line. During the jumps the game slightly corrects your direction if you’d land outside the track otherwise. You can customize every part of your ATV, but don’t have to. Pure is not a simulation, and takes advantage from it.
Of course, there’s no light without shadow. The number of tracks is limited, and the three race types offer only so much variety. The online mode seems to be rather deserted, and the loading times could be better. But Pure achieves its main goal: delivering one of the best arcade racers in the last few years, miles ahead of any Need for Speed game for its innovation and pure gameplay quality.
Next, I might give GRID another chance (also much more fun when running at full resolution). Although I’m also a sim racer, these games offer a kind of instant gratification that a real sim can (and should) not.
Oh, and in four days we might have a black Formula 1 champion and a black US president. Times change after all.
Hello XO!
For learning a new language or framework, I tend to use tasks I’ve solved before – this way I’m more focused on the new platform instead of the problem itself. One such task is a sudoku solver, another tic-tac-toe. One rainy afternoon, trying to escape boreout at work, I mindlessly typed apt-get install tictactoe on my Ubuntu workstation, and I discovered that my Ruby tic-tac-toe client from 2002 is still in the Debian/Ubuntu repositories (and it actually works!).
I wanted to play around with Swing/Netbeans, so after a couple of evenings here’s the Java/Swing version (but this time, I hopefully did not mess up the negamax implementation): JTicTacToe (Webstart) – Sources
It was actually quite fun, except that I gave up forcing an initial size for the main application window. Seems like there’s no easy way of achieving this with the Swing Application Framework.
Home Improvement
Thanks to my father’s bed building skills I finally got a loft bed about 2 metres above the floor.
On unrelated fronts, I actually paid for the new Radiohead Album, didn’t like it on first listening, then got Saul Williams’ The Inevitable Rise and Liberation of NiggyTardust for free, and actually liked it. For better or worse, Trent Reznor’s influence is obvious, and there’s a nice Sunday Bloody Sunday cover on it.

















