SVGTEX - vector texture plugin for Blender 2.49

I have just finished the “full-scale” tests of a texture plugin for Blender 2.49.
It allows you to place on the model content of a *.SVG file. In effect, you
have texture that is always sharp, regardless of the distance from the camera:

http://airplanes3d.net/images/tutorials/svgtex.png

From the page of this project you can download:

  • ready binary files for Blender 2.49 (Win 32);
  • complete source code (C++);

I have also provided an online manual.

Let me know what do you think about this gadget.

Notice, that there is also a branch of Blender 2.5, with vector textures. There is a thread about it, on this forum (developer: mato).

This plugin is a paralel development. It started on March 2008, on the base of Marcelo
de Gomensoro Malheiros vectex plugin. After six months of work I have created a full-scale, compact SVG parser, based on AGG graphic library. Then it was “put aside” for a year and half, because I had other projects. On March 2010 I have “revitalized” it and perform “real life” tests on my model. Mato is preparing a much more functionality in core Blender. But, for a while, this small plugin can be used with standard Blender 2.49. Sometimes this model of usage is better suitted to more users.

Does anybody know anything about the plugin interface in Blender 2.5? Are any changes planned there? I would like to prepare another version of SVGTEX plugin for Blender 2.5/2.6…

Hi Witold,
A C/Python plugin system is in the works I think.
Certainly already in 2.5 you can interface compiled binary’s with Python.
It would be great if you team up with mato for a better 2.5/6 svg import standard in Blender.

Thanks Meta-Androcoto for answer.

  1. Do not worry about mato project: I have already given him the source code, first, and offered help with it.

  2. I am not asking about the general Python/C API, but about specific interface for Blender texture plugins. It is specified in 2.49 in pugins/include/plugin.h file - what is its counterpart in Blender 2.5? (in alpha 2.0 there is no way to load a texture plugin)

That would be awesome for zooming to small details on very large terrains :slight_smile:
Can’t wait to see this in 2.5 wink wink nudge nudge

It’s so great to have this as an independant plugin to use with official blender builds!
I have tried to render a shape with gradient (exported from alchemy) with it but it does not work. is it supposed to?
Also it still works with texture nodes, but I was not able to map it to something else than the color channel, I probably rushed too much through this though.

Thanks a lot for your work!

Filling with gradients should work. I have tested it with drawings created with Inkscape, but it is a bug, anyway. If you can deliver me this problematic file (expose it somewhere for download, or send it on my e-mail you will find on http://airplanes3d.net page header), I will be able to repeat this bug and resolve the problem.

Svgtex’s output can be also mapped as intensivity and normal (I have tested it with the bump maps), but not tested with nodes. Did you try to use and non-color information from any other plugin in nodes? If any other plugin properly delivers the intensity or normal information to other nodes, then this is also the plugin bug. Could you use any other plugin for a moment instead of svgtex.dll, and tell me about the effect?

Thank you for the interest in this subject :slight_smile:

Here is the test file with gradient exported by alchemy displayed correctly by firefox:
http://dl.free.fr/umD6TNp03

That is some excellent news, and a great great accomplishment !
Congratulations! I am impressed by the level of proffesionalism in this project: are you a pro-programmer ?

I made further tests and you can forget about what I said for nodes as it happened the same way with native procedural textures. About the gradient, The older Vectex integrated in a special build Shows it properly. About the normals, they are influenced indeed, only Nor value slider needs to be put quite high for my test file compared with usual textures. maybe some different color spaces between softwares?

Thanks Witold for your hard work. I wish it ported to B25 some way / some day.

OK, I have fixed this bug with the gradient. Updated source and binary file are exposed for downloads :D.

@Maurice: Thank you for the information about the second problem. When you mention the Vectex branch in Blender 2.5: it is different project. It has different “heart” - the SVG parser. Its developer - Mato - at the begining used a conceptual parser from AGG example. Then he switched to QtSVG library. During this time, I had developed this “conceptual” AGG example into full-scale parser. When the source passed the tests, I gave it to Mato, some days ago. It may be more “handy” (compact and faster) than QtSVG. Of course, when I remove most of the bugs, like this!

@Gwenouille: thank you. Well, yes, I do programming professionally. You know, after writing one hundred twenty eighth extension to an ERP system, you must create something free, something, which produces colorful output. Otherwise you can go mad ;).

