[SOLVED] Change in material look when running locally


We decided to migrate from hosting directly on playcanvas to github using the playcanvas engine. Everything went fine except of one thing: the materials have a strange glossy / metal-ish look now.

New github version: https://meh-design.github.io/dungeons-and-dragging
Old playcanvas-hosted version: https://launch.playcanvas.com/542223

You might have to zoom out a little in the beginning to get a good view.

I looked for differences at the lighting / material and found nothing. We downloaded the material directly from the playcanvas editor and didn’t make any changes.
My best guess is that the problem is with the light. We created it with the following code:

const light = new pc.Entity('light');
light.addComponent('light', {
  color: new pc.Color(1, 1, 1)
light.setEulerAngles(45, 0, 0);

Thanks in advance!

It’s rather hard to tell since they’re not like for like applications. Can you publish two apps that render just a single box that demonstrates the problem? Then, I can check in WebGL Inspector to see exactly what the differences are.


I have made two apps as you requested.

Playcanvas-published: https://launch.playcanvas.com/546365 (code in assets/script.js)
Engine only: https://bminixhofer.github.io/material-demo/ (code in a script tag in the html)

The only difference is that the asset is requested in different ways (loadFromUrl in engine-only, assets.find in the other one).

I’m pretty sure the problem is with the ambient light. I think the editor has some default values for the ambient light that the engine has not. Could that be correct? And if so, is there some way to easily set the ambient lights to be equal?

Gamma correction is enabled in your Editor scene:

But you haven’t enabled gamma correction in your hand-coded scene:

You’ll notice there’s still a difference. You have a black ambient light in your hand-coded scene but non-black set in the Editor:

Let’s raise it to what you have in the Editor scene:

Et voilà!

Thanks a lot!

IIRC, i didn’t change any settings in the editor.
Is there some place where I can look up the difference in default settings between editor and hand-coded and would you consider making the default settings equal for both editor and hand-coded?

Again, thanks for your quick and high-quality answer :slight_smile: