Author Topic: Blender 2.5 auto render script & template  (Read 6384 times)

0 Members and 1 Guest are viewing this topic.

Offline Zeno

  • ENASSA Designer
  • Devotee
  • *
  • Posts: 1995
  • Total likes: 3
  • Helpful: 30
    • Zeno's Simutrans Creations
  • Languages: ES, EN, CAT
Blender 2.5 auto render script & template
« on: January 23, 2011, 08:09:31 PM »
Let me share my automatic rendering script for Blender, uptated for the latest 2.56 Beta version.
The script should be registered and autorun as an Addon (preferences->addons->add, select the file and check it to run on start).

The script will show a new panel in the render toolbox with a textbox to input a name, a dropdown where you can select to render 4 or 8 views, and a button to run the command. The requisites are two objects: a camera named 'Cam' and a lamp named 'Sol' (object datalink names). The script will move and rotate the lamp and the camera for each view, then render the selected layers. In the selected layers there must be the camera, the lamp and the object(s) to render.

The template is just an empty .blend file that I use for my creations. I save there the window layout I like, and the special colors that simutrans recognizes are already set up in this file. I hope you find it useful.

You can modify both files for your own use, of course. Please, send feedback on issues and also on your own modifications, so they can be useful for all the community :)

Files must be renamed to Template.7z.001 and Template.7z.002 before they can be unzipped!
« Last Edit: January 23, 2011, 08:21:05 PM by Zeno »

Offline Spartanis

Re: Blender 2.5 auto render script & template
« Reply #1 on: July 09, 2011, 11:31:02 PM »
Files must be renamed to Template.7z.001 and Template.7z.002 before they can be unzipped!

Forgive my confusion but, Im using windows 7 and I tried changing it to Template.7z.001 But it still think its Template.7z.001.7z ... of course it wont open.

Any tip?


Got into Windows 7 CMD prompt, renamed it the good old fashion way as instructed. Now it wont recognized what it is to unzip it!! :|

I would suggest and recommend that you upload the file as it is, no zipping, rar'ing, what-have-youse'ing....
« Last Edit: July 09, 2011, 11:41:03 PM by Spartanis »

Offline Zeno

  • ENASSA Designer
  • Devotee
  • *
  • Posts: 1995
  • Total likes: 3
  • Helpful: 30
    • Zeno's Simutrans Creations
  • Languages: ES, EN, CAT
Re: Blender 2.5 auto render script & template
« Reply #2 on: July 10, 2011, 04:21:10 PM »
File must be uploaded zipped and splitted; otherwise it won't fit the size limit of the forum.
About unzipping the files, I'm sorry you must use 7zip compression tool.

Tip: Disable your windows "hide extensions for known file types" feature, it's clearly designed to confuse the user instead of helping him ;)

Online fam621

Re: Blender 2.5 auto render script & template
« Reply #3 on: October 30, 2016, 05:31:01 PM »
I am having problems making liveries on blender. :(

Online jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15828
  • Total likes: 405
  • Helpful: 177
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Blender 2.5 auto render script & template
« Reply #4 on: October 30, 2016, 06:53:37 PM »
Can you elaborate? With which step are you having problems; obtaining/opening the .blend fies of the vehicles that you want to modify; (2) modifying the 3d models in Blender; (4) exporting the images from Blender; (5) combining/processing those images; or (6) compiling those images to make them work with Simutrans?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Spokkel

Re: Blender 2.5 auto render script & template
« Reply #5 on: January 05, 2017, 01:38:58 PM »
So, I am using Blender to make little 3D Models. Thanks to another tutorial,I am able to get the 4 standard views with accompanying lighting, but not additions for vehicles.
But i am missing a step - I render a 128px model, and the quality is low - how do i render it high quality, and compress it to remain reasonably high quality for the game. (PAK128)

Also, Once i have the 8 images - i have used TileCutter to put them together, but it doesn't do 8 images. How do i place all 8 images exactly in place to be read by the data file? What program is best. I am lost here.

Hope this is the right forum, otherwise, please point me in the right direction:)

Online jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15828
  • Total likes: 405
  • Helpful: 177
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Blender 2.5 auto render script & template
« Reply #6 on: January 05, 2017, 02:07:12 PM »
Welcome to the forums! I can only answer from experience of working on Pak128.Britain; Pak128 may have somewhat different alignments.

However, assuming that there are no significant differences, firstly, it is sensible to download and install the latest version of the automatic rendering script here.

