Tuesday, 1 January 2013

SVG OGRE Demo (Windows)

SVG (Scalar Vector Graphics) http://en.wikipedia.org/wiki/Scalable_Vector_Graphics

Mobile application developers find challenging to provide a correct solution to target multiple screen sizes support for hundreds of devices available in the market.
The typical and conventional solution is to provide multiple variants of same texture with multiple sizes/quality. 

Applications typically ship with textures for all screen sizes in the same installation package which increases the size of the installer and hence increases storage issues on range of devices.
For e.g. texture dimensions targetted for 1600x960 can typically be double the size than for a screen size of 800x480. Which means <=4 times additional disk storage consumed for this higher texture.  



To solve this problem SVG comes for rescue. 

In this case we have an XML (SVG) file composed of vector instructions to render resolution independent content. 

As an e.g. for below SVG texture (created using http://inkscape.org/)



SVG file size for below texture is: 37KB

PNG file size for below texture is: 26KB
PNG file size for 2x      texture is: 53KB
PNG file size for 4x      texture is: 114KB -> Combined size (193KB) > 37KB of SVG file.

Sizes of SVG files can outgrow the size of bitmap textures for very complex content (e.g. real characters/faces). So SVG rendering is useful for content which is easier to present in terms of text and curves/paths..

I have created a demo application integrating librsvg with OGRE 3D.
https://live.gnome.org/LibRsvg

Build instructions:

For detailed steps to build OGRE follow:

1. OGRE Dependencies are already built in the provided package. To build fresh for any changes in the code, use Project/Solution under each package.  This includes Cairo/Pango/librsvg and other dependencies.
You might need to copy Doc/Tools folder from original source as it was increasing the size. 

2. Use CMAKE GUI to generate VS10 projects. Once successful in generating, you will see OGRE.sln created with all relevant projects.
3. Build OGRE using C:\OGRESvg\ogre_src_v1-8-1\build\OGRE.sln. Ignore GLES2 backend for now.
4. Build Install Project individually using Build Only Option.
5. Build Install Project individually under Samples folder.
6. Build Demo Application C:\OGRESvg\Demo\Demo.sln.
7. Copy OGRE Dlls from C:\OGRESvg\ogre_src_v1-8-1\build\bin\debug to C:\OGRESvg\Demo\bin\Debug.
8. Copy Dependent Dlls from C:\OGRESvg\ogre_src_v1-8-1\Dependencies\bin\debug bin folder.
9. Launch Application.

Code is available at https://sourceforge.net/projects/ogresvg/files/





1 comment: