Can you help me update my panorama rendering script for new Blender/Yafray?

I have the script shown below which I’ve used happily for years. The script is designed to render 10 images in total. The first 4 are from cameras in the corners of a room. The next 6 are from cameras in the center of the room pointed in 6 directions with proper lens settings for a quicktime panorama mov file. The script still works fine to generate the images but the trouble I have is that I no longer have a method for selecting YafRay as the rendering engine.

Unfortunately, the new version of Blender does not allow me to select YafRay on the Render section and set that as the default rendering engine. So, the script always uses Blender Internal. It seems I have to use the Render->YafRay Export 0.1.1 options to create a YafRay render but I do not know how to automate this.

It’s somewhat critical to my workflow since I usually spend all evening modeling and then kick off my normal set of 10 renders just before I go to bed. They often take all night to render. So, it’s painful to do this manually and I have become fond of YafRay. I’d rather not return to BI.

So, if anyone could help me understand how to modify this script to render to YafRay instead of Blender internal. I would be extremely grateful!


import Blender
from Blender import *
 
scn = Scene.getCurrent()
cntx = scn.getRenderingContext()
frame = cntx.currentFrame()

frame = 1;

while frame < 11:
	if (frame==1):
	  cntx.imageSizeX(1280)
	  cntx.imageSizeY(1024)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera01"))
	if (frame==2):
	  cntx.imageSizeX(1280)
	  cntx.imageSizeY(1024)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera02"))
	if (frame==3):
	  cntx.imageSizeX(1280)
	  cntx.imageSizeY(1024)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera03"))
	if (frame==4):
	  cntx.imageSizeX(1280)
	  cntx.imageSizeY(1024)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera04"))
	if (frame==5):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera05"))
	if (frame==6):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera06"))
	if (frame==7):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera07"))
	if (frame==8):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera08"))
	if (frame==9):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera09"))
	if (frame==10):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera10"))
	cntx.startFrame(frame)
	cntx.endFrame(frame)
	scn.update()
	cntx.renderAnim()
	frame=frame+1

Perhaps if I up the ante? $50 via paypal for a solution?

Try this:

Just the one extra line: cntx.setRenderer(Render.YAFRAY)

import Blender
from Blender import *
from Blender.Scene import Render 
scn = Scene.getCurrent()
cntx = scn.getRenderingContext()
frame = cntx.currentFrame()
cntx.setRenderer(Render.YAFRAY)

frame = 1;

while frame < 11:
	if (frame==1):
	  
	  cntx.imageSizeX(1280)
	  cntx.imageSizeY(1024)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera01"))
	if (frame==2):
	  cntx.imageSizeX(1280)
	  cntx.imageSizeY(1024)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera02"))
	if (frame==3):
	  cntx.imageSizeX(1280)
	  cntx.imageSizeY(1024)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera03"))
	if (frame==4):
	  cntx.imageSizeX(1280)
	  cntx.imageSizeY(1024)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera04"))
	if (frame==5):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera05"))
	if (frame==6):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera06"))
	if (frame==7):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera07"))
	if (frame==8):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera08"))
	if (frame==9):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera09"))
	if (frame==10):
	  cntx.imageSizeX(1000)
	  cntx.imageSizeY(1000)
	  Scene.getCurrent().setCurrentCamera(Object.Get("Camera10"))
	cntx.startFrame(frame)
	cntx.endFrame(frame)
	scn.update()
	cntx.renderAnim()
	frame=frame+1

Right forget above, are there any default settings that you have for yafaray at all?

No default settings that I know of… I tried the above script and the renders produced do say YafRay:Render on them but they do not seem to be rendered with YafRay. For instance, if I set a material in the YafRay area, the render still looks like the blender material gray color. I guess I’m confused now because perhaps it’s using an old version of YafRay that Blender used to call directly from the tool… not the new one that comes as a pull down under the Render->YafRay export menu.

Let me back up a minute and make sure I am thinking about this correctly. I’ve honestly been away from Blender for a few months. In the past, Blender used to take all of my material settings from the main window and had a YafRay tab on the rendering section. That’s how I set my models up.

Now, with the new Blender, there seems to be no YafRay tab in the Render section and some of the material settings set in Blender seem to have no affect. It seems to me that I have to set some material settings like color in the YafRay window that pops up when I click Render->YafRay. Light intensity is another.

I assumed Blender decoupled the two so that you could have a single model that could render in both rendering engines and look good. Is this correct?

Now that I am caught up, it seems that your script might be using an old methodology of calling YafRay directly and using he material settings straight from Blender. While this sounds convenient, I guess it’s not the current methodology. Just trying to stay current here and get my script working again. So, I guess this approach isn’t working. Does this sound right to you?

Thanks for your help so far!

Yafray has not been in development for a number of years so is obsolete and longer exists as part of blender from version 2.49. Yafaray is an external renderer linked to blender by a script. You should also post your question at the yafaray site www.yafaray.org

Richard

Yafray has not been in development for a number of years so is obsolete and longer exists as part of blender from version 2.49. Yafaray is an external renderer linked to blender by a script. You should also post your question at the yafaray site www.yafaray.org

Richard

I realised that after writing the code. If you knew what defaults you want when you run the yafaray script then it could be possible to call the yafaray export script from your script sending your default settings in as parameters. BUT I can see you having different material settings on every scene so this is probably going to be impossible and will not be a very good work around for you.

Whats stopping you from moddeling in blender 2.49 and rendering in 2.45?

There are certainly a lot of hackey work around but as I use blender for a business I was hoping to keep the tools and methodologies up to date… not rely on old versions of tools or scripts. Now, it seems I am faced with a decision of what to do… simply upgrading my script may not be the best idea since apparently YafRay is outdated. It almost seems as though I should adopt a new rendering engine and forget YafRay. Perhaps Blender internal has improved enough to make it worth while… Thanks for the help guys. Guess it’s back to the drawing board for me…

What’s interesting is after I used your script, the old Rendering menus came back where I am now able to select YafRay as a rendering engine from the Render menu in blender.

Can you give an example of the stuff you normally need to render? I think blenders internal renderer has come a long way… failing that why not lux render www.luxrender.net or get a commercial licence for indigo?

I wonder if I should/could consider modifying the script to use LuxRender but the only thought I have there is that LuxRender doesn’t have a “done” point does it? It just keeps rendering until I tell it to stop. Maybe the script could have a setting in it for an amount of time that I tell LuxRender to render for. So, I could set it up to render my 10 images giving each image 1 hour or something like that. But last time I tried LuxRender, I was having major firefly issues. Ugh… not sure what to do.

It’s things like that that make it hard to use Blender in a business environment.

can’t you just animate the camera and it’s settings and render an animation? that way you can use yafaray.

I don’t usually have time for that. The panorama provides much of the same benefit without all the render time. I can usually render all 10 images overnight whereas an animation would likely be composed of many many frames… dozens, hundreds or even thousands.

i didn’t meant to do an animation, it was to animate the camera in 10 frames, so you’ll get all the shots you need.

but maybe i’m getting it wrong, can you provide a sample file?

something like this script http://www.alienhelpdesk.com/python_scripts/old_scripts

That’s interesting. The problem is that I need to have some images taken with a camera that has certain lens settings and other images taken with a camera that has other lens settings. I’ll take a look at that script.

you can animate the lens, press ‘i’ on top of the lens settings to insert a key.

there should also be a camera swap script where you swap to a different camera per frame, a 10 frame animation and you should be done.