Older blog entries for rmathew (starting at number 146)

Visual Effects in "The Chronicles of Narnia: The Lion, The Witch and The Wardrobe"
Thanks to Anirban Deb, I attended a presentation yesterday that was given by some of the guys from Rhythm and Hues India where they demonstrated how they created some of the visual effects in the recent movie "The Chronicles of Narnia: The Lion, The Witch and The Wardrobe". It was organised by ASIFA India and supported by CG Tantra, Animation 'Xpress and Women In Animation. The auditorium was full of interested people - students from the various animation training institutes in Bangalore, professionals from the animation and visual effects industry and "outsiders" (like yours truly) who were just curious about such things.

The presentation was enlightening in several ways. Some interesting tidbits included:

  • The lion Aslan was entirely CG! There were around 5 million strands of hair on this model and around 15 different types of hair. The model comprised the skeleton of the lion, the key muscles on its body, the skin and the fur. Its expressions were modelled on Gregory Peck's role as Atticus Finch in the movie "To Kill a Mockingbird", since they did not know who would provide the voice for Aslan till quite some time into the production. Fortunately for them, Liam Neeson's voice was not too far off the mark for the rendered expressions.
     
  • They used around 65 different types of characters in the final battle scene. They used the MASSIVE software to simulate a realistic battle scene comprising almost entirely of tens of thousands of animated characters. They used Level of Detail (LoD) to reduce the load on their render farm.
     
  • Their render farm for this project comprised around 2000 machines (I do not remember if they were dual-CPU Pentium 4s or Opterons). They also have a daemon on each employee's workstation that uses the idle time on that workstation to help with the rendering jobs. They use a custom Red Hat and SuSE distribution and all their employees use Linux on their desktop. All their assets are stored on centrally available file servers that virtualise access using a custom asset locator instead of ordinary file paths (this lets them easily move around stuff when discs get full for example). All the tools in their pipeline have been created in-house. All of this allows them to add capacity to their render farm as needed without wasting a tonne of money in software licenses or being at the mercy of a vendor to implement a feature they need immediately. It also insulates them from vendor bankruptcies which is apparently common in this industry.
     
  • Since rendering each frame in a shot was computationally very expensive, they used several aggressive techniques to reduce re-renders. For example, while using something like Phong shading, instead of rendering the whole frame in one go, they would separately keep the contributions of ambient, diffuse and specular (from each of the lights in the frame) and then combine these in a computationally trivial step to create the final image. This allowed their artists to tweak the colour, intensity, etc. of each light source to get the perfect look without having to submit a new job to the render farm.
     
  • Blend shapes are simple to use, but inaccurate, means to show character movement and expressions. Muscle deformations are more complex to use but volumetrically accurate. These guys created a tool that interpreted blend shapes to derive the corresponding muscle deformations to get the best of both worlds.
     
  • Normally PCs use 8-bits of intensity levels per Red, Green and Blue component to illuminate a pixel. Apparently this is not sufficient and produces banding effects due to loss of precision over several calculations. They were therefore using a 16-bit logarithmic intensity level per component for all intermediate calculations.
     
  • If one is to believe the presenters, apparently the visual effects guys are pretty low in the pecking order in a movie production. Something as simple as telling the director to not use bright green as the key colour when the background itself is green sunlit grass was beyond them.
     
  • I didn't understand it fully, but they apparently made a monetary loss on this project. It is also apparently a very low margin, high effort business requiring extremely talented artists.

It is also heartening to know that Blender 3D is getting better and better, especially for character animation, and we can actually do some of this stuff at home. Synfig, a 2D vector animation tool, also became Free recently though I do not know how good it is.

What Was Your First Computer?
Seen on Slashdot: "What Was Your First Computer?"

The first computer I worked on was the SCL Unicorn which was a clone of the BBC Micro Model B. This was a microcomputer based on the 6502 microprocessor and came with the OS and an interpreter for BASIC on ROM and 32KB of RAM.

13 Feb 2006 (updated 13 Feb 2006 at 07:00 UTC) »
C99
In a personal project, I have been using some of the niftier and simpler C99 features like //-style comments, mixed variable declarations and statements, the bool type with its true and false pre-defined values and the uint16_t, int32_t, etc. integral types from stdint.h. They resolve some of the minor irritants I used to face when I am forced to code in C89. I plan to use these features from C99 in all my personal projects written in C.

Unfortunately, compiler vendors do not seem too eager to support all the features in C99 even after a better part of a decade after the standard was released! Microsoft is surely not in a hurry to support C99 and GCC and glibc are still not completely there yet. A sad state of affairs. Either the standards committee was eager to get new features into C without a buy-in from the compiler vendors or the C coders have been a little underwhelmed with these features and hence have not been pushing for support for them in their compilers.

IITs All About
Someone has uploaded CBS's "60 Minutes" feature on the IITs to Google Video (thanks to Arpana for pointing me to this). There is a lot of truth accompanied by the usual hyperbole in this video with unfortunately some of the interviewed students also playing along. For instance, not everyone likes to stay up all night preparing for examinations, that too accompanied by a doting tea-making mother. Certainly not everyone has their entire family dropping them off at the examination centre and has them hanging around for the entire duration of the examination. "Puh-sycho!" It is also too much of a stretch to put the IITs above MIT, Princeton, CMU, etc. - they are each good and bad in their own ways.

For the IIT Kanpur junta, someone else has also uploaded the musical production targetted at nostalgic alumni "Din Bhar" to Google Video. You must see this at least once.

