AR doesn't work when I alter the main object

Good morning, I have an issue with using the AR functionality in Shapediver. I have an implementation on a website that allows the creation of a ring, and various characteristics of this ring can be altered. If I use the AR functionality on the standard shape without altering any characteristics, the AR works. However, if I alter any characteristic, the session for using augmented reality doesn’t start.
I don’t think there’s a problem with the design because when I use the “AR” button on the Shapediver website, everything works fine.
Here’s a link to a staging environment where I’m testing the issue: https://staging.broart.it/

If the problem does not happen when using the AR button in the ShapeDiver platform, then it must be linked to your implementation of the viewer API. Our team might be able to look into your example but I do not see an AR button in the link you provided, could you guide me to to it?

Good morning Mathieu,
we haven’t implemented a button yet, you simply need to click on the drawing to start the AR experience. As for the drawing, we use a customized texture that we load at runtime to modify the original diamond texture. Could this be causing the issue? Is the AR part implemented in Shapediver able to handle customized textures loaded client-side that are not already present in the default drawing?

Thank you for your help and have a nice day.

I just tested the app on my phone: my experience is that after changing a parameter, clicking on the drawing does not trigger the AR anymore. Is that the issue you are reporting? Could you debug it and report the console errors you got, if any?

Hello Mathieu, your message gave me some food for thought and I managed to fix the AR startup so that I can now see the various ring variants as well.
I have implemented a button at the bottom of the page named “Visualizza in realtà aumentata” to start the AR experience.
I just have one question.
When a user enters the page I linked to you, textures are applied to the model in the following way.

const material = new SDV.MaterialGemData({
    refractionIndex: 4.8,
    impurityMap: undefined,
    impurityScale: 0,
    colorTransferBegin: "#ffffff",
    colorTransferEnd: "#dee4ed",
    gamma: 1.3,
    contrast: 1.5,
    brightness: 0,
    dispersion: 0.003,
    tracingDepth: 2,
    tracingOpacity: 1,
    envMap: JSON.stringify(cubeMap)
});

let diamanti = session.getOutputById(paramMap.diamanti);
    // @ts-ignore
    diamanti.updateCallback = (
        newNode?: SDV.ITreeNode,
        oldNode?: SDV.ITreeNode
    ) => {
        if (newNode) {
            // we assign the material to the node
            assignGemMaterial(newNode, material);
            // and update to see the changes
            newNode.updateVersion();
            viewport.update();
        }
    };

    // we call this update callback once, to see our applied changes
    // @ts-ignore
    diamanti.updateCallback(diamanti.node);

These materials are used to make the diamonds on the ring look more realistic. However, when I use augmented reality, the materials are not present.
Would you happen to know why this behavior is occurring?

Thanks in advance.

Our viewer developer is currently out of the office but he will have a look at your question and answer it as soon as he is back. Thank you for your patience.

Thank you Mathieu, I’ll wait.

Hi Mathieu, any news?

My apologies for the delay, our viewer developer is back on monday and will be able to look at your issue then, thank you for your patience.

Hello @stefao,

when using AR we use the native AR applications of the device. As the GemMaterial uses a custom shader that only exists within our web viewer, there is no representation in the AR applications that can be used. Therefore, it is not possible to use the GemMaterial in AR.

We are sorry for the inconvenience.

Cheers, Michael

Thank you @MajorMeerkatThe3rd, is there a workaround to make the gems available in the AR experience maybe by not using the shader defined in GemMaterial but a standard component? Right now where there should be gems there are black holes that are not aesthetically pleasing.

Hello @stefao,

before going to AR, you could replace the GemMaterial with the Standard Material. Then at least the gem stones can be shown with standard rendering. As you already know how to switch to the gem material, the switch to the standard material should be relatively straightforward in that regard as the process is the same.

Cheers, Michael

I’ll give it a try and let you know, thanks and have a good day.