Force viewport 2.0 scene render/refresh in batch mode (without using ogsRender)

Force viewport 2.0 scene render/refresh in batch mode (without using ogsRender)

Anonymous
Not applicable
1,227 Views
1 Reply
Message 1 of 2

Force viewport 2.0 scene render/refresh in batch mode (without using ogsRender)

Anonymous
Not applicable

Since M3dView::refresh() does not seem to be doing anything if Maya is being run in batch mode, how can I trigger/force a VP2.0 scene render without using the ogsRender command which unfortunately always reads back the rendered image and saves it to disk?

 

I need to do some custom OpenCL computations on the rendered image buffer and would also like to manage the readback to system memory myself (i.e. only after having buffered a number of images on the gpu).

 

I looked into pretty much all viewport 2.0 api classes and most dev kit examples but unfortunately couldn't find anything that would have the same effect as M3dView::refresh() in interactive mode.

 

The tool I'm working on was originally based off of the blast2Cmd devkit example and it works perfectly fine in interactive mode but since M3dView::active3dView() returns a non-functional 'default' instance in batch mode its inner rendering loop returns pretty much instantly since no rendering is being triggered:

 

for ( m_currentTime = m_startFrame; m_currentTime <= m_endFrame; m_currentTime++ )
{
	MAnimControl::setCurrentTime( m_currentTime );			
	//view.refresh( false /* all */, true /* force */ ); // doesn't trigger render
	//view.refresh( true /* all */, true /* force */ ); // doesn't trigger render
	//MGlobal::executeCommand( "refresh -f;" ); // doesn't trigger render
	MGlobal::executeCommand( "ogsRender -cf;" ); // DOES trigger render (yet ogs reads back image immediately)
}

 

Many thanks in advance for your help - it is very much appreciated!

 

 

PS: I'm currently testing this in M2016 but I'd assume that the issue will occur on all versions.

1,228 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

I am facing with the same issue..

0 Likes