@jawra: thank you. Well, porting into B 2.5 internals relies mainly on Mato - I have just offered him help. He prepares more functional solution. Anyway, as long as this is not finished, I will deliver this plugin, as a preliminary “remedy”.

To the next bug!
(“the last is always not recognized, yet” - /XXth century programmer’s saying/)

Thanks Witold! I confirm it is also working on my platform with gradients now.

Hi Witold,
I am still trying to compile svgtex on linux.
Some errors occurred due to difference of compiler’s specification.
Some of the errors seems to be fixed by myself but others are still unsolved.

The unsolved problems are like below.

svg_pattern.h: In member function 'svg::rectangle svg::pattern::bounding_box()':
svg_pattern.h:382: error: no matching function for call to 'svg::pattern::to_root(svg::req_prepare)'
svg_element.h:342: note: candidates are: void svg::element::to_root(svg::request&)

GCC’s way of handling reference seems to somewhat different from MSVC’s compiler?
Once I tried to fix this problem by way of like this.

                //to_root(req_prepare(request::prepare_measure, measure));  
                request req = req_prepare(request::prepare_measure, measure);
                to_root(req);

By this way, I could make compile and get a svgtex.so file.
That plugin file can use as usual ways, but it becomes not able to use some of the SVG files.

Probably there needs to modify the definithion of to_root() or req_prepare() but I don’t know how to fix this error.
There are about 15 ‘no matching function for call to’ error reported.

svg_pattern.h: In member function 'svg::rectangle svg::pattern::bounding_box()':
svg_pattern.h:382: error: no matching function for call to 'svg::pattern::to_root(svg::req_prepare)'
svg_element.h:342: note: candidates are: void svg::element::to_root(svg::request&)
svg_pattern.h: In member function 'virtual void svg::pattern::initialize(svg::request&)':
svg_pattern.h:449: error: no matching function for call to 'svg::pattern::prepare_picture(svg::rendering_buffer&, svg::rectangle)'
svg_pattern.h:495: note: candidates are: bool svg::pattern::prepare_picture(svg::rendering_buffer&, svg::rectangle&)
svg_pattern.h: In member function 'void svg::pattern::render_pixels(svg::rendering_buffer&, svg::transform)':
svg_pattern.h:525: error: no matching function for call to 'svg::pattern::to_root(svg::req_prepare)'
svg_element.h:342: note: candidates are: void svg::element::to_root(svg::request&)
svg_parser.cpp: In member function 'void svg::parser::parse(const char*)':
svg_parser.cpp:345: warning: format '%d' expects type 'int', but argument 4 has type 'XML_Size'

svg_req_filter.cpp: In constructor 'svg::req_filter::req_filter(svg::filter&, svg::shape&, svg::transform, svg::rectangle, svg::pixfmt&, double)':
svg_req_filter.cpp:60: error: no matching function for call to 'svg::shape::to_root(svg::req_prepare)'
svg_element.h:342: note: candidates are: void svg::element::to_root(svg::request&)
svg_req_filter.cpp: In constructor 'svg::source_graphic_buffer::source_graphic_buffer(svg::filter&, svg::element&, svg::transform, unsigned int, unsigned int)':
svg_req_filter.cpp:205: error: no matching function for call to 'svg::element::to_root(svg::req_prepare)'
svg_element.h:342: note: candidates are: void svg::element::to_root(svg::request&)

