# Model lightmap not changing

**URL:** <https://forum.playcanvas.com/t/model-lightmap-not-changing/32139>\
**Category:** Help & Support\
**Created:** [July 12, 2023, 10:42am UTC](https://forum.playcanvas.com/t/model-lightmap-not-changing/32139 "2023-07-12T10:42:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ateeque](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/ateeque/32/27497_2.png) [@ateeque](https://forum.playcanvas.com/u/ateeque)\
**Post date:** [July 12, 2023, 10:42am UTC](https://forum.playcanvas.com/t/model-lightmap-not-changing/32139/1 "2023-07-12T10:42:19Z")

</div>

hi, I want to change the model from html buttons here is my code  
HtmlHandler.attributes.add(‘a’, {  
type: ‘asset’,  
assetType: ‘render’  
});

HtmlHandler.attributes.add(‘b’, {  
type: ‘asset’,  
assetType: ‘render’  
});

HtmlHandler.attributes.add(‘c’, {  
type: ‘asset’,  
assetType: ‘render’  
});

var buttons = document.querySelectorAll(‘.v1’);  
// if found

```
 buttons.forEach(function (button, i) {
    button.addEventListener('click', function (e) {
        var obj = pc.app.root.findByName('box');
        
        if (obj && obj.render) {
    
            obj.render.asset = self.a;
            
        }
        
    });
});

```

it is change the model once time manual what should i do plz help?

---

<div class="post-metadata">

**Author:** ![Leonidas](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/leonidas/32/6495_2.png) [@Leonidas](https://forum.playcanvas.com/u/Leonidas)\
**Post date:** [July 12, 2023, 11:22am UTC](https://forum.playcanvas.com/t/model-lightmap-not-changing/32139/2 "2023-07-12T11:22:19Z")

</div>

Hi @ateeque,

What do you mean it is change once time manual? Can you elaborate?

---

<div class="post-metadata">

**Author:** ![ateeque](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/ateeque/32/27497_2.png) [@ateeque](https://forum.playcanvas.com/u/ateeque)\
**Post date:** [July 12, 2023, 12:21pm UTC](https://forum.playcanvas.com/t/model-lightmap-not-changing/32139/3 "2023-07-12T12:21:53Z")

</div>

when i click the button it was changing the model once because I didnt use the loop so that problem was that is solved now the remaining issue is that

i am creating a vinity configurator and for UI i am using html&css  
i have three types of shelf model and each have different matrial like lightmap etc  
when i change the model it is changing but how can i change the the model lightmap here is video.

[//forum-files-playcanvas-com.s3.dualstack.eu-west-1.amazonaws.com/original/3X/f/2/f209e87ce5d55646112f201d6478b36829265780.mp4](https://forum-files-playcanvas-com.s3.dualstack.eu-west-1.amazonaws.com/original/3X/f/2/f209e87ce5d55646112f201d6478b36829265780.mp4)

---

<div class="post-metadata">

**Author:** ![Leonidas](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/leonidas/32/6495_2.png) [@Leonidas](https://forum.playcanvas.com/u/Leonidas)\
**Post date:** [July 12, 2023, 12:55pm UTC](https://forum.playcanvas.com/t/model-lightmap-not-changing/32139/4 "2023-07-12T12:55:03Z")

</div>

If you are using PlayCanvas runtime lightmaps, you need to regenerate them. There are several topics around the forum, do a quick search, for example:

> [@Issues with lightmapper and dynamic lighting](https://forum.playcanvas.com/t/issues-with-lightmapper-and-dynamic-lighting/21146):
>
> Hi everyone! Here’s the issue: I have a scene with mostly light-mapped objects. When I’m switching parts of the scene on and off I call app.lightmapper.bake(); to update lightmaps. When I do this, non-lightmapped models dissappear from the scene (with their shadows still rendering correctly into lightmaps). The light is set to both “Affect Dynamic” and “Affect Lightmapped” and initially, the scene renders correctly. Here’s a simple projects to demonstrate the issue: [https://playcanvas.c…](https://playcanvas.com/project/813889/overview)
