Jump to content
Elias

Render time burn-in

Recommended Posts

I'm trying to burn in the time it took to render a frame, or possibly have it added as meta data. I wonder, could this be accomplished with a post frame script? What does such a script look like?

Cheers,

Elias

Share this post


Link to post
Share on other sites

1 - In your viewport hit "d"

2 - goto the guides tab

3 - under addition information click "show time"

4 - make sure "Full frame" is pulled down.

That only works for flipbooks, but it's a shot in the right direction.

Share this post


Link to post
Share on other sites

If you render through a queue manager it will save the statistics for the renders. For example HQueue that comes with Houdini. If you're rendering on a workstation you can open the Scheduler window from the Render menu at the top of Houdini, then deselect the checkbox to clear completed renders (bottom left).

Share this post


Link to post
Share on other sites

I'm rendering on a workstation, and I can use the render scheduler to see the render times. But I'm right now testing out the wedge ROP and it becomes hard to pair times to images pretty quickly. That's why I would ask for a burn-in. I've gotta look into hqueue and test that out as well. Currently i'm using the hwatermark program to do the burn-in, but I guess there isn't a variable for last rendered frame available in a GUI session. I'm aware of that I can see times in the terminal when rendering, but I don't know if I can extract that information easily.

Share this post


Link to post
Share on other sites

I've just realized that Apprentice can't generate disk files and therefore I can't use Hqueue :-/

Share this post


Link to post
Share on other sites

Changing the verbosity level on your mantra rop to something like 3 will give you render times per frame in your Houdini shell. You could still render via command line using Hscript/Hbatch with apprentice.

The other option is turning on the rendertime diagnostic AOV which will give you the render time for each bucket, then finding some way to add up all the buckets of the image.

Share this post


Link to post
Share on other sites

That's an interesting approach, should be possible to add all the pixel values together with COP -> CHOP and divide by the number of buckets.

Sure, raising the verbosity level gives the time in the terminal but that's not very useful when you render out a lot of wedges. How do you pair the time value with the correct image?

Sure, by simply sorting the files by when they were last edited I can see how many minutes it took to create, but it's not really accurate. I'm a little surprised that a render time variable isn't available?

Share this post


Link to post
Share on other sites

I think youd have to factor in the bucket size as well if your gonna try that approach, each pixel of the bucket represents the time it took to render that entire bucket

Share this post


Link to post
Share on other sites

You may take a look on this page: http://www.sidefx.com/docs/houdini12.5/render/python for inspiration.

Houdini comes with a tool called hwatermark. It's a matter of giving it a data to print-in render time on your image.

The ugly way is to use Post-render scripts or Shell ROP and parse mantra output. Another, perhaps cleaner, approach is to use Python IFD filtering.

Save bellow snippet to somefile.py and set command parm on Mantra ROP to mantra -P somefile.py. .

This is just an example. Even nicer would be using bucket callback, which actually knows time and ram usage during render time (as stated in above Help page), but - if I'm not mistaken - it won't work, as the last bucket still keeps image open.


import mantra, time, os
start_time = 0

def filterRender():
global start_time
start_time = time.time()

def filterEndRender():
image = mantra.property("image:filename")[0]
rtime = time.time() - start_time
font = os.path.join(os.getenv("HH"), "fonts/Courier")
rtime = time.strftime("%H:%M:%S", time.gmtime(rtime))
command = 'hwatermark -x 4 10 -m "Render time: %s" %s %s %s 10' % (str(rtime), image, image, font)
os.system(command)
[/CODE]

edit: ("image:filename") could be actually anywhere...

hth.

skk.

Edited by symek

Share this post


Link to post
Share on other sites

This is just an example. Even nicer would be using bucket callback, which actually knows time and ram usage during render time (as stated in above Help page), but - if I'm not mistaken - it won't work, as the last bucket still keeps image open.

It actually works for me if I start hwatermark as a new subprocess. This way mantra can close the file and hwatermark can edit it. Maybe you could even add a little delay so it's more robust.

Just enter the file with the script into the Statistics>vm_tilecallback parameter.


import mantra, os, datetime
from subprocess import Popen

tile = mantra.property("tile:ncomplete")[0]

if tile == 1:
ntiles = mantra.property("tile:ntiles")[0]

if tile == ntiles:
image = mantra.property("image:filename")[0]
total = mantra.property("tile:totaltime")[0]
font = os.path.join(os.getenv("HH"), "fonts/DejaVuSans")
wm = os.path.join(os.getenv("HFS"), "bin/hwatermark.exe")
command = '%s -x 10 10 -m "RENDERTIME: %s h:mm:ss" %s %s %s 15' % (wm, str(datetime.timedelta(seconds=int(total))), image, image, font)
Popen(command)
[/CODE]

Best,

Dennis

Edited by dennis.weil

Share this post


Link to post
Share on other sites

It's unfortunate however that hwatermark seems to clamp the pixel values to a 0-1 range. Is there any way around this?

Share this post


Link to post
Share on other sites

ah, this seems to be an issue with most old-school SESI image tools (like icomp), they are 8bit internally (only IMG_Image converts from and to on read/write).

Share this post


Link to post
Share on other sites

Hmm, that's really unfortunate. I've been trying PIL but it doesn't support exr and I could not get any python wrapper for ImageMagick to work. Maybe I should try to use the commandline version of ImageMagick instead. IM at least supports 16bit floating point. I will go ahead and give it a try.

Edited by dennis.weil

Share this post


Link to post
Share on other sites

For my purposes I can live with the clamping, but it is indeed unfortunate. Is there any way to add the data as metadata instead?

Share this post


Link to post
Share on other sites

For my purposes I can live with the clamping, but it is indeed unfortunate. Is there any way to add the data as metadata instead?

As far as I know OpenEXR has no mechanism for metadata. It would be a nice feature to have because other things like the artist and render node could be embedded in the image too.

Share this post


Link to post
Share on other sites

Looking at an EXR in nuke there is plenty of metadata, so i think it is possible? exr/comment could be a place to put it. I wonder if hwatermark is advanced enough to do the trick.

Share this post


Link to post
Share on other sites

Looking at an EXR in nuke there is plenty of metadata, so i think it is possible? exr/comment could be a place to put it. I wonder if hwatermark is advanced enough to do the trick.

Nice! Do you know if that's specific to Nuke or is that a standard thing? When looking at the OpenEXR specifications I couldn't find anything about metadata, maybe I'm looking in the wrong places though. This is where I checked first but there might be newer developments not in the documentation.

http://www.openexr.com/openexrfilelayout.pdf

Edited by lukeiamyourfather

Share this post


Link to post
Share on other sites

OpenEXR files can hold any number of metadata information, they are not hard coded beyond standard set. "comment" is one apparently acclamed as standard. Unfortunatelly Houdini does not allow to add custom tags to a file. SESI recently has added camera matrices to exr output (similarly to rat files), "comment" was always there on Mantra ROP.

edit: if I'm not mistaken, one of openimageio command line tools allows for adding string attributes to a EXR file.

Edited by symek
  • Like 1

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

×