Anyone Interest in implementing SVG

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Anyone Interest in implementing SVG

Post by Masdus »

I was thinking about implementing a SVG render for irrlicht for 2D objects. As this is a vector format it would have the advantage of being scalable at different screen resolutions, so in theory the GUI images will scale to match the current screen res.

Before i started though i wanted to see if people would be interested in this. Any thoughts?
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

It sounds awesome! It would save us from creating a different configuration, with different image sizes for each in case we want to create a "settings" menu to choose screen res from.

but I know it's not an easy task, so the real question would be: how are you planning to implement it?

btw; I was just reading the specs; pretty interesting!!!

I second your motion; better said, anything that imrpoves the Irrlicht engine must be supported. We'd still have to see what Niko says about it, otherwise it's perfect for NX.

SVG specs:
http://www.w3.org/TR/SVG/
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

I'm still reading the specs before i finalise the plan for implementation. Parsing the file shouldn't pose too much of a problem and it uses a XML syntax (just an aside i've read that some SVG applications have trouble reading files created using Adobe Illustrator because of all the junk they add to the file)

I'm looking at two basic method of implementation, either a full blown render that will render the SVG to screen, or a rasteriser (not really sure if that is a word), which will take advantage of SVG ability to rasterise the file to a format like JPEG, which could then be used as normal. I would prefer the render option, but it looks to be a much larger project.

I'm also looking at existing libraries for rendering SVG that i could write a wrapper for. So far haven't had too much success in locating libraries that are at a resonable state of completion and not written in Java.
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

something else is the fact that SVG uses CSS files. I haven't looked into what the CSS files do yet, but i'm hoping that it includes the ability to define colours and fonts used in the SVG image. This would allow for some really simple skining to be implemented.
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

we'll only one person replied so i guess there isn't that much interest. I'm still going to start the project in a couple of weeks once my exams are over and work calms down a bit. Will probably be much less generic than i was planning since it seems unlikely people will reuse the code, but i'll see what happen once i have some demos ready.
Harry_Mystic
Posts: 32
Joined: Sun Nov 23, 2003 10:23 pm

Post by Harry_Mystic »

Although I don't know a lot about SVG, scalable images for gui sounds interesting. Important are easy usage and flexibility (not sure if this is the right word, I just mean how things like transparency/alpha channel, what file formats etc. works).
I'm sure if you have something like a demo to show you will get more replies.
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Vector 2D images would be amazing, if I can offer any help I will since GUI is an important aspect of 2080.

CSS eh? I wonder if it's the same as the CSS format that you can use on webpages to define colours and stuff. If it is then it should have every thing you need. BTW, I have a hyperlink extension to the GUI on my comp if you want to try it out.
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

SVG is a single file format. It is being developed by W3C. The file format is actually very complicated and includes scripting for animations, so it can in someways replace flash on web pages.

I would be looking a pretty simple implementation, probably supporting basic shapes, gradients and alpha channels. Will extend the list if required, but basically i will only implement enough features to allow for gui's to be made.

One of the best things about the format is that there are several free graphics packages for producing the images.
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

The parser shouldn't be too hard but have you got the spec for the format? Also, how do you plan to calculate the final image from the vector format? Do you know of a library that can do that?
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

i have the file spec, is quite a large document because the format can include scripted animations similar to flash. The plan at this stage is implement only a small set of features, such as basic shapes. There are some libraries for the calculating the final image, for example both Gnome and KDE have libraries for rendering SVG which are publicly available. I'm not sure yet wether i will use these libraries as they include alot more functionality then i'm planning
aKarZim

Post by aKarZim »

I'm really interested in SVG support for Irrlicht ! Did you progress in the implementation of this feature ?
AutoDMC
Posts: 104
Joined: Sat Sep 18, 2004 3:44 pm

Post by AutoDMC »

SVG support was one of the things I had been itching to do (before I got the really big itch to do scripting), and I wish you luck!

Yes, CSS from SVG is the same CSS from HTML. It works the exact same: you can set attributes for tags and all that fun stuff.

I wouldn't worry about CSS right now, simply concentrate on shape drawing.




You could use libart or possibly cairo libraries for the vector drawing; both draw on in memory bitmaps that you could then blit to the screen or dump into a PNG or something. I personally like the idea of dumping to textures for use on the screen :D

Just follow the painter's algorithm. And you are set up.

The way SVG's painter algoritm works, you could paint <g> tags onto their own bitmaps, then simply reuse and repaint those bitmaps instead of rerendering them.

I don't really know what I'm trying to say, except that I can't wait to see it!

The CAIRO vector engine:
http://www.cairographics.org/introduction

I can't wait to see this used in a pure vector GUI!
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Re: Anyone Interest in implementing SVG

Post by niko »

Masdus wrote:Before i started though i wanted to see if people would be interested in this. Any thoughts?
Would be really interesting. I think it would be a lot of work, so I think maybe it would be better to use an existing player implementation and just rewrite the renderer for Irrlicht. If you would start implementing this, I could support you by adding missing functionality to irrlicht if there is need for this at all.
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

I'm afraid i got distracted by oter projects shortly after posting this, so no progress has been made. However i've just returned to this idea and plan to make some headway over the next few weeks. I'll post in the project section once i've made some resonable progress.
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

Cario looks perfect for this project. As AutoDMC said it can draw to a in memory bit map. The project also provides some backends for rendering to PDF, PNG and some other formats. Cario also has a XML parser for .svg files, although it seems to be only partly complete. So now the project looks to consist of writing a wrapper to load/parse the SVG file, call Cario to draw the image in memory, and then use irrlicht to render to the screen. I'm working at making a minimal Cario Build right now.
Post Reply