Light problem in Viewer / Solved: use `DefaultViewerParams`

Hello!

I’m loading my model using Speckle Viewer in React. The only issue I’m facing is with the lighting settings. The model is always lit from only one side, while the rest of the sides appear completely black.
Can you advise me on how to solve this and make all sides of the model visible?

image
image

Thank you in advance for your answers!

2 Likes

Hi there!

I had the same exact problem in the PowerBI visual for a while… turns out the best way to initialise the viewer is to start from the DefaultViewerParams (you can import them from the viewer package).

You can then modify any of the parameters as needed and pass that in to the viewer constructor.

That should get this issue fixed! i.e.

4 Likes

Hey @Gircsi117, do let us know if that sorted things out! Only poking in here to say that, if your react app is an SPA, do take care with viewer initialisation on route changes - it can lead to multiple viewer instances in the same spot (you ideally should have only one that you reuse) - visually, I remember similar looking “viewers” when I was hacking at the frontend :sweat_smile:

2 Likes

Hi @Gircsi117

What you seem to be experiencing is the viewer’s default HDRI not getting loaded properly. Alan’s answer is a good starting point for trying to figure out what’s going on. Also, check the console for errors regarding asset loading.

If things are still off, let us know and we’ll get to the bottom of it

2 Likes

Thank you everyone for the help!
We managed to solve the problem using the suggested methods.

2 Likes

Which one did the trick? Curious so we can help future hackers that stumble upon this discussion :slight_smile:

1 Like

The first one successfully solved the problem, but I tried all the ones you mentioned.

2 Likes