Secondly, the easiest way to produce objects for Pak128.Britain is to start with one of the existing .blend files (available here and here and adapt them as necessary. This is because the camera and lighting is already set up precisely and no further work in that regard is required. The lighting may be different for Pak128: one of the Pak128 developers should be able to assist with that. Do not worry if you have already created your own models: you can export these as a Collada (.dae) file and import them into one of the existing .blend files with the camera, lighting, etc. already set up. The rest of these instructions assume that you have done that.

Thirdly, I advise in favour of using the new alpha transparency workflow, which makes things much easier. Hopefully that should not be a problem in Pak128: it certainly works well in Pak128.Britain. To do this, make sure that "RGBA" rather than "RGB" is set under "output" in the render options (the camera icon in Blender). You then do not need to undertake any post-processing of images for vehicles and single tile buildings at all after rendering them from Blender.

Fourthly, the settings to use depend on whether you are making vehicles or other objects, and, if vehicles, whether you are making road vehicles or other types of vehicles.

For vehicles other than road vehicles, you need to use the "Render 8 views vehicle alignment" setting in the "Rendering views for Simutrans" tab created by the Blender plugin. These will not need offsets specifying in the .dat files. Assuming that your vehicle's image files are named "example-vehicle" and they are in the /images subdirectory of wherever your .dat file is located, you will need the following code to reference the graphics in the .dat file:

Code: [Select]
EmptyImage[E]=./images/example-vehicle_E.0.0
EmptyImage[SE]=./images/example-vehicle_SE.0.0
EmptyImage[S]=./images/example-vehicle_S.0.0
EmptyImage[SW]=./images/example-vehicle_SW.0.0
EmptyImage[W]=./images/example-vehicle_W.0.0
EmptyImage[NW]=./images/example-vehicle_NW.0.0
EmptyImage[N]=./images/example-vehicle_N.0.0
EmptyImage[NE]=./images/example-vehicle_NE.0.0

For road vehicles, , you need to use the "Render 8 views normal alignment" setting in the "Rendering views for Simutrans" tab created by the Blender plugin. You then need to apply offsets in the .dat file as follows:

Code: [Select]
EmptyImage[E]=./images/example-vehicle_E.0.0,-33,14
EmptyImage[SE]=./images/example-vehicle_SE.0.0,-13,0
EmptyImage[S]=./images/example-vehicle_S.0.0,4,0
EmptyImage[SW]=./images/example-vehicle_SW.0.0,-8,10
EmptyImage[W]=./images/example-vehicle_W.0.0,4,5
EmptyImage[NW]=./images/example-vehicle_NW.0.0,12,10
EmptyImage[N]=./images/example-vehicle_N.0.0,0,33
EmptyImage[NE]=./images/example-vehicle_NE.0.0,0,24

When producing multiple vehicles, you can just perform a search/replace on the names so as not to have to keep typing out all of the offsets, etc.

For single tile buildings (city buildings, extension buildings, etc.), you need to use the "Render 4 views normal alignment" setting in the "Rendering views for Simutrans" tab created by the Blender plugin.

Single tile buildings do not need the use of TileCutter, but do need a different .dat file syntax: it is best to adapt a precedent .dat file in the code archives.

Multi-tile buildings (such as large industries or attractions) do need Tile Cutter. Tile Cutter is not compatible with transparency, so you will need to use the old-fashioned workflow for the present, which I believe is described in other threads relating specifically to Tile Cutter.

The automatic rendering script is not suitable for use for making ways, way objects and certain other specialist graphics, but Blender can still be used to create these (just export them manually for each rotation with F12/F3).

For vehicles, make sure to get the positioning and scale correct. I do not know the positioning or scale for Pak128, but for Pak128.Britain, the positioning requires the front of the vehicle to be placed 4 grid squares in Blender in front of 0,0,0 (the crossing point of the red and green lines) and the scale can be derived from a special ruler (a .dae object) which represents a length of 15 meters on the y axis (the x and z axes are scaled 1.25x in proportion to the y axis) can be downloaded here. This ruler can be imported into any .blend file and used to scale the objects.

I hope that you find this helpful; best wishes with graphics creation for Simutrans. It is a splendid way to spend one's time.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Leartin

  • Devotee
  • *
  • Posts: 843
  • Total likes: 301
  • Helpful: 44
  • !!!!!This user was banned for double posting!!!!!
  • Languages: DE, EN
Re: Blender 2.5 auto render script & template
« Reply #7 on: January 05, 2017, 03:06:53 PM »
james, just a quick reminder: As far as I know, the new makeobj which allows for transparency was not released yet. While it's not required to create the graphics themselves, I think it's important that beginners can see their stuff in the game as soon as possible, because that motivates a lot. As long as there is no official/public makeobj to use, I would recommend not recommending transparency ;)

Online jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15828
  • Total likes: 405
  • Helpful: 177
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Blender 2.5 auto render script & template
« Reply #8 on: January 05, 2017, 03:30:13 PM »
james, just a quick reminder: As far as I know, the new makeobj which allows for transparency was not released yet. While it's not required to create the graphics themselves, I think it's important that beginners can see their stuff in the game as soon as possible, because that motivates a lot. As long as there is no official/public makeobj to use, I would recommend not recommending transparency ;)

Ahh - I see. That is rather unfortunate.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.