Skip to main content
Topic: Render Post-Processor tool (Read 38463 times) previous topic - next topic

Render Post-Processor tool

Since begining of february I've been trying to automate a bit the processes that need to be done since I have a Blender model till I get a Simutrans pak object. This fight has resulted in two small applications:
1) A blender phyton script that can be used together with a blender template, that allows to take 4 or 8 renders from the object, in the needed views.
2) A small application for windows (needs .NET Framework 2.0) that automates the image loading and merging, blurry edge removing and player colors replacing, all in a row.

The phyton scripts are still in a very unstable state, so it's best I tweak them a little more before making them available. The application engine has been tested enough (I've already processed several objects with it), so I think it's stable enough to make a public release and allow other Simutrans content creators to benefit from it. I must say though, that the GUI hasn't been tested as much as the engine, so few issues might still be found there. If you find any, please report them in this same topic!

Before using this application, please read the help file provided with the application (you may also read it by running the application and clicking the top right "Help" button).
This application works only in a very specific workflow, and if you don't like it or just don't want to work this way, then this application won't be of any help for you.


You can download it from the project page at SourceForge here (remember, needs .NET Framework 2.0!)

Re: Render Post-Processor tool

Reply #1
This looks very interesting - has there been any progress with the Python scripts? This seems to be very similar to the issue discussed some time ago here.

Edit: I cannot get this to work at all. There is no explanation of how to enable oversampling or produce the masks (can oversampling not be made optional in any event?), and whenever I try to select any files, I get an unhandled exception (especially with the mask files, which I had made, as I have no idea how to get Blender to make mask files, by copying and renaming the original files).
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.

Re: Render Post-Processor tool

Reply #2
My excuses for oversampling not being properly explained. Oversampling is a technique that blender (and many other software) uses to make images look softer. The results look in a very "realistic" style, but it introduces blurry edges to the image. This tool allows to remove this blurry edges by using images rendered without oversampling (mask images). How to enable/disable oversampling? Just look in the blender rendering tools panel (F10) for a button named "OSA".

Then the tool uses one, four or eight images (depending on option selected) for OSA (images) and for non-OSA (masks). These images and masks are expected to be named "filename_N.png",  "filename_NW.png", "filename_W.png", and so on. Masks follow same rule (I usually name them as "vehicle_mask_N.png", etc). When you select an image, the tool looks for the eight images matching the name pattern, and there is where you are probably having this error.

I may post a sample pack of images to process, or a demo video. I'll see later.

Re: Render Post-Processor tool

Reply #3
Zeno,

thank you for your ****istance. Presumably, oversampled images look different to non-oversampled images, such that it would look wrong for a pakset to have some oversampled and some non-oversampled images? Is it possible to use your tool without any oversampling at all, just using ordinary, non-oversampled images with no masks?
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.

Re: Render Post-Processor tool

Reply #4
Yes, you may take images and masks both as non-OSA images. You aren't forced to use OSA for images at all. But beware the main purpose of the tool and what it is made for:

1) Take images named _N, _NW, _W, etc., and put them together in 1 file.
2) Replace mask colors with proper special colors.
3) Copy all transparency pixels from mask over the image (thus removing blurry edges).
4) Add text label to your file.

Hope this helps.
PS: About mask colors: these are fixed colors that the tool will replace no matter what user thinks (evil function :P). The tool will take any pixel with colour rgb = {255,0,128} (that is bright magenta) and replace it by rgb = {4D4D4D} (that is dark windows that lit at night). It will also COPY any player color pixel in the mask over the image. The way to get these colors to be present in the mask in a uniform surface is to render them with the "Shadeless" option marked in the Material tool box.

Re: Render Post-Processor tool

Reply #5
I'm a little confused. Blender allows you to turn OSA off, to my knowledge, so why render using OSA at all?
--Skreyola
You can also help translate for your language with SimuTranslator.


Re: Render Post-Processor tool

Reply #7
So, is this tool of any use to those producing graphics for a pakset that does not use OSA?
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.

Re: Render Post-Processor tool

Reply #8
So, is this tool of any use to those producing graphics for a pakset that does not use OSA?

As I said, it may be useful if you want to:
Quote
1) Take images named _N, _NW, _W, etc., and put them together in 1 file.
2) Replace mask colors with proper special colors.
3) Copy all transparency pixels from mask over the image (thus removing blurry edges).
4) Add text label to your file.
-Probably you won't use (3) as long as non-OSA images don't have blurry edges.
-You can use it for sure for (1) and (4), if you consider it's worthy.
-If used properly, (2) might took away most work after blender (the one with gimp or photoshop), only if your pakset uses lots of lights and/or player colors. This is a tricky point though. If this is your case (lots of lights and player colors) I can explain how to avoid most by-hand special color adding to your renders with the help of this tool (which was one of its goals).

