Suggestive Contours Code

Skull, 40000 faces

The little download counter on my super secret world domination dashboard indicates that my thesis code implementations of rendering suggestive contours on 3d meshes has been downloaded over a hundred times. Which tickles my curiosity.

If you’re doing anything fun, serious, silly (or can’t get the damn thing to work at all) with any of my implementations, don’t hesitate to drop me a line. After shedding tears, sweat, blood and probably various other bodily fluids over those implementations during the last year, it would be great to see them ending up in something awesome.

Displaying Shadow Volumes

Today I found a way to render the shadow volumes used in the stencil buffer technique I posted about yesterday in Ogre3D. Sometimes all you need is a ninja and three penguins to get a good insight. These are the shadow maps for one single point light source. Notice how the ninja’s katana extends the shadow volume significantly, and how the intersections of the shadow volume with the objects themselves define self-shadowing. Not shown in the picture is how the shadow volumes extend to infinity: this is necessary to be able to use Carmack’s Reverse.

Then we will fight in the shade

I’ve spent the day reading up on shadowing techniques for real-time rendering which can be used in the Ogre3D project I’m working on. I was not familiar with the details of the shadow volume method using stencil maps. It’s actually pretty clever, and it’s interesting to read how John Carmack (ID Software) developed the depth-fail-method (also known as Carmack’s Reverse) to be able to use the stencil shadow technique in scenes where the player/camera was inside the shadow volume. This is how they established the  shadows of those things creeping up behind you in Doom 3.

    Here’s a comparison I performed in Ogre3D:

    Some good resources (some outdated, but the basics still apply):

    Ogre3D ASCII

    I’m working my way through Ogre3D at the moment, to freshen up my C++/Visual Studio skills. I got my student copy from DreamSpark : seems that I’m still registered as a student, and thus qualified for free software - Yoink!. Browsing through the samples, I thought this was a nice touch: the SDK includes an ASCII shader (made in CG), sampling a 3D ASCII cube for values. It seems like a totally backwards way to approach rendering, but I like the silliness of it.

    What I’ll be doing with this engine is still a bit uncertain. I’m thinking about implementing my GPU-accelerated technique to draw suggestive contours, cooking up a game from scratch (an educative experience), … we’ll see where it leads!

    Compiling PBRT for Ubuntu

    If you want to experiment with Physically Based Rendering, PBRT is the tool to use. Unfortunately, the latest builds (>1.03) have some incomplete instructions on how to build PBRT on your own machine. I’ve built it on Ubuntu 9.10 and 10.04 using the following instructions:

    • PBRT needs the OpenEXR libraries, but unlike it mentions in its makefile, just installing openexr and libopenexr-dev is not enough. The full apt-get install line should read:
      sudo apt-get install openexr openexr-viewers libopenexr-dev libilmbase-dev.
    • The makefile looks for EXR libraries in /usr/local/*, while ubuntu installs them in /usr/lib. The following lines in the makefile should be changed:
      EXRINCLUDE = -I/usr/local/include/OpenEXR to EXRINCLUDE = -I/usr/include/OpenEXR
      EXRLIBDIR = -L/usr/local/lib
      to EXRLIBDIR = -L/usr/lib
    • PBRT should compile now, by running make in the source directory.
    • Before you can render scenes, you should set the PBRT_SEARCHPATH environment variable. In a terminal, type:
      export PBRT_SEARCHPATH = /location/to/pbrt/bin
      (the bin folder was created in the make process)

    Well, I hope this is a timesaver! :)