News:

Simutrans Chat Room
Where cool people of Simutrans can meet up.

Script for Simutrans-style sprites from 2D vehicle drawings

Started by Ashley, June 01, 2009, 02:49:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ashley

Curious.

I've just been looking at the deluge of spammy posts Budapest was making (in the Recyle bin now thankfully).

I wonder if it'd be possible to write a script that could take those flat, diagramatic views of vehicles and turn them automatically into Simutrans-style sprites. They'd need quite a bit of touching up of course, to fix graphical oddities, but I think it would probably do a lot of the grunt work of creating a new vehicle fairly automatically.

From the looks of it (especially for the buses) there are views of all 4 sides. The roof would in most cases be fairly easy to extrapolate too. Then all you'd need to do is clean them up, touch up the details/player colour and add headlights etc.

I wonder what the copyright issues would be in doing this kind of thing as far as the original source images go?
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

Spike

Quote from: Timothy on June 01, 2009, 02:49:23 PM
I wonder if it'd be possible to write a script that could take those flat, diagramatic views of vehicles and turn them automatically into Simutrans-style sprites.

With a bit of manual work (cutting the textures from the picturees) and a programmable raytracer like Blender or Povray this should be possible. I've made at least one vehicle long ago just by rendering textures onto a plain box. It worked surprisingly well and with some manual finetuning it was rather good actually.

IgorEliezer

Once BudaT made this that topic for "critica", I think it'd be better we discuss about this new tool in a new topic (or split this one). How about?  :)

EDIT: Done! :D

Spike

Quote from: IgorTekton on June 02, 2009, 03:56:06 PM
Once BudaT made this post for "critica", I think it'd be better we discuss about this new tool in a new topic (or split this one). How about?  :)

Good idea.

IgorEliezer

I did.

The former topic is here: http://forum.simutrans.com/index.php?topic=2370.0

And I hope Timothy gives a better topic title and can erase that "(from: Critica.................)" from there.

vilvoh

imho, would be possible to carry out this with Python and Blender...you may guess the object shape using image procesing algorithms (i.e. border detection) and then you apply the texture to a blender object you've created. You even can render it from python, too. It could be a Blender plugin...

Note: A possible project name could be paper2obj or drawobj

Escala Real...a blog about Simutrans in Spanish...

Ashley

If the images have a common background colour this can be detected and removed, with edge detection used to align the textures on the sides of the plain box. You could even use the edge detection more extensively to produce a tighter-fitting box (e.g. if you detect that a bus has a sloped front from the side view, you can make the front have the same profile in the model you produce, same idea for the sides...)

The alignment could be done automatically, and the dimensions of the object entered seperately to give the correct scale. Then you just need to draw the textures onto the mesh created automatically and render it. Would be a very interesting project, could likely be done using python and pyopengl/PIL.
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

VS

All interesting ideas. Some minimal input would be required in preprocessing phase - I can imagine just telling the user to fill empty space with fuchsia and removing labels etc. would shave off lots of difficulties. Then... what? Cutting apart the picture into discrete fragments of connected texture is piece of cake. Hard is understanding what goes where. Perhaps an assumption could be made that no curves are involved and sides are absolutely flat. The user can then dissect these texture pieces further with straight lines to get the "orthogonal" primitives. Interactively select sides to form the profile, then the rest is just like wrapping a toilet paper on the profile. Have user add hints and map onto the thing. Done.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!