Oct 2010
1 / 10
Oct 2010
Oct 2010

Folks,

I am running into a bizarre issue while rendering. I have a scene that imports geometry files (obj) at batch render time on per frame basis. (I did try using expressions first but they only work interactively and not in batch render)

I have a pre render frame MEL script which imports file at every frame which checks and deletes previous geomtry left by previous imports.

Similarly, I have a post render frame MEL script  which deletes the imported content after rendering.

All this works fine for Maya Software renderer, however it does not work with Mental Ray renderer.

I found out that I needed to uncheck "Optimize Non-Animated Display Visibility" option under Metal Ray>Translation>Performance to get this to work a bit. Now mental ray gets new imported geometry every frame and renders it, however it does not delete the previous frame geometry. So I have renderings which accumulate previous frame objects.

In render logs I see that I do the clean up properly, but mental ray just renders everything accumulated till that frame.

Can anyone of you provide an insight on what needs to done to get this working correctly.

Thanks

--Amit

  • created

    Oct '10
  • last reply

    Oct '10
  • 9

    replies

  • 2.9k

    views

  • 1

    user

  • 1

    link

. (I did try using expressions first but they only work interactively and not in batch render)

thats not true. Its all about what your exporssion looks like

I have a pre render frame MEL script which imports file at every frame which checks and deletes

dont do that import then replace the mesh by connecting the new meshes output to the inmesh slot. then delete the import. Then add dummy animation to the shape to force mennlatray to overwrite the node.

OR exporte all objs as mentalray render proxies. then use customn text to read the render proxies into the scene,

a alternate strategy is outlined at

http://forum.mentalimages.com/showthread.php?t=61672

Joojaa,

Thanks for swift tips.

Can you elaborate a more on how to accomplish the following

"dont do that import then replace the mesh by connecting the new meshes output to the inmesh slot. then delete the import.

Then add dummy animation to the shape to force mennlatray to overwrite the node."

You simply should use your RenderViewWindow for batch render when going with mr and mel scripts. Write a loop that jumps from frame to frame and render out your images. Maya will properly update your scene content in this case and all should work fine. Somebody wrote an interface for renderView batch rendering that should be located somewhere inside the maya download section here. Otherwise it needs only some few lines of mel to render this way. good luck

yes but thats no goodsolution if you need to send this stuff ytp a renderfarm, on account each frame taking 10 minutes to render,

but yeah its a 3 line for loop

likewise if time is no issue you can just render each frame separately witha batch for loop. Or by sumbitting one job per frame to the render manager. But the workaround to send all in one job is vaid.

yes of course
its then only a matter of how many time one would be willing to spend to fix those weird problems.
I usually do not tend to go the shortest way to achive results because there are always issues  deserving solutions for aesthetical reasons - even if its script related stuff, but i think this problem is none of such :biggrin:

I concur however we do not know wether ro not this is a issue that will become part of the pipeline in which case its sortof valid to spend time on the issue. Also sometimes the thing that counts is really the mental reward of the puzzle solving which leads to other discoveries.

Can you elaborate a more on how to accomplish the following

imagine a scene containing one sphere and one cube:

file -f -new;
polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 0;
polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 0;

Now you can make the cube a slave shape of the sphere by connecting:

connectAttr -f pSphereShape1.outMesh pCubeShape1.inMesh;

now if you disconnect then you have done a copy to a existing node. Wihout erasing nodes.

second part. Maya does not send updated versions of meshes to mentalray. What it odes is it gauges IF the node is possibly animated you need to fool maya into thinking it is.

nowayfra> thanks for your feedback. Yes writing a batch script to do frame by frame rendering is straight forward. I was looking for more insight and other work around. Like you/joojaa said its worth finding out a bit more rather than taking a shorter course.

joojaa> thanks for additional tips, currently I import the mesh (actually several) on per frame basis in their own namespace and then they get tossed out before loading new meshes in next frame. So I need to have a persistent node which will be using swapped out mesh on per frame basis to keep MR happily update the scene.

I am trying to think how to implement your idea with imported meshes.

now if you disconnect then you have done a copy to a existing node. Wihout erasing nodes.

Can you explain the above a bit more?

Can you explain the above a bit more?

did you run the snipets? Did you look what happens? (move the objects so they are not stackied), Im just using the simple facyt of how mayas hiostory works. I just use the shape as a history for the other shape (yes you can do that). Then just key the millionth point or something causing maya to think it needs to animate teh stuff.

PS: is there areason why you can not lead ll the objs in one go into the scene?

PPS: i can get this to work on preliminary tests, hard to say how stable it is at this time. Tough if i really wanted to do this in a real environment i'd make a new node.

Allright now I understand what you propose. I'll try this out using dummy mesh objects and report back if I am able to make this work. Thanks

PS: The obj is dumped by simulation code and there can be arbitrary number of meshes. I am creating a pipeline to render these using Maya.