Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Sometimes after my computer has been turned on long enough I am no longer able to open up C4D. It gets stuck on: "loading plugins" and when I run c4d with the argument "g_console=true" I get this output:
Application start : 06/06/22 at 13:43:12 Executable : 64 Bit Version / Build : 19.068 / RB245443 Debugger : not available Memory model : release Startup path : file:///C:/PFxBOB/Cinema 4D R19 Application path : file:///C:/PFxBOB/Cinema 4D R19/CINEMA 4D.exe Application executable : file:///C:/PFxBOB/Cinema 4D R19/CINEMA 4D.exe Resource path : file:///C:/PFxBOB/Cinema 4D R19/resource Module path(s) : file:///C:/PFxBOB/Cinema 4D R19/corelibs Temporary path : file:///C:/Users/BOB/AppData/Local/Temp Prefs path : file:///C:/Users/BOB/AppData/Roaming/MAXON/Cinema 4D R19_2561E711 Global Prefs path : file:///C:/Users/BOB/AppData/Roaming/MAXON OS version : Windows 10, 64 Bit, Unknown Edition (125) (build 14393) Processor : 8(16)x Intel Core i7-5960X CPU Computer name : BOB-MACHINE Thread Count : 16 Cpu Speed (MHz) : 3010.000 Application Type : Modular Command line arguments : "g_console=true" Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/browser.xdl64 with module(s) net.maxon.c4d.browser Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/c4dplugin.xdl64 with module(s) net.maxon.c4dplugin net.maxon.c4d.c4dplugin Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/crashhandler.module.xdl64 with module(s) net.maxon.crashhandler Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/crypt.module.xdl64 with module(s) net.maxon.crypt Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/drawport.module.xdl64 with module(s) net.maxon.drawport Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/drawport_general.module.xdl64 with module(s) net.maxon.drawport_general Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/drawport_opengl.module.xdl64 with module(s) net.maxon.drawport_opengl Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/drawport_selector.module.xdl64 with module(s) net.maxon.drawport_selector Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/embree.module.xdl64 with module(s) net.maxon.embree Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/geom.module.xdl64 with module(s) net.maxon.geom Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/gui.module.xdl64 with module(s) net.maxon.gui Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/image.module.xdl64 with module(s) net.maxon.image Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/image_openexr.module.xdl64 with module(s) net.maxon.image_openexr Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/image_winmf.module.xdl64 with module(s) net.maxon.image_winmf Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/io_obj.xdl64 with module(s) net.maxon.c4d.io_obj Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/math.module.xdl64 with module(s) net.maxon.math Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/mesh.module.xdl64 with module(s) net.maxon.mesh Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/misc.module.xdl64 with module(s) net.maxon.misc Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/mkmodeler.xdl64 with module(s) net.maxon.c4d.mkmodeler Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/network.module.xdl64 with module(s) net.maxon.network Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/opencl.module.xdl64 with module(s) net.maxon.opencl Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/opensubdiv.module.xdl64 with module(s) net.maxon.opensubdiv Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/render.module.xdl64 with module(s) net.maxon.render Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/shaderbase.module.xdl64 with module(s) net.maxon.shaderbase Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/tessellation.module.xdl64 with module(s) net.maxon.tessellation Loading file:///C:/PFxBOB/Cinema 4D R19/corelibs/xtensions.xdl64 with module(s) net.maxon.c4d.xtensions OpenGL root context initialized Vendor : NVIDIA Corporation (NVIDIA) Renderer : GeForce GTX 970/PCIe/SSE2 OpenGL version: 4.6.0 NVIDIA 457.09 Driver version: 457.09 OpenGL root context initialized Vendor : VMware, Inc. (VMWARE) Renderer : Gallium 0.4 on llvmpipe (LLVM 4.0, 256 bits) OpenGL version: 3.3 (Core Profile) Mesa 17.0.1 (git-) Driver version: 17.0.1 (git-) ZeroConf error: Couldn't get bonjour version [sys_bonjour.cpp(1725)]
Any idea on how to fix this without restarting the computer? It usually works after restarting. I'm not sure if it's related to a specific plugin given where it's getting stuck, but I'm not sure. Any ideas on how to debug this?
I’m trying to render an animation from the commandline but it fails because an “asset is missing”. What’s interesting is that the asset in reference is from the “Studio.lib4d” file located in the “library/browser” subfolder of the Cinema 4D R19 installation directory. I used a material from that preset library in the animation, but it renders fine in the GUI version of C4D, so I don’t understand why it is missing from the commandline version. Here’s my example command:
&"C:\PFxPK2\Cinema 4D R19\Commandline.exe" -render "\\networkdrive\myfolder\heart.c4d"
and here’s the output:
How do I get the commandline version of C4D to recognize the .lib4d library files in the library/browser folder?
@m_magalhaes This worked great, thank you.
I want to change the value of a parameter and then export a .gltf file in C4D R23, and do this over and over again for many values. I'm trying to do it with this code, but it is not working:
import c4d from c4d import documents, plugins import c4d.documents as docs def main(): for ii in range(882): obj = doc.SearchObject("Selector") obj[c4d.ID_USERDATA,1] = ii docs.SaveDocument(c4d.documents.GetActiveDocument(), f'out{ii}.gltf', c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, format=c4d.FORMAT_GLTFEXPORT) c4d.EventAdd() if __name__=='__main__': main()
Unfortunately, I get this error:
How do I fix this? I think I need to specify the gltf export settings somehow, but I don't know how to do this.
@ferdinand Thank you, your example worked great. Now I understand how to use those symbols. Lowering the the degrees from 5 to 1 solved the issue. Thanks!
Example for anyone curious:
spline = c4d.SplineObject(total_points, c4d.SPLINETYPE_CUBIC) spline[c4d.SPLINEOBJECT_INTERPOLATION] = c4d.SPLINEOBJECT_INTERPOLATION_ADAPTIVE spline[c4d.SPLINEOBJECT_ANGLE] = c4d.utils.DegToRad(1.)
Basically, what I'm looking to do is increase the number of intermediate points. It seems like the default is to use "Adaptive" with an angle of 5 degrees. However, I would prefer for it to be lower (such as one degree), but I don't see any documentation on the SplineObject page on how to do this with the Python generator. Any ideas?
I found this page here, but I don't understand how to use that with the SplineObject.
I am using a Python generator to create a spline, and I set the interpolation to cubic. However, when the points of the spline are spread out enough, even with the cubic interpolation, it looks more like piecewise linear when getting closer. To it. Look at this video showing what I'm observing:
https://www.youtube.com/watch?v=_rNVelCUdxE
As you can see, it is certainly smoother than when I set the interpolation to linear, but even when it is cubic, when I zoom in enough, it still looks somewhat jagged, enough to be noticeable. At the end of the video I circle the cursor around the joints on the cubic spline.
Is there some way I can make the cubic interpolation smoother? I would prefer that the cubic interpolation splines doesn't look like a bunch of connected straight line segments.
@ferdinand Your flat UV projection solution worked great! Although I had to change the y to z and subtract the z range mappings from 1 in order to get it to work correctly. I will include a download in case anybody wants to see the details.
Now I just have a few more questions:
But it works when I render it:
Is there any way to get the Python shader to work in the viewport (not be completely black)? Or is it just too slow for that?
The Python shader is very slow to render. If I were to write the shader in C++ and compile it, would you expect a significant speedup? The code would be nearly identical to what I have in the Python "complexShader" code I presented above, but C++ obviously and instead of using Python's "cmath" module I would be using C++'s "std::complex". Would this render noticeably quicker than doing it in Python?
If I wrote a plugin in C++ to generate the geometry instead of doing it in Python, would you expect a significant speedup? I'm thinking so just because, from personal experience, I know nested for loops in Python are quite slow. The code I have written above slows down fast as the "resolution" variable increases. But I'm curious to hear your thoughts.
@m_magalhaes
It seems like there must be more to it or I'm doing something wrong. I added the following right above the return node line of code in the Python generator:
return node
uvwTag = node.MakeVariableTag(c4d.Tuvw, poly_count) c4d.EventAdd() for ii in range(poly_count): q = ii/poly_count uvwTag.SetSlow(ii, c4d.Vector(q,q,0), c4d.Vector(q,q,0), c4d.Vector(q,q,0), c4d.Vector(q,q,0))
But I'm still getting the red error color. I also have the Python plugin print "hi" when it errors, and it is printing "hi". I haven't done the math to correctly set the values for the UV coordinates yet (that "q" number is just a placeholder/test to see if it errors, and it does).
Regardless of what I set the UVW coordinates to be at each point, I shouldn't be getting the error color. So do you know what I'm missing?
@m_magalhaes Thank you, that Python fresnel example was extremely helpful. I got very close with the following:
import os import math import cmath import c4d from c4d import plugins, bitmaps, utils #warning Please obtain your own plugin ID from http://www.plugincafe.com # I didn't PLUGIN_ID=1027090 class complexShader(plugins.ShaderData): def __init__(self): #if a Python exception occurs during the calculation of a pixel colorize this one in red for debugging purposes self.SetExceptionColor(c4d.Vector(1,0,0)) def Output(self, sh, cd): if cd.vd: #if shader is computated in 3d space pi = math.pi u = cd.p[0] v = cd.p[1] tt = cd.t # /28.0 osc = math.sin(2*pi*tt) min_y = -2*pi max_y = 2*pi min_x = -2*pi max_x = 2*pi # to view correctly when applied to a plane in c4d, have x axis pointing right, z axis pointing up, and y axis pointing at the camera x = c4d.utils.RangeMap(u, 0, 1, min_x, max_x, clampval = True) y = c4d.utils.RangeMap(1-v, 0, 1, min_y, max_y, clampval = True) z = x + y*1j out = cmath.exp(z) angle = cmath.phase(out)/pi % 2.0 # wrap it at pi to match Mathematica's color mapping (mathematica: -pi = cyan, 0 = red, pi = cyan) hue = c4d.utils.RangeMap(angle, 0.0, 2.0, 0, 1, clampval = True) colorHSV = c4d.Vector(hue, 1.0, 1.0) colorRGB = c4d.utils.HSVToRGB(colorHSV) return c4d.Vector(colorRGB[0],colorRGB[1],colorRGB[2]) else: #if shader is computated in 2d space return c4d.Vector(0.0) def FreeRender(self, sh): #Free any resources used for the precalculated data from InitRender(). return def RegisterComplexShader(): IDS_COMPLEX_SHADER=10001 #string resource, must be manually defined return plugins.RegisterShaderPlugin(PLUGIN_ID, plugins.GeLoadString(IDS_COMPLEX_SHADER), 0, complexShader, "", 0) if __name__=='__main__': RegisterComplexShader()
This works on a plane. However, when I apply the same material to the Python generator, it returns the error color (red):
I'm assuming this is because the geometry generated in the Python generator doesn't have UVs. Is that correct? If so, what is the proper way to add them? If not, why does it work on the plane but not the Python generator (which contains the same code as my first post).
Here's the sample .c4d file and the .pyp plugin in case anybody wants to test it for themselves. I was testing this on R19: https://drive.google.com/file/d/1UJAsaYsEdKJKwafTau8-LDkLETSzgRNW/view?usp=sharing