Sample code: Compare two nodes

Sample code for a visual comparison of two sets of nodes.

In this sample, load two models to each node using loadSubtreeFromModel and compare two nodes with startComparison and endComparison.

Sample code: (369.7 KB)

Hi, I try your sample code, But there seems to be a problem with the white meshes, they are not changing the color:

Is this a bug? Or has some settings for this?

1 Like

Hey @namtrung921

First off, welcome to the forum, we’re glad to have you here! I believe the original code is from @rie, so she may be able to better help answer your question.

Hello @namtrung921, thanks for your reply.
In the sample. the similar color is used to the meshes. I tried with different colors, the meshes are colored with ComparisonConfig.sameColor. So it looks working as expected.

 var comparisonConfig = {
 only2Color: Communicator.Color.yellow(),

1 Like

Hi, thank you for your reply.
But I using comparisonConfig, but the white mesh still did not change when compared, The picture you took seems to be due to the reflection effect, so the inner cylinder is red (however you can see the edges of the white part):

I also tried 2 other scz files and the results were the same, the polylines and meshes (text) were white and didn’t change color when starting the comparison. (You change the background color to make it easier to see)

You can download 2 scz sample files here:

SCZ sample (383.8 KB)

Please help us try again. This is an important feature of our product.

Hello @namtrung921,
Thank you for sharing the details.
I have been able to reproduce the problem. Are you a partner? If yes, you can submit a issue in our support portal. But I will look into it a bit more.

Hi, @rie .
Yes, We are your partner. I will submit this issue to your support portal.

I found this topic and sample code, so I thought I’d put a question here everyone can read and discuss.

More information:

  • Yellow objects are similar to white objects.
  • Temporarily we change the color of all objects to gray (or any color except white and yellow…), then run the compare function. The results look better. However, color comparisons are ignored.

Also, I have a few more questions:

  • If possible, can you provide some more information about your compare function? (For example, we can get the list of NodeIds corresponding to the state add/remove / same… Is it ok? Or simply this compare function is implemented like overlaying 2 models on top of each other later, then using a custom shader to change the color during render?

Thank you!

1 Like


just to quickly answer your question regarding more info on the comparison function. It is indeed implemented as you described, basically rendering the two sets of nodes on top of each other with a blending function that ensures that differences are rendered in a specific color. It is not a geometry level comparison, so it won’t be able to return specific details on the nodes involved in the comparison.

Please let us know if you require more functionality in that regard. It is worth nothing that HOOPS Exchange does have various geometry level comparison functions you could leverage yourself if you are a HOOPS Web Platform partner.



Thank your confirm and your suggestion. We has a license HOOPS Exchange.

But it’s not very familiar to me. I have seen some APi to compare 2 models at BREP/FACEs Level in Hoops exchange. But it seems that it will need Exchange ID when exporting SCZ/SCZ to link the information together.
I will learn more and will probably need your support.
Regarding the above color issue, I will create a ticket on your support portal.
Thanks again!

1 Like

Just as an additional suggestion, there are obviously a few things you can do fairly trivially to determine “sameness” of entities in HC

  1. Ensure the node geometry shares the same mesh-id
  2. Check point/facelist size and bounding box of meshes to compare

Beyond that, it really depends on what you are trying to achieve.

1 Like

Thank you, I will pay attention to those issues when I start to learn Hoops Exchange.
However, I am currently trying to evaluate the compare 2 node function (2 model scz) with Hoops Communicator first.
I would like to ask for a few more ideas:

  • When loading 2 3D models, there seems to be some problem with the shader you are using to change the color of the meshes (I’m not sure, but it doesn’t seem to be Z-fighting phenomenon). You can see the images or test it with 2 scz models I converted from 2 versions of the *SLDASM file:

And result when compare:

SCZ Models for testing: (1.6 MB)

  • Is your converter when converting files using the same deviation value when converting a BREP data to triangle/Mesh data(tessellation) right? For example, will a small sphere and a large sphere be converted to mesh with the same or different number of triangles? I think this is a problem affecting the comparison result with HC right?

Thank you a lot!

I don’t think you can necessarily expect the same tessellation for objects of same topology but different sizes but as long as the underlying brep definition hasn’t changed I would expect the same tessellation to be applied. Keep in mind that in some cases the tessellation might come directly from the CAD system.

With regard to the blending issues, not sure what is going on there. It does not seem to be correct. I suggest you file a bug report in our support system.


Many thanks for your information.
I have already created a bug report in your support system a few days ago. I will update “blending issues” in that ticket.
Thanks again!

1 Like