2

I am learning Reality Composer Pro, and am trying to implement a test GeometryModifier.
I have a 3D model that I can display in the Vision Pro simulator.

To modify its geometry, I have set up a Shader Graph that should do the following.
From the model position, I separate the z position. If it is greater that a middle value of the models z values, I add an offset. The x and y offsets are set to 0. The 3 values are combined and used as the model position offset, so that the upper half of the object should be lifted.
But the displayed object is not modified, neither in the Reality Composer Pro 3D display, nor in the Vision Pro simulator.
I verified that the Ifgreater node has the correct threshold, and the custom material is assigned to the object.

How can I debug what goes wrong?

Here is my Shader Graph:
enter image description here

EDIT:

I still do not know if it is possible to debug a shader graph, but my specific problem was solved by adding additionally a properly set up MaterialXPreviewSurface to the Custom Surface input of the Outputs node.
Apparently an open input does not allow rendering.

Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116

1 Answers1

0

The shader graph is a function that depends on some parameters, e.g. the world position, and has outputs, e.g. the model position offset of the GeometryModifier. Debugging consists of checking whether this function produces correct output for various inputs, and to find bugs if not.

Most of the shader graph nodes are very simple. It is thus easy to manually translate the shader graph to a Swift function. This function could then be imported, e.g. as part of a helper class in Xcode. This Swift function can then be debugged as usual, and even better, one can write a unit test for it.

The problem of course is to keep the shader graph in sync with the Swift function. Since this has currently to be done manually, it is error-prone. It would be great, if the Reality Composer Pro had the ability to output such a Swift function.

Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116