I would like to test a few different render parameters like nr of samples on the same scene. It would be much easier for me to be able to actually show the parameter information in the picture as a small text somewhere at the bottom of the image. Is there any way to do this? I've prepared an example result of what I am looking for:
2 Answers
You have the text for output in metadata chapter of render tab in properties editor. You can access it from your script. I've used something like this to output some values:
import bpy
def driverFunc():
'it returns clamp indirect value based on frame number, also changes text in the stamp'
frame = bpy.context.scene.frame_current
samples = bpy.context.scene.cycles.samples
cli = bpy.context.scene.cycles.sample_clamp_indirect
cli = 30.0
#set stamp text
bpy.context.scene.render.stamp_note_text = "s" + str(samples) + "; cli" + str(cli)
return cli
if (frame == 1):
cli = 0.0
else:
if (frame < 11): #first ten = +1.0
cli = (frame - 1) * 1.0
else: #all next = +10.0
cli = (frame - 10) * 10.0
#set stamp text
bpy.context.scene.render.stamp_note_text = "s" + str(samples) + "; cli" + str(cli)
return cli
bpy.app.driver_namespace['driverFunc'] = driverFunc # add function to driver_namespace
I added driver for clamp value, you can use some unused property of some object just to get this work on render. Otherwise it will not update the props. In the driver expression I used this driverFunc() call, (which value could matter or not), but it has a side effect - it sets bpy.context.scene.render.stamp_note_text. Just create the empty text with ".py" extension, paste the code, fix it to show your own values, run the script, and then you can use the name of the function in any driver. Do not hesitate to output metadata, it will show only in combined layer of render result. When you save the multi-layer exr, for example, no source layers contain the text, so you can freely compose them to the final image. Hope it will help.