Chaos Corona Forum
Chaos Corona for Cinema 4D => [C4D] I need help! => Topic started by: raffaele.tortora88 on 2024-06-21, 09:54:14
-
Goodmorning everyone,
i've the following problem. I have a c4d file which render well with right illumination when i render it from Cinema4D manually. Instead, when i run mi python script all is dark, illumination doesn't work.
I use following code:
# Crea un nuovo bitmap
bmp = bitmaps.BaseBitmap()
if bmp is None:
return
# Ottieni le impostazioni di rendering correnti
rd = doc.GetActiveRenderData()
# Imposta la risoluzione del bitmap
bmp.Init(int(rd[c4d.RDATA_XRES]), int(rd[c4d.RDATA_YRES]))
# Esegui il rendering
result = c4d.documents.RenderDocument(doc, rd.GetData(), bmp, c4d.RENDERFLAGS_EXTERNAL)
if result == c4d.RENDERRESULT_OK:
bmp.Save(output_file, c4d.FILTER_PNG)
print("Rendering completed successfully.")
else:
print("Error during rendering.")
Seems there are some settings (like Global Illumination) which are not used when i run render from script.
Can you give me some support?
Thanks in advance
-
Why are you rendering with a Python script? Just curious.
-
The gamma correction is missing on the version saved through Python. I think it's handled by C4D Picture Viewer but it's bypassed in this case, so you have to find a way to add it to your bitmap before saving.
(https://i.imgur.com/gU1QaPE.gif)
-
Hi,
thank you very much for your reply.
My project regard rendering automation. I've developped a python script which elaborate a JSON with some operations (import object in scene, change material, move object...) and at the end make render.
John_Do, i've tried to execute gamma correction on saved image but with not good results. Can you please suggest me which kind of correction have you made on the example picture you have posted?
Thank you very much.
-
John_Do, i've tried to execute gamma correction on saved image but with not good results. Can you please suggest me which kind of correction have you made on the example picture you have posted?
It's just an Exposure layer in Photoshop with the gamma value set to 2.2, nothing fancy!
-
i've resolved the problem changing creation of bmp using method MultipassBitmap:
# Ottieni le impostazioni di rendering correnti
rd = doc.GetActiveRenderData()
# Crea un nuovo bitmap
# bmp = bitmaps.BaseBitmap()
bmp = bitmaps.MultipassBitmap(int(rd[c4d.RDATA_XRES]), int(rd[c4d.RDATA_YRES]), c4d.COLORMODE_RGB)
bmp.AddChannel(True,True)
if bmp is None:
return
# Imposta la risoluzione del bitmap
#bmp.Init(x=int(rd[c4d.RDATA_XRES]), y=int(rd[c4d.RDATA_YRES]), depth=32)
# Esegui il rendering
result = c4d.documents.RenderDocument(doc, rd.GetData(), bmp, c4d.RENDERFLAGS_EXTERNAL)
if result == c4d.RENDERRESULT_OK:
bmp.Save(output_file, c4d.FILTER_PNG)
print("Rendering completed successfully.")
else:
print("Error during rendering.")
Thanks you all for your suggestions