Hello,
Thanks for your complete answer.
I think I will not start in thread management, but opted for your last solution which will still go through an external image but in an automated way by a python script.
Thanks again.
Latest posts made by bioquet
-
RE: Displacer Deformer with Mograph Camera Shader not working
-
Displacer Deformer with Mograph Camera Shader not working
hello,
In the same c4d file, I need to deform a object with a Displacer Deformer which has a material Mograph Camera Shader in shading. It's working with a common shader but not with a Mograph Camera Shader which is not taken into account.However, the process works well in 2 distinct steps :
1/ render the source camera (a part of the scene) and save a external image
2/ import the external image into the shading of Mograph Camera Shader, to deform the object (a other part of the scene) according to the source camera view, then render the second final camera.But the source view is animated and many render are needed in production. This is not very optimized and it would be better if it were automatic, without saving an external image for each rendering.
Question 1 : So I would like to know if there is a way to make the Displacer Deformer working with a Mograph Camera Shader in shading, a tip to make it work wythout python ?
Question 2 : if not, would it be possible to do this in python, with the folowing steps :
1 - retrieve the rendering from the source camera as the Mograph Camera Shader does and create the corresponding bitmap
2 - assign this bitmap to the shading of the displacer deformer
3 - launch final rendering from the second cameraThanks in advance
-
RE: RenderDocument/PythonCallBack : how to display progress prints during the render
Hello,
Thank you very much for your quick reply.
It works perfectly now.
I just removed the "mxutils" which was not compatible with my s26 version -
RenderDocument/PythonCallBack : how to display progress prints during the render
hello,
when I run from script manager the maxon script below to launch a render and display the progress in the console, all the prints of line 44 in "def PythonCallBack"print("ProgressHook called [{0} / p: {1}]".format(text, progress * 100.0))
are not displayed as the render progresses but all at once at the end of the render.
What should I do to see these prints during the render ?Thanks in advance
Here is the link to the script :
https://developers.maxon.net/docs/py/26_107/modules/c4d.documents/index.html?highlight=renderdocument#c4d.documents.RenderDocument"And the maxon script :
""" Copyright: MAXON Computer GmbH Author: Maxime Adam Description: - Render the current document with a progress hook to get notified about the current rendering progress. Class/method highlighted: - c4d.bitmaps.MultipassBitmap - c4d.documents.RenderDocument() """ import c4d def PythonCallBack(progress, progress_type): """Function passed in RenderDocument. It will be called automatically by Cinema 4D with the current render progress. Args: progress (float): The percent of the progress for the current step progress_type (c4d.RENDERPROGRESSTYPE): The Main part of the current rendering step """ text = str() if progress_type == c4d.RENDERPROGRESSTYPE_BEFORERENDERING: text = "Before Rendering" elif progress_type == c4d.RENDERPROGRESSTYPE_DURINGRENDERING: text = "During Rendering" elif progress_type == c4d.RENDERPROGRESSTYPE_AFTERRENDERING: text = "After Rendering" elif progress_type == c4d.RENDERPROGRESSTYPE_GLOBALILLUMINATION: text = "GI" elif progress_type == c4d.RENDERPROGRESSTYPE_QUICK_PREVIEW: text = "Quick Preview" elif progress_type == c4d.RENDERPROGRESSTYPE_AMBIENTOCCLUSION: text = "AO" # Prints to the console the current progress print("ProgressHook called [{0} / p: {1}]".format(text, progress * 100.0)) def PythonWriteCallBack(mode, bmp, fn, mainImage, frame, renderTime, streamnum, streamname): """Function passed in RenderDocument. It will be called automatically by Cinema 4D when the file rendered file should be saved. Args: mode (c4d.WRITEMODE): The write mode. bmp (c4d.bitmaps.BaseBitmap): The bitmap written to. fn (str): The path where the file should be saved. mainImage (bool): True for main image, otherwise False. frame (int): The frame number. renderTime (int): The bitmap frame time. streamnum (int): The stream number. streamname (streamname: str): The stream name. """ text = str() if mode == c4d.WRITEMODE_STANDARD: text = "Standard" elif mode == c4d.WRITEMODE_ASSEMBLE_MOVIE: text = "Assemble Movie" elif mode == c4d.WRITEMODE_ASSEMBLE_SINGLEIMAGE: text = "Assemble single image" print("ProgressWriteHook called [{0} / p: {1}]".format(text, renderTime)) def main(): # Retrieves the current active render settings rd = doc.GetActiveRenderData() # Creates a Multi Pass Bitmaps that will store the render result bmp = c4d.bitmaps.MultipassBitmap(int(rd[c4d.RDATA_XRES]), int(rd[c4d.RDATA_YRES]), c4d.COLORMODE_RGB) if bmp is None: raise RuntimeError("Failed to create the bitmap.") # Adds an alpha channel bmp.AddChannel(True, True) # Renders the document if c4d.documents.RenderDocument(doc, rd.GetData(), bmp, c4d.RENDERFLAGS_EXTERNAL, prog=PythonCallBack, wprog=PythonWriteCallBack) != c4d.RENDERRESULT_OK: raise RuntimeError("Failed to render the temporary document.") # Displays the render in the Picture Viewer c4d.bitmaps.ShowBitmap(bmp) if __name__ == "__main__": main()