svg_shape.cpp: In member function 'svg::rectangle svg::shape::bounding_box(svg::transform, bool)':
svg_shape.cpp:113: error: no matching function for call to 'svg::shape::to_root(svg::req_prepare)'
svg_element.h:342: note: candidates are: void svg::element::to_root(svg::request&)
svg_shape.cpp: In member function 'void svg::shape::prepare_render(svg::request&, svg::styleset&)':
svg_shape.cpp:144: error: no matching function for call to 'svg::painter::set(svg::rectangle)'
svg_painter.h:114: note: candidates are: virtual void svg::painter::set(svg::transform&, double)
svg_painter.h:132: note:                 virtual void svg::painter::set(svg::rectangle&)
svg_shape.cpp:160: error: no matching function for call to 'svg::painter::set(svg::rectangle)'
svg_painter.h:114: note: candidates are: virtual void svg::painter::set(svg::transform&, double)
svg_painter.h:132: note:                 virtual void svg::painter::set(svg::rectangle&)

svgtex.cpp: In function 'int plugin_tex_doit(int, Cast*, float*, float*, float*, float*)':
svgtex.cpp:277: error: no matching function for call to 'is_equal(agg::rgba8&, color)'
svg_basics.h:262: note: candidates are: bool svg::is_equal(const svg::rectangle&, const svg::rectangle&)
svg_basics.h:284: note:                 bool svg::is_equal(svg::rgba8&, svg::rgba8&)
svgtex.cpp:281: error: no matching function for call to 'tex::instance::background(color)'
tex_instance.h:119: note: candidates are: color& tex::instance::background()
tex_instance.h:120: note:                 void tex::instance::background(color&)

svg_root.h: In member function 'void svg::root::initialize()':
svg_root.h:154: error: no matching function for call to 'svg::root::forward(svg::request)'
svg_element.h:301: note: candidates are: svg::handle svg::element::forward(svg::request&)
In file included from tex_tile.h:37,
                 from tex_tileset.h:37,
                 from tex_instance.h:39,
                 from svgtex.cpp:48:
                 
tex_texel.h: In static member function 'static tex::texel tex::texel::transparent_black()':
tex_texel.h:146: error: no matching function for call to 'tex::texel::texel(color)'
tex_texel.h:142: note: candidates are: tex::texel::texel(pixfmt&, tex::int32, tex::int32, bool)
tex_texel.h:124: note:                 tex::texel::texel(color&)
tex_texel.h:110: note:                 tex::texel::texel(tex::int8u*)
tex_texel.h:95: note:                 tex::texel::texel(tex::int32u, tex::int32, tex::int32, tex::int32u, tex::int32u, tex::int32, tex::int32)
tex_texel.h:89: note:                 tex::texel::texel()
tex_texel.h:62: note:                 tex::texel::texel(const tex::texel&)
tex_texel.h: In static member function 'static tex::texel tex::texel::red()':
tex_texel.h:149: error: no matching function for call to 'tex::texel::texel(color)'
tex_texel.h:142: note: candidates are: tex::texel::texel(pixfmt&, tex::int32, tex::int32, bool)
tex_texel.h:124: note:                 tex::texel::texel(color&)
tex_texel.h:110: note:                 tex::texel::texel(tex::int8u*)
tex_texel.h:95: note:                 tex::texel::texel(tex::int32u, tex::int32, tex::int32, tex::int32u, tex::int32u, tex::int32, tex::int32)
tex_texel.h:89: note:                 tex::texel::texel()
tex_texel.h:62: note:                 tex::texel::texel(const tex::texel&)
tex_texel.h: In static member function 'static tex::texel tex::texel::black()':
tex_texel.h:152: error: no matching function for call to 'tex::texel::texel(color)'
tex_texel.h:142: note: candidates are: tex::texel::texel(pixfmt&, tex::int32, tex::int32, bool)
tex_texel.h:124: note:                 tex::texel::texel(color&)
tex_texel.h:110: note:                 tex::texel::texel(tex::int8u*)
tex_texel.h:95: note:                 tex::texel::texel(tex::int32u, tex::int32, tex::int32, tex::int32u, tex::int32u, tex::int32, tex::int32)
tex_texel.h:89: note:                 tex::texel::texel()
tex_texel.h:62: note:                 tex::texel::texel(const tex::texel&)
tex_texel.h: In static member function 'static tex::texel tex::texel::white()':
tex_texel.h:155: error: no matching function for call to 'tex::texel::texel(color)'
tex_texel.h:142: note: candidates are: tex::texel::texel(pixfmt&, tex::int32, tex::int32, bool)
tex_texel.h:124: note:                 tex::texel::texel(color&)
tex_texel.h:110: note:                 tex::texel::texel(tex::int8u*)
tex_texel.h:95: note:                 tex::texel::texel(tex::int32u, tex::int32, tex::int32, tex::int32u, tex::int32u, tex::int32, tex::int32)
tex_texel.h:89: note:                 tex::texel::texel()
tex_texel.h:62: note:                 tex::texel::texel(const tex::texel&)

