HUD on OpenGl previews
-
Hi guys,
As you may know, c4d doesn't allow adding watermark post-effect (project name, Time Code...) to OpenGl render engine.
I'm trying to do this in python. but no luck!I've tried to add text objects that print the required attributes and attach them to the camera, but when adding DOF Effect in Enhanced OpenGL mode the text objects will disappear because they are simply out of focus.
I've also tried to add a custom HUD but unfortunately, HUDs don't render in OpenGL renderer too.
Until recently I discovered that realflow for c4d plugin add a special HUD that shows the particles count, fluid name.... and it renders in OpenGL!
-
How could I add such and HUD in python
-
if this is complicated could I exclude an object from being affected by DOF effect in python?
Your Help is much appreciated.
-
-
Hi @ashambe,
you can render HUD in OpenGL it's true that the Options tabs are not displayed if the render engine is set to OpenGL but if you defined it in standard (or even have the option container selected) then switch to OpenGL you can still access the Render HUD option.
With that's said you can have a Python Script that draws HUD text.
Here an exampleimport c4d #Welcome to the world of Python def draw(bd): values = [] # All txt to display txtList = [doc.GetActiveRenderData().GetName(), doc.GetDocumentName(), doc.GetFirstObject().GetName()] # Adds txt for each frame position = bd.GetSafeFrame() for x in xrange(len(txtList)): pos = c4d.Vector(position["cl"] + 2, 20 + 25 * x, 0) tmpDict = { "_txt" : txtList[x], "_position" : pos} values.append(tmpDict) # Sets the matrix to screen space bd.SetMatrix_Screen() # Enables depth buffer. bd.SetDepth(True) # Draws points indices at point coordinates bd.DrawMultipleHUDText(values) return True def main(): pass #put in your code here
And the attached scene with the code and the settings already enabled.
renderHud.c4dCheers,
Maxime. -
@m_adam
Thanks gana try them both, much appreciated. -
@m_adam
I've triedthe custom python script that draws HUD text but i'm stucked in the same original problem, The DOF effect is affecting the new HUDs which are blurred out
I've tried to change the value of the bd.SetDepth to False but no luck. -
@ashambe May I ask you in which version and OS (with version) are you?
Using the next code is working nicely in R21.1
# Disables depth buffer. bd.SetDepth(False) # Draws points indices at point coordinates bd.DrawMultipleHUDText(values) # Enables depth buffer. bd.SetDepth(True)
Cheers,
Maxime. -
Hey @m_adam
I'm Using r20 windows 10, Thanks a lot m_adam -
Hi @ashambe may I ask your code because here I'm not able to reproduce it with bd.SetDepth(False) in Win 10 R20.
Cheers,
Maxime. -
@m_adam
Hi, I'm testing the same code you've provided! -
Yes the code I provided didn't work but with
# Disables depth buffer. bd.SetDepth(False) # Draws points indices at point coordinates bd.DrawMultipleHUDText(values) # Enables depth buffer. bd.SetDepth(True)
It worked.
Can you share a scene, please?
What's your exact version (including subversion not only R20 but R20.XX) of Windows/Driver/Cinema 4D?
Since I can't reproduce, without more information I can't help you.Cheers,
Maxime. -
@m_adam
Ah OK great will test it and get back to you, Thanks sir.