Update glossiness of material

Hi, I’m trying to update the glossiness of a material. I have the texture updating but not the glossiness

I’ve tried a few ways including the one below but have not got this to work. Does anybody know the correct way to do this?


// initialize code called once per entity
Load.prototype.initialize = function() {
    var self = this;
    var image = new Image();
    image.crossOrigin = "anonymous";
    image.onload = function () {
        var texture = new pc.Texture(self.app.graphicsDevice);

        var material = self.entity.model.material;
        material.diffuseMap = texture;
        pc.app.root.findByName("Vase_3").model.meshInstances[1].material = material;
        //pc.app.root.findByName("Vase_3").model.meshInstances[1].material.specular.setParameter("glossiness", 100);
        //pc.app.root.findByName("Vase_3").model.meshInstances[1].material.specular.glossiness = 100;
    image.src = myURL+myFolder+myImage;

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

How do you set Image’s url?.. I don’t see that in code.

Hi Mike, I’ve changed my code quite a bit now. Do you know the correct syntax to target the glossiness of a material?

I guess this params:


I’m new to this so maybe this is not the correct way of adjusting the glossiness but the below worked for me. Seems strange that you would use “shininess”.

someEntity = pc.app.root.findByName("Vase_3");
material = someEntity.model.meshInstances[1].material;
material.shininess = 100;
1 Like