Issue with the render of my model in production

Im working on a 3d product configurator. My model is compose of several simple parts that i made with threejs primitive.


It is link to a form which allow to change the model ( adjust length, height even add/remove some optional part).
My only dependencies are threejs and vite. My configurator work fine on my localhost. Yet i have some issue with my build. In production I can edit my product dimension but when I try to add or remove a part with my form, i have rendering issue.

I have make several try to resolve the issue, checking the scene object in the console to verify if the piece are in the rght place, check that if i remove the if else condition the part load fine …
Yet I was not able to resolve this.
I also have this warning inside my console which I was not able to solve until now:
WebGL warning: uniform setter: UniformLocation is not from the current active Program. 3
After reporting 32, no further warnings will be reported for this WebGL context.

Welcome to this forum.

Please try to provide a minimum working live code demonstrating your issue on https://codepen.io or similar.

2 Likes

Im not really use to make npm package running on code pen so it took me some time but there it is: https://codepen.io/Fordreas/pen/RNNzpaz
In this sample from my code select option Largeur, Longueur and Hauteur work fine but if the try to select the option “Sans” on “Entourage” it break as it deed on my production server

  1. Your application appears to be loading different versions of threejs at the same time.

  2. The change listener on the fields is calling “main” each time with the different parameters, which is recreating the renderer on every parameter change.
    The previous renderer is never disposed however, so its render loop will still be running.

fixes:

I added an “importmap” to your html to properly set up the paths to threejs, so that different versions aren’t loaded.

I changed the code to only create one rendererer at init time.
I separated your renderer creation out into a separate method that gets called once at init time…

“main” now just recreates the hall object after disposing/removing the previous one.

https://codepen.io/manthrax/pen/oggrobe

@Benj

(i also changed your BasicMaterials to StandardMaterial so they are lit better with your lights. )

2 Likes

Thank, i Have implement your suggestion on my main project and it resolves the issue for the rendering and the warning in both localhost and production.

1 Like