UNSOLVED Get identical document as the Render document

Hello,

I'm trying to create a script where I export models from the document across different frames exactly as they appear in the animated render.

However there are differences. The document is sampling a noise to drive values, and there could be minute differences between the editor document and the render document that is causing it to produce slightly different values.

Is there a way to ensure in my script that I'm using the exact same document execution that the renderer is using?

I think I managed to make it work by using:

c4d.documents.LoadDocument(docPath, c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS)

and then going to the end of the document and rewinding back to the beginning.

Doing this on the active document didn't work.

I'm using the Render execute passes as well, and the combination of all these seem to match the render results.

After more testing unfortunately there were still differences, not sure if I'm missing the proper way to go with it or if it's a limitation that the editor won't ever match the render state precisely.

Hi @orestiskon the way to have a document identical to what is render, is to animate the document from the beginning to the targeted frame and evaluating the document each frame. The evaluation of a document is done via ExecutePasses.

One important thing is that internally sometime Cinema 4D use several call to ExecutePasses to really have the final result. Usually calling it 3 time in a raw is enough.

There is the basedocument_animate example which demonstrate how to animate a scene, one things to note is the use of DrawView, this internally does call ExecutePass beside also refreshing the ViewPort.

Hope it helps,
Cheers,
Maxime.