I hope I explained myself better this time :)

 

Re: Render Post-Processor tool

Reply #9
Ideally, what is needed is something that turns the render outputs from Blender (black background, individual files, images not aligned in exactly the right places to work) into an image that Simutrans can use (correct blue background, single file, images precisely aligned) automatically, instead of having manually to select, copy, paste, align and then remove the alignment markers from each image. Can your tool do this without adding so many extra OSA-related steps that it is actually no less work than doing it manually without OSA?
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.

Re: Render Post-Processor tool

Reply #10
Oh my... Only if you asked for that before... :D
I Let's start with it!

You can set the correct background to your blender render outputs inside blender itself. Into the world panel (press F5 until you see a panel with the tabs "preview", "world", ...), pick the upper left color selector (just below "WO:World") and write in the "Hex" textbox the correct background (E7FFFF). This will work for you only if you select "SKY" option in the render tab (render buttons, the option on the bottom left corner of render tab).

Once your background is the correct one, alignment becomes much easier. It's very difficult to make alignment automatic, but Shades tool makes our task muuuuuch easier. It allows to load a background image that you can use as a template, and with a single mouse click you can pick your vehicle and move it to the correct position. This is done without layers, copying or selecting.

If you never used shades, I encourage you to try it right now! For me it's a must for simutrans content painters!  8)

Re: Render Post-Processor tool

Reply #11
Ahh, this is very interesting - thank you! Where can I find Shades? Also - any progress on the Blender scripts?
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.

Re: Render Post-Processor tool

Reply #12
You can find Shadeshere: http://forum.simutrans.com/index.php?topic=5389.0

Here are my blender scripts for rendering different views for simutrans.
http://files.[ simutrans [dot] us (site down, do not visit) ]/files/get/MXV8fq-NHR/blender-scripts.7z

The scripts move the camera and the sun of the scene to each of the four/eight needed positions, and then render the scene and saves to disk the image with the proper view suffix. The scripts can only be used if:
a) The scene has a single light source of type "sun" named "sol".
b) The scene has a single camera named "cam".

Cam and sun distance to the object is fixed, but you can modify all that in the script to add more light sources or other objects. As long as I didn't find any way to rotate objects properly, I hardcoded in the script the position and angle for each object.

Re: Render Post-Processor tool

Reply #13
Alignment shouldn't be a problem. Once you find the right camera positions, you should be able to leave them alone and render multiple objects with the object in the correct position already. Is there some reason I can't think of why alignment should be a problem that has to be solved more than once for each building size? Seems to me there should be one and only one correct camera placement for each rendered tile image.
Once found, that position should be included in the template blend file (as a camera object locked in place).
--Skreyola
You can also help translate for your language with SimuTranslator.

Re: Render Post-Processor tool

Reply #14
That may work with buildings. But think of a vehicle: depending on type of vehicle and vehicle length it must be aligned to the tile heading each direction, not to the camera.

Re: Render Post-Processor tool

Reply #15
That may work with buildings. But think of a vehicle: depending on type of vehicle and vehicle length it must be aligned to the tile heading each direction, not to the camera.
You can have multiple cameras in Blender, so you just position each camera position once (and position the model on the correct side of the center so it'll be on the correct portion of the road)... Oh, I see what you're saying. But that still (seems like it) should be fairly simple to solve, with a little bit of experimentation to produce a table of vehicle center coordinates.
Tip: Have your vehicle model's location center at ground level.
--Skreyola
You can also help translate for your language with SimuTranslator.

Re: Render Post-Processor tool

Reply #16
Of course it can be done, but sincerely, I feel far more easy aligning the render output with Shades (which is really quick) that implementing multiple cameras in Blender (I prefer a single one) and aligning the object to the tile. But anyway, that's a matter of "feeling"; some will be more comfortable working the first way, some will prefer the second way :)

Re: Render Post-Processor tool

Reply #17
Zeno: I can totally respect that.
--Skreyola
You can also help translate for your language with SimuTranslator.

Re: Render Post-Processor tool

Reply #18
Link at first post updated, thanks Igor for reporting.

About the script, thanks very much for sharing your modifications james. I'll take a look to the script, I'll try to fix errors if any and then upload the newest version to the project page.