Overview
Debugging Tools
When troubleshooting a complex node setup, it is often a matter of checking whether and, if so, which values are exchanged between the nodes. Are the data types correct and are the passed values within the expected range for subsequent calculations?
To simplify these steps, various functions are available to read data types and values directly at ports.
Info Box
The most obvious option is a grayed out area at the bottom left of the Node Editor. Here you can read the name of a selected node and if necessary also the type of the node or asset. If a port is selected on the node, its data type and often its value can also be read here. Since with more complex data types, e.g. vectors or matrices, several numerical values are transferred at the same time, the space for the complete representation of all values in the info area can become scarce. This is why the Info Area can be scaled by dragging its right edge. Furthermore, you can right-click on the displayed value and have the values copied to the clipboard. When pasting e.g. into the comment area of the node, all numerical values can then be read off.
Data Inspector
The second option circumvents this space problem when displaying larger amounts of data. To do this, right-click on a port and select Data Inspector from the context menu. You can also simply drag a connecting line from a port into an empty area of the Node Editor. After releasing the mouse button a context menu will open in which you can select the Data Inspector. Furthermore, the Data Inspector can be opened directly via the Debug menu in the Node Editor. A separate window opens, in which the data type and also the values present at the port can be read. To keep track of the port from which the values are displayed, a small dialog icon also appears next to the port (on the right side of the image above). It is also possible to display the values of several ports on one Node in the inspector. The inspector has its own drop-down menu in the header, where you can choose between the different marked ports. The evaluation of the port values for the inspector can be stopped by right-clicking on a read port and selecting "Data Inspector" again. You can also click on the Trash Can icon in the Data Inspector to remove the port data that was just shown from the display. It's often even faster if you click on the X symbol on the icon next to the respective port. You can also disable the transfer of the respective port values to the Data Inspector. Furthermore, a Remove All Data Inspectors command is available in the Node Editor that can be used to remove all ports from the Data Inspector.
Interactive Mode
It can often be helpful to take a quick look at the data supplied by a port. To do so you don't have to create a connection from the port to the Data Inspector because the Data Inspector also offers an Interactive Mode that can be accessed by clicking on the Square icon in its header (third icon from the right).
As you can see in the image above, existing port markings will be ignored for the Data Inspector and the option for switching the marked ports is disabled at the top of the Data Inspector. Only the currently selected ports will be displayed. All you have to do is click on the name of the respective Output port. In the image above, for example, the geometry data of the Capsule object is output.
If additional values of marked ports should be output, an additional Data Inspector can be opened, e.g., via the Node Editor's Debug menu.
Compact / Detailed Mode
Many data structures can be very complex. For example, the geometry information that has to manage both the point coordinates as well as the point numbers, which have to be connected with lines and polygons. The Data Inspector therefore offers two modes for displaying this data. You can switch between modes at the bottom of the dialog window:
- Compact Mode: This is the default mode. Only the most important information from the selected data set will be displayed. For geometry data, for example, this is the point coordinates and the indices of the polygons connected with these points.
- Detailed Mode: All data will be displayed in this mode. For geometry, for example, this also includes different selections on the object. The selection of the data to be displayed can be made by clicking on the different entries in the Data Inspector's columns (see image below).
Port Inspector
The third and most direct option for viewing port values can also be activated after right-clicking on a port. To do this, right-click on the port and this time select the Port Inspector in the context menu. Alternatively you can drag a connecting line from a port and drop it on an empty area of the Node Editor. The context menu will also appear here from which you can display the Port Inspector for this port. The value of the port can now be read directly in a field next to the port. This works even for more extensive data types, such as vectors, matrices and colors. Via the described context menu you can deactivate the display of the value at the port at any time again, or you can simply click on the X symbol on the left edge next to the displayed value.
Console Output
All previously-described functions bear the disadvantage that only current values can be displayed. The development of a value, e.g., if it increases or decreases during an animation, cannot be seen directly. In these cases, values can be sent to the Console where they are displayed in a successive list. For this, a Console Output Node must be integrated into an existing setup. The values passed through will then automatically appear in the Console. The Console is part of the Node Layout in Cinema 4D by default. Otherwise it can be opened anytime directly via the Extensions menu in Cinema 4D.
Additional information about the Console can be found here. Furthermore, the complete explanation of the Console Output Node can be found there as well.
Heat Map
When working with complex Node setups or when creating Asset Capsules it can be helpful if you can optimize the performance of the setup. For this to even be possible, we need a tool that displays the calculation time of each Node within the setup. And this is what the Heat Map does.
To activate the Heat Map, call up the command in the Node Editor's Debug menu. The bottom edge of all Nodes will then be colored and the relative calculation percentage required for each Node will be displayed, which will be updated on an ongoing basis. The colors will vary by default from blue to green to denote Nodes that calculate simply and quickly, to yellow and orange for Nodes that are increasingly complex to calculate. .The color red denotes Nodes with the greatest calculation requirements and take the longest to calculate. Those that either have no active connection to the rest of the setup or process static calculations that only take place once are colored black. In the image above you can see this on the Clamp Node. The defined value will therefore only be checked once and passed on unchanged to all subsequent calculation cycles. A continuous recalculation of such Nodes is therefore not necessary since they are seen as static.
If you prefer a different color scheme for the Heat Map you can modify it in the main Preferences menu in the Node Editor settings.
In addition to the colors, percent values will be displayed beneath each Node that show the amount of processing effort each Node has in relation to the overall setup or based on the Nodes within the same path depth. This differentiation is made via the Heat Map Relative Mode, which can also be found in the Debug menu. The image below shows how this option works.
At the top of the image you can see the main setup in which a Group is also used (Geometry Modifier Group). In this main section of the setup it doesn't matter whether or not the Relative mode is enabled. The percent values shown will always add up to 100% which means that the proportionate percentage each Node or Group has of the overall setup is displayed. However, if you open a Group and move one level down in the Node Path, the difference will become apparent (see also the bottom half of the image above).
At the bottom left you can see the Relative mode, which is active by default. The Heat Map values of the Nodes within the Group will also add up to 100%. The values will relate only to the currently visible Node Layer. At the bottom right you can see the result with Relative mode disabled. The percent values will, in the context of the overall setup, be calculated absolutely and the result will add up to the value that we could already read off the totals for the setup.
Evaluating the Heat Map
The coloring and percent values already give you an idea which elements in the setup require most of the calculation effort. This must, however, be seen in the right context. A Primitive Node may be highlighted red in the setup but is calculated quickly and can't be replaced by other Nodes. Therefore, there is no need for optimization here. What's important is the absolute time needed for the calculation. This information can be displayed using the Print Heat Map command in the Console. For this, the Heat Map does not necessarily have to be active.
As long as you're in the Nodes layout you will see the Console in the UI. Otherwise you can open the Console window via the main Window menu. The following image shows an output example of Heat Map data.
The output in the Nodes area of the Console is divided into four categories:
- Nodes
Here, all Nodes and Groups will be listed, together with their absolute (Abs%) and relative (Rel%) Heat Map values as well as the actual time (Time) that the calculation requires. Furthermore, in the 4th column, you can see the internal code or Node Path for each element. This is useful because this path can be highlighted with the mouse and copied to the cache via Ctrl+c and pasted into the Path Search Field. To do so, click on the Bookmark Icon at the top of the Node Editor. A Path field will open for the Node Path.
The display in the Node Editor will then jump directly to the defined Node, even if it's used in deeper Node Layers, i.e., within a Group. In addition, the respective Node will be selected automatically, which makes it easier to locate items within complex setups.
In the Console there are also several key terms next to each entry in the Nodes Group of the Heat Map output, including the Boolean values true and false: - isGroup: The values true or false show if the entry is a Group Node or a normal Node.
- hidden: Internally, a Node's function can be made up of other Nodes that are not visible in the Node Editor. For such Nodes true will be displayed, otherwise false.
- convSrc: This value shows if a data conversion from this Node on takes place or not. This is always the case if Pots are connected that make different data types available, e.g., such as Integer and Boole. In these cases, the Node System calculates an automatic conversion that, however, takes time. If possible, you should avoid conversions whenever possible for reasons of optimization. This applies in particular to the conversion of large amounts of data, e.g., when processing Arrays.
- Analysis
Here you will find a summary of the number of Nodes in the setup and the calculation time:- Timestamp: Here, an internal numeric value is given that the Heat Map evaluation follows.
- Frames: This information relates to the time range to which the setup is evaluated for the Heat Map. This time is output as a frame range in the scene, e.g., Frame (0 to 1) for the evaluation of the time range that lies between frame 0 and frame 1 in the Timeline.
- User Nodes: Here the total number of input Nodes for the setup is displayed. since Nodes can consist of other (invisible) Nodes internally (see also Hidden marker in the Nodes list), the actual number of Nodes to be calculated can easily be much greater than shown here.
- Executed User Nodes: This is the number of Nodes that were created that were evaluated within the setup for calculating the Heat Map. This number can be less than output for User Nodes, e.g., if blue marked Nodes exist that are only calculated once or have no connection.
- Total Nodes: This is the actual number of Nodes in the setup to be calculated. Here, only the Nodes used internally and invisible for the user are contained.
- Execution Time: Here the total time needed for the calculation of the entire setup is shown.
- Hottest Nodes
Here, Node and Groups are shown that carry the loin's share of the calculation load. As in the Nodes category, relative and absolute percentage values are shown, as well as the actual calculation time. - Hottest Conversions
In this category you will find the Nodes and their Ports at which the most intense data conversions have to be calculated. The proceeding percent values are absolute values for the complexity of the respective conversion calculations based on all conversions required in the setup.
Output Detailed Heat Map
The output of the Heat Map information in the Console can be even more detailed than described above . For this, press the Shift key when calling up the Print Heat Map command. The image below shows an example of what will be displayed.
You will notice in particular the comprehensive number of and display of information in the Nodes Deep category. Here, many otherwise invisible Nodes will be shown recognizable by the hidden (true) marking.
As an additional piece of information for each entry you will also see the output absNoConv, which shows the absolute calculation time without data conversion at the Ports. If the values for Abs% (first column in the list) and absNoConv are identical, no calculation time for data conversion for the respective Node will be used.
The Analysiscategory also offers additional information in detail mode:
- Variables: Here the number of variables that are used by the Noded within the setup is shown.
- Parallel Execution Time: The time span that could be calculated per threading and simultaneous data processing. If this time value is greater than the Execution Time value, numerous sections of the setup were processed simultaneously.
- Conversion Nodes Heat: Here the number of Nodes is output for which data formats are converted. A second numeric value shows the absolute portion of this conversion relative to the setup's overall calculation.
- Implicit Nodes Heat: These are Nodes that were generated automatically by the execution of the setup and work hidden from the user, e.g., to execute Array iterations or to read parameters.
All remaining outputs in the detail mode were already described in the section about the default mode here.