RhinoCompute meshcolor

We are facing an issue with displaying mesh color on our 3D model in the browser when running the Appserver. While the color is visible in Rhino software, it does not appear in the browser. In Image 1, you can see that the color is visible in Rhino. When creating a new custom file, the model and parameters are visible in the browser, but the color does not appear on the model. I’ve attached the .gh file for reference and also updated the definition.hbs file code to handle the mesh color. Can you help us identify the error? Should we modify the .gh file, the definition file code, or both?

definition.zip (3.8 KB)

CUBE TEST FOR WEB.gh (6.8 KB)

How are you viewing/running the definition on AppServer? Which endpoint are you using? I don’t believe using the /view endpoint will give you a material that exposes mesh vertex colors.

Yes, I am using a local server to view this model. I am using the default endpoint provided in the github repo “GitHub - mcneel/compute.rhino3d: REST geometry server based on RhinoCommon and headless Rhino”. Are you confirming that the GH file is correct?

The definition is not correct. Check the script component before the output:


So vertex coordinates are not being passed to the output. Change this to true.

I had to restart both rhino.compute and appserver and also cleared the cache/history in the browser. I did not have to change any code in definition.hbs or any other place.

Thank you. You were right. Now it’s working. I need to ask one more thing. Is it compulsory to use a C# script in Grasshopper script? Can we use context bake instead of a C# mesh to base64 Draco? How can I display reflection and texture on the model?

You can definitely use the context bake. We use the draco compression and base64 to optimize the data transfer, but if this is not a concern for you, you can just use the Context Bake.

Yes, it’s working. What about the reflection and texture?


gh_pillar 59_project_rhino compute potential test script.gh (38.4 KB)

I need assistance with opening a Grasshopper file with the definition.hbs code. The model is opening in the browser, but I’m not getting the exact reflection and texture. How can I achieve that? Please reply fast as this is important.

Please review the definition in this example: rhino-developer-samples/compute/js/SampleGHDocMaterialTexture at 8 · mcneel/rhino-developer-samples · GitHub

In summary, the definition should create and serialize a 3dm document that includes the geometry and material references.