Render Plugin problems

Date : Sat, 20 Jan 2007 17:46:49 +0100
To : <XSI(at)Softimage.COM>
From : "Daniel Rind" <daniel.rind(at)chello.at>
Subject : Render Plugin problems
Hi!
 
I'm still writing on that Gelato render plugin for XSI, and everything is coming together quite nicely. I've encountered a few problems, however, so maybe one of you has some ideas or workarounds, or I might save someone a few headaches with my workarounds:
 
Retrieving rendering options:
 
This seems to be a more general problem in XSI. Try this:
 
-) make a new scene
-) on the render tab, under Render->Scene Options, select "Hardware Renderer" as your scene renderer
-) draw a render region in a viewport (it will render with the hardware renderer)
-) right click on the region->Options
 
The region options will open, and the render options tab will be the one for mental ray, even though the hardware renderer is active. When you change the region renderer from "Use Scene Render Options" to "Hardware Renderer", the correct tab will be displayed.
 
Now when you are working with the standard renderers, then this is only a cosmetic problem. But when you are writing a rendering plugin, this is very ugly.
 
The context you get passed contains a GetRendererProperty function which should return the currently active rendering options. If there are no local options, however (like in the example above), this will return a NULL reference. So, I wrote a function that basically does this:
 
- grab options from context
- are they even there? when yes, finished
- when no, grab options from current pass
- are they even there? when yes, finished
- when no, grab options from scene passes container
- are they even there? when yes, finished
- when no, there's something fundamentally wrong, since the scene passes container should have a local options container for all installed renderers, so bug out with an error message
 
Now, this is not very "nice", but it works. My question now is: Is this the correct way to handle this? Is the RendererContext->GetRendererProperty function working correctly?
 
Getting Framebuffers/RenderChannels:
 
I'm trying to make the Gelato renderer feel just as integrated in XSI as mental ray, so that includes render channels and multiple framebuffers per render. Luckily, Gelato supports that natively (and in a very nice and flexible way, I have to say).
 
Again, the RendererContext should give the rendering plugin everything it needs through the GetFramebuffers function. However, for me this always returns an empty CRefArray.
 
So, I'm again running off into the passes and grabbing my Framebuffers from the currently active pass, which so far works nicely. However, when I try to get the render channel for a frame buffer (through the Framebuffer->GetRenderChannel() function), I always get an empty object back.
 
That's not too bad for the normal file outputs for a pass, I can extract enough information from the Framebuffer's Format and DataType properties to construct the correct output, but for the render region it's not so cool. The Framebuffer I get from the RendererContext->GetDisplayFramebuffer also doesn't contain a Renderchannel. Therefore, currently, the Channel-> setting on the render region doesn't do anything, since I can't get the selection the user made.
 
Am I doing something wrong here? Is there some way I can get the render channel the user currently has selected for the render region? Is there generally any way I can find out if the render is happening in a region?
 
General Rendering Plugin Question:
 
Well - is anyone even interested in using a different renderer than mental ray in XSI? If yes, then why? What are the features you are looking for in other renderers?
 
Ciao, Daniel!

Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.