Page 1 of 1

Batch Rendering

PostPosted: Fri Nov 09, 2018 3:23 am
by DrPineapple
Hello,

I'm new to MakeHuman and am teaching myself as I go. I am curious if there is a way to batch render .mhm files. I have several hundred that I have manipulated or altered in some manner, and would like to render each to a .png image if possible. If not, perhaps someone could suggest the best alternative or workflow to go from a .mhm file to a rendered .png image of a whole body.

Thanks,
Dan

Re: Batch Rendering

PostPosted: Fri Nov 09, 2018 10:23 am
by joepal
There is no current UI solution for this. You'd have to write a new plugin for it. You can find an example plugin at https://github.com/makehumancommunity/m ... example.py

It would probably not require many lines of code. Under a button, you'd have to iterate over a list of file names. A MHM file can be loaded with

Code: Select all
from core import G
human = G.app.selectedHuman
human.load("sometoonfile.mhm")


An image of the current viewport can be saved with:

Code: Select all
import mh
from core import G
mh.grabScreen(1, 1, G.windowWidth - 3, G.windowHeight - 3,"outputfilename.png")

Re: Batch Rendering

PostPosted: Fri Nov 09, 2018 6:02 pm
by DrPineapple
Thanks for the reply and info! I was able to loop through a directory of files and grab the screen for each easy enough. However, when the files are saved to images, they are missing eyes and the pose (see example below). The clothing appears to be fine. Is there a way to make sure all assets are saved to an image?

Image

Thanks,

joepal wrote:There is no current UI solution for this. You'd have to write a new plugin for it. You can find an example plugin at https://github.com/makehumancommunity/m ... example.py

It would probably not require many lines of code. Under a button, you'd have to iterate over a list of file names. A MHM file can be loaded with

Code: Select all
from core import G
human = G.app.selectedHuman
human.load("sometoonfile.mhm")


An image of the current viewport can be saved with:

Code: Select all
import mh
from core import G
mh.grabScreen(1, 1, G.windowWidth - 3, G.windowHeight - 3,"outputfilename.png")

Re: Batch Rendering

PostPosted: Fri Nov 09, 2018 7:40 pm
by joepal
Hm, that's new to me. If you only do a screen grab (ie not a combined load + grab), do you get everything?

It's possible there's a missing redraw somewhere, or that the screen grab happens before the scene has had a chance to finish redrawing.

The screen grab simpy dumps the pixels that have been drawn on the screen, so if something is visible, it should end up in the file.

As a hint, you could try either introduce a short delay before each grab and/or do the following before each grab:

Code: Select all
human = G.app.selectedHuman
human.applyAllTargets()
mh.redraw()