Author Topic: Script for Simutrans-style sprites from 2D vehicle drawings  (Read 4616 times)

0 Members and 1 Guest are viewing this topic.

Offline 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?
« Last Edit: June 02, 2009, 04:52:07 PM by Timothy »
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.

Offline Spike

  • *
  • Posts: 1361
  • Total likes: 0
  • Helpful: 2
  • First Simutrans Developer and Graphics Artist
Re: Script for Simutrans-style sprites (from: Critica.............)
« Reply #1 on: June 02, 2009, 02:43:31 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.

Offline IgorEliezer

  • Devotee
  • Administrator
  • *
  • Posts: 3941
  • Total likes: 134
  • Helpful: 70
  • Lost In Stupid Parenthesis
    • Igor Eliezer Architect and Urban Planner/Arquiteto e Urbanista
  • Languages: PT, EN, AutoLISP, Python
Re: Script for Simutrans-style sprites (from: Critica.............)
« Reply #2 on: June 02, 2009, 03:56:06 PM »
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

Offline Spike

  • *
  • Posts: 1361
  • Total likes: 0
  • Helpful: 2
  • First Simutrans Developer and Graphics Artist
Re: Script for Simutrans-style sprites (from: Critica.............)
« Reply #3 on: June 02, 2009, 03:58:04 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.

Offline IgorEliezer

  • Devotee
  • Administrator
  • *
  • Posts: 3941
  • Total likes: 134
  • Helpful: 70
  • Lost In Stupid Parenthesis
    • Igor Eliezer Architect and Urban Planner/Arquiteto e Urbanista
  • Languages: PT, EN, AutoLISP, Python
Re: Script for Simutrans-style sprites (from: Critica.............)
« Reply #4 on: June 02, 2009, 04:07:12 PM »
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.

Offline vilvoh

  • One of the good guys
  • Administrator (Inactive)
  • *
  • Posts: 4504
  • Total likes: 2
  • Helpful: 14
  • I'm the constructor, the architect
    • Escala real
Re: Script for Simutrans-style sprites (from: Critica.............)
« Reply #5 on: June 02, 2009, 04:10:24 PM »
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...

Offline Ashley

Re: Script for Simutrans-style sprites from 2D vehicle drawings
« Reply #6 on: June 02, 2009, 04:56:52 PM »
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.

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4849
  • Total likes: 25
  • Helpful: 63
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Script for Simutrans-style sprites from 2D vehicle drawings
« Reply #7 on: June 02, 2009, 05:12:29 PM »
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!