Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0
dchow1992

rendering from the windows command line with a batch file

Hi there,

I am working on a school project and am trying to figure out houdini's command line rendering.

 

When I work in maya I usually write .bat files that launch maya's batch render with specified parameters.

 

I can't get houdini's to work for some reason.

 

SET hscriptDir="C:/Program Files/Side Effects Software/Houdini 14.0.444/bin/"
cd /d %hscriptDir%

SET hip_file="Z:/render_rnd.hipnc"
SET rop_path=obj/ropnet1/mantra1

SET startFrame=1
SET endFrame=1
SET savePath=$HIP/render/test_$F4.exr

hbatch %hip_file%
render -V -f %startFrame% %endFrame% -o %savePath% %rop_path%

Ideally I would like to be able to open this bat file, change the frame range / mantra node and just run it. At the moment it won't read any commands after hbatch reads my hip file which makes sense since it's an executable but is there a way to also pass my render command to hbatch? If I run the code in a command prompt line by line it works.

Thanks for looking

 

-David

 

Share this post


Link to post
Share on other sites

You need pipe in the hscript commands, something like this:

echo "render -V -f %startFrame% %endFrame% -o %savePath% %rop_path%"  | hbatch %hip_file%

Share this post


Link to post
Share on other sites

The typical way of doing this is to write out an archive for the renderer, in this case an IFD file for Mantra from the Mantra ROP. Then pass the IFD file directly to Mantra at the command line.

 

http://www.sidefx.com/docs/houdini15.0/render/batch

 

This is because renderer licenses are usually less expensive than full 3D package licenses. What Jason posted works too. If you use that method and if you have time later come back to it and figure out the IFD workflow too. It'll come in handy later.

Share this post


Link to post
Share on other sites

I encountered the same problem. You have to use the echo command without quotation marks. Hbatch also struggled to use the $HIP variable. Loading the files via the mread command fixed this issue. It is also very important to use forward slashes.

 

The working .bat file looks like this:

SET hbatchDir="C:\Program Files\Side Effects Software\Houdini 15.0.347\bin\"

SET hipFile=c:/myProject/myHoudiniFile_1.hip
SET ropPath=out/mantra1
SET startFrame=1
SET endFrame=100

CD /d %hbatchDir%
(ECHO mread %hipFile%
ECHO render -V -f %startFrame% %endFrame% %ropPath%) | hbatch
PAUSE

To render .ifd Files this .bat script works.

SET hbatchDir="C:\Program Files\Side Effects Software\Houdini 15.0.347\bin\"

SET folderPath=c:/myProject/
SET fileName=myIfdFile_
SET startFrame=1
SET endFrame=100

CD /d %hbatchDir%
FOR /L %%A IN (%startFrame%,1,%endFrame%) DO (
  mantra -f %folderPath%%fileName%%%A.ifd
)
PAUSE
Edited by AlSk

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0