QEMU on steroids
First there was QEMU that provided a fairly fast emulation of x86 hardware using a technique called "dynamic translation". Then came kqemu (or QEMU Accelerator Module) that allowed user code (ring 3) to run directly on the actual hardware providing speedups of around 3-5 times. Now comes the -kernel-kqemu option that allows even some of kernel code (ring 0) to run directly on the actual hardware providing impressive speedups over the old kqemu. Of course, these speedups come at the cost of affecting the stability of the host OS because of bugs in kqemu. kqemu is also not Free software, though it is free (gratis) for non-commercial uses.

In other news, GCC's SVN repository is also available for read-only access via HTTP for those who are stuck behind corporate firewalls and want access to the latest sources without having to download weekly snapshots. Of course, this is slower than the SVN protocol and might also be pulled off if it contributes too much to the load on the server.

"A look at GCJ 4.1"
Mark Wielaard has written another article for LWN.net titled "A look at GCJ 4.1" (where he also looks at GCJ 4.2 and beyond). It is subscribers-only for the moment (for a week), but if you are interested in Linux in any way, you should seriously consider subscribing to LWN. It's quite good.
ECJ for GCJ?
Tom proposed killing GCJX and replacing it with the Eclipse compiler for Java (Eclipse JDT Core plug-in, known informally as ECJ). He has been almost single-handedly working on GCJX for more than a year and it looks pretty good already, so it is pretty courageous of him to be the one to propose using something else instead of GCJX in the overall interests of GCJ.

ECJ seems pretty good and very actively maintained. It must be one of the fastest Java compilers around and fully supports the new language features introduced in JDK 1.5. So it is a very good move for GCJ.

Using ECJ does introduce GCC bootstrapping issues though. However, it should be possible to easily overcome these issues. The bigger issues are political and legal in nature. Let us hope these are resolved favourably.

I personally feel a little sad though. This removes another "fun" part of GCJ even though it is pragmatically a better thing to do, especially considering the precious little resources that the GCJ project has. I feel that GCJ is becoming more and more an "integration" project combining the best-of-breed in Free software for a given task - the Java language compiler would be ECJ, the garbage collector is Boehm-GC, the runtime library is GNU Classpath and the optmisation and code-generation is done by GCC. Of course, this can hardly be characterised as bad and is in fact quite a sensible thing to do given the limited amount of resources that the Free software world has at its disposal, but...

"Lisp is Sin"
Sriram Krishnan writes an interesting weblog entry on Lisp. As a side-effect, it made me read some of Peter Norvig's essays and mark his book "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp" as well as Richard Gabriel's book "Patterns of Software: Tales from the Software Community" for later reading.
A Non-Invasive and Reversible Pre-processor for Java
I really like Per's implementation of a Java pre-processor.
rmathew.com
I have finally registered the domain rmathew.com for myself. It just points to my site hosted by Hosting Zero. The registration was surprisingly easy and rather quick. Within just a couple of minutes, the domain was accessible and the redirection was working. I chose GoDaddy.com even though they were more expensive for just the registration than Yahoo! because their private registration add-on turned out to be slightly cheaper on the whole than that of Yahoo! - I really do not want random people to access my personal information via a WHOIS lookup.

The "gotcha" about this registration turned out to be the fact that I inadvertently ended up with a pre-approved payment agreement with GoDaddy.com on my PayPal account, even though I had paid all the amount upfront and had marked my domain for manual renewal. Talking to their customer support didn't help much except stuff my mailbox with verbose and heavily graphic HTML messages. I have tried to contain the damage a bit by limiting the monthly outflow to USD 0.01, but I don't think I'll be sticking with them after my domain registration expires.

Profound Statement in Latin
Courtesy Anirban: "Quidquid Latine dictum sit, altum viditur" ("Whatever is said in Latin sounds profound").

Virtual Address Space Randomisation and Debugging
I feel rather silly today. Even though I knew about virtual address space randomisation in newer Linux kernels, it never struck me that I should disable it to get a reproducible debugging session with predictable breakpoint conditionals. My silly workaround was to use this patch:
Index: tree-ssa-operands.c
===================================================================
--- tree-ssa-operands.c (revision 109196)
+++ tree-ssa-operands.c (working copy)
@@ -1460,6 +1460,16 @@ get_call_expr_operands (tree stmt, tree
   tree op;
   int call_flags = call_expr_flags (expr);

+ if (strcmp (lang_hooks.decl_printable_name (current_function_decl, 2), + "of") == 0) + { + const char *called_f + = lang_hooks.decl_printable_name (TREE_OPERAND (TREE_OPERAND (stmt, 0), + 0), 2); + if (strcmp (called_f, "_Jv_ThrowBadArrayIndex") == 0) + printf ("Hello \"_Jv_ThrowBadArrayIndex\"!\n"); + } + if (!bitmap_empty_p (call_clobbered_vars)) { /* A 'pure' or a 'const' functions never call clobber anything.

and then put a breakpoint at the "printf" to get the debugger to stop the compiler process while processing the operands for the statement I was interested in.

Thanks to Mike Stump, we now have a page in the GCC Wiki that explains this problem and how to avoid it. Putting in the desired breakpoint is very simple now and avoids unnecessarily kludgy patches that contaminate the tree:

(gdb) b tree-ssa-operands.c:1463
Breakpoint 1 at 0x80d1f3f: file /extra/src/gcjx/gcc/gcc/tree-ssa-operands.c, line 1463.
(gdb) cond 1 stmt==0xb7c27fc8
Cool! Now all that is left is to use this breakpoint to figure out what the actual problem is that caused us to fire up a debugger.

137 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!