Batch Rendering

If you have problems understanding something or getting started, ask here

Moderator: joepal

Batch Rendering

Postby DrPineapple » Fri Nov 09, 2018 3:23 am

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
DrPineapple
 
Posts: 2
Joined: Fri Nov 09, 2018 3:20 am

Re: Batch Rendering

Postby joepal » Fri Nov 09, 2018 10:23 am

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")
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 3212
Joined: Wed Jun 04, 2008 11:20 am

Re: Batch Rendering

Postby DrPineapple » Fri Nov 09, 2018 6:02 pm

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")
DrPineapple
 
Posts: 2
Joined: Fri Nov 09, 2018 3:20 am

Re: Batch Rendering

Postby joepal » Fri Nov 09, 2018 7:40 pm

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()
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 3212
Joined: Wed Jun 04, 2008 11:20 am


Return to Newbies

Who is online

Users browsing this forum: Google [Bot] and 3 guests