svg pipeline to panda3d


I’ve been working on a pipeline that translates a svg file into an egg file and a number of png images. The primary goal was to use the svg authoring tool as a drawing tool for a gui. The tool currently is in a beta status.

The tool is comparable with egg-texture-cards tool delivered with Panda3D. Different features are:

  • accepts svg files
  • allows meta information in the svg file to be stored in the egg file (can be used to construct the DirectXXX components from the egg file)
  • generates code on the fly based on simple template mechanism

I’ve created a project space on Sourceforge where the tool is now uploaded. The download delivers a binary for windows and the source code (C++ and Qt). To use the tool, you also need Inkscape installed.

If you have comments on the tool, remarks, ideas. I’d like to hear them.


I can’t look into the code (because of SourceForge’s stupidity), but the idea sounds neat.
There are a few SVG to raster converters, but most of them are buggy or only for a specific OS.

Your app depends on Qt and Inkscape, which doesn’t make it suitable for everybody, but it brings up an idea:
How about having a native SVG renderer integrated in Panda? You would load your SVG textures same way as usual textures only with a size parameter that defines the pixel-size of the result, which will be loaded and mapped onto an object.
This sounds quite complicated, but in real it would bring two big features:
[color=green]+ very small texture file sizes independent of the actually rendered textures’ size

  • textures virtually available in all sizes. you could even render at 4096² or more (only the graphics card or RAM limits you)
  • all compression is lossless (other than e.g. JPG)

The price for these features is:
[color=darkred]- you’d have to create your textures as vector graphics, which in some cases might become more difficult than raster

  • the rendering takes some time depeding on the complexity. means longer loading times (might be straightened out with short loading times of the SVGs from disk)

I once tried out a product of Allegorithmic (specialist in vector textures) which basically did this on runtime. It had a few modules for some game engines so that they can load their texture files (i guess something like extended SVG). According to what they say the idea works out very well.

Long story short: +1 for native SVG support.

True it would be great if Panda supports the svg file format. However, I’ve spent many hours searching for a good svg library that can render svg images. This is not an easy thing to do since the svg standard has become quite complex. My hope is that one day the Qt framework fully supports the svg standard. Then I can remove the inkscape dependency. That would help.

B.t.w. the source code is not yet uploaded on sourceforge, however it is included in the installer. So run the installer and you can check the source code. I’ve also added a sample project.

I can’t run a windows executable on my non-windows OS.

Makes sense. I’ve uploaded a zip holding only the source code. Its developed with the mingw compiler, qt-framework 4.6 and codeblocks ide. Could you try to build it? I’m really interested in how cross-platform this toolset actually is.

Note that if you manage to build it, remember that you need Inkscape on the local system to use it.

If you run into trouble, don’t hesitate to mail.

And after many tries I’ve managed to upload the source code into a SVN repository. So if you have a subversion client, you can download a copy of the code.

+1 for native svg support

Why can’t Cairo and RSVG be the answer? They are cross-platform afaik.

  1. SVG (just xml text)
  2. –> lxml --> objects in ram
  3. –> manipulate as required
  4. –> RSVG render_Cairo (to context)
    (or parse and draw ‘manually’ with Cairo.)
  5. –> Transfer bitmap to Panda.

Step 5 is hackey, to say the least – I didn’t have time to get a working result.
(I got a lot of crazy-looking effects that reminded me of my old Z80A days in front of a television on my Spectravideo-318!)

I have mentioned this before; in another thread; what is it that the Clutter-Project peeps are doing that is working so well? In that world you can draw textures in pure Cairo (or via RSVG) and have singing-dancing polygons without any sweat.


Argh, spam! How does one report it?