Light setup for a glossiness

Hey!
I am currently trying to make a scene with lights that render my object well.

So when there is a glossiness it’s perfect, the place I want shines :

but the problem is when there is no glossiness, we see the reflection of the light on my object.

Do you have an idea of how I could setup these lights so that I no longer have this effect?

Thanks

Are you using spotlight/point lights/omin lights?

Yes i’m using point light!

This is a material setting, not a light setting.
It seems to me that in the first screenshot you set it up the way you like … keep using it instead of your set up 2?

Yep! But sometimes i dont have glosiness for my object , so it’s a problem!

Do you mean you don’t have glossiness texture? Maybe you can use glossiness slider in that case.

To explain, basically in my project I have an object and I allow users to upload textures on it (mandatory) and glosiness if they want.
So the texture is mandatory but not the glossiness, so I would like it to look good if there is no glossiness. But I want to keep that glowing effect when there is one.
I don’t know if it’s clear ?

Does the suggestion of setting the glossiness to zero / really small value does not help here in the case the user does not attach the glossiness texture?

I tried but the problem is that I want a shiny effect on an object when there is glossiness, and if I put it close to zero there is none.

Can you drop the glossiness value to zero if there is no glossiness texture, otherwise set it to one?

Yes it’s a good idea ,but i don’t know how to do this in code.

something like

if (hasSpecularTexture) {
    material.shininess = 90;
} else {
    material.shininess = 0;
}
material.update;

Hmm I don’t see how to do the script, like this ?

var Texture = pc.createScript('texture');

// initialize code called once per entity
Texture.prototype.initialize = function () {

    
    if (hasSpecularTexture) {
        material.shininess = 90;
    } else {
        material.shininess = 0;
    }
    material.update();
};

// update code called every frame
Texture.prototype.update = function (dt) {

};

Ok , I understood I have to assign the material glossiness to hasSpecularTexture, but how do I find parameter?

Can you give an example project of the original issue to work from please? That will help with giving a more complete answer

Off course !

there is the project : PlayCanvas 3D HTML5 Game Engine

On the editor I do my tests with github online.

I download my 2 diffuses from github. the scripts are : load-verso and load-recto.

Then I download the 2 glossiness; it’s the load-verso-gloss and load-recto-gloss scripts.

Then I have the two scripts shininess and shininess1 which must check if there is a gloss, if so we set the shininess to 80 otherwise to 0. but those don’t work

Like i don’t understand why the console.log can’t read .glossMap

   var material = this.entity.render.meshInstances[0].material.glossMap.name;

    console.log(material);

It works for others key like id ect… but not for gloosMap for some reason.

The key exist :

Can you create a fork of the project without any code to show the original issue in the first post please?

I think it will help starting from a clean state rather than a project that you are actively working on

Yep there is the project without code. On side with glossiness texture and one without. PlayCanvas | HTML5 Game Engine

Actually I just want to understand how I can focus the glosiness entity.
So i can do :
If there is a texture on the glossiness then I set the shininess to 80 otherwise I set it to 0.

But I can’t find how to get these values which must be null when there is nothing and full when there is a texture on it.