How should I fix this error?
Thank you.

In general, it seems you are right with these splitting this single line into two.

I think, that I should repeat these errors on Linux, to find the resolution. I have a computer with Ubuntu at home, do you think that it is possible to repeat these GCC errors on it? I will try, but if you could show me the adapted makefile, it would be easier, because I am a novice in this environment.

I will answer ASAP

It would be difficult adapt Vectex renderer (Antigrain lib) to Blender bezier 2D curves and 2D shapes (material with strokes)?
This would allow the development of “2D animation styles” in Blender
And animation of 2d textures over meshes.
Without having to use SVG files and external editors for 2D shapes and bezier curves

examples :
http://anime.smithmicro.com/videos/Samples.html
http://anime.smithmicro.com/videos/Goldfish.html
http://anime.smithmicro.com/videos/redcompra.html

See this program based on lib Antigrain:
http://anime.smithmicro.com/p_features.html

Thanks for your work
=:-)

@mato: So far I have started with installing MinGW on my Windows, but it will take a while to get familiar with it.

@ciricao: I am not sure, what do you mean as “Blender bezier 2D curves”. AGG is very good at drawing smooth Bezier curves, and all SVG shapes are based on Bezier curves. At this moment we have concentrated on still images, but of course, it is possible to produce an animation sequence from them. But it would have be a new project, I think.

@ Witold Jaworski: What I meant was that the rendering of the curves be built with the AGG library within Blender’s rendering engine directly. This would allow 2D quality animation.
Currently 2D shapes in Blender are transformed into a mesh and then rendered, it creates many problems for quality work in 2D and the inability to create 2D shapes with lines on the perimeter ( stroke).
=:-)

I see your point, ciricao. Unfortunately, I do know nothing about the internals of Blender renderer, so cannot answer this question. (To create a plugin, you have to know just a few interface functions, that’s all what I have learned :().

Thanks for the interest in this subject, anyway

Thanks for your work

Hi Witold,
I used scons for compiling svgtex on linux.
Here is a patch file to the source code of svgtex.

http://www.pasteall.org/12599/diff

I made a Makefile too, but I didn’t test it enough.
I tried to compile with MinGW and command prompt of MSVC 2008 Express on my Windows using these scons files and the Makefile but not succeeded.
So I wonder if this file is useful on Windows environment.

I have not made a font support for Linux, so I know some of the SVG files that can be used on Windows may not be used on Linux.
So I tested on Windows using this modified version and original version.
The SVG file I tested is from this URL.
http://en.wikipedia.org/wiki/File:TTCsubwayRTmap-2007.svg

I can use this SVG file with original version, but failed with modified version.
I am sorry that I disturb you by my lack of programming skill.
Thanks.

Edit:
Patch file seems to be broken by the problem of CR/LF cord.
So I made a .zip file of the source code.
http://render360sideb.up.seesaa.net/data/SVG_modified100422.zip