# How to use needs update property with MTL Loader

**URL:** <https://discourse.threejs.org/t/how-to-use-needs-update-property-with-mtl-loader/26974>\
**Category:** Questions\
**Tags:** loaders, mtl-loader, materials\
**Created:** [June 5, 2021, 8:00pm UTC](https://discourse.threejs.org/t/how-to-use-needs-update-property-with-mtl-loader/26974 "2021-06-05T20:00:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IMR](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/imr/32/18743_2.png) [@IMR](https://discourse.threejs.org/u/IMR)\
**Post date:** [June 5, 2021, 8:00pm UTC](https://discourse.threejs.org/t/how-to-use-needs-update-property-with-mtl-loader/26974/1 "2021-06-05T20:00:23Z")

</div>

Hello,  
Is there a way to clear the catch images by MTL loader? As when I dynamically update the material (as well as obj) file having the same image names (in MTL), and after removing and re-adding the mesh, it’s texture map gets destroyed. Attached below:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/4/1/41280d5fa2734880d1a27835f43b51ad13ca8f24.jpeg)

But when I refresh the page everything comes to perfect position.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/d/c/dceb8396b9084dd34c136e0e2d50207a1ac582d0.jpeg)

As with the texture we have `needsUpdate` is there such alternative for the MTL Material?  
thank you in advance.

so far I have done:

```javascript

mtlLoader.load("file://" + mtl_file, function(materials) {

	//materials.needsUpdate = true; //error
					
       materials.preload();
				    
	var update_material = Object.keys(materials.materials);
				   
	for(var i=0; i < update_material.length; i++){
		materials.materials[update_material[i]].needsUpdate = true;
	}

	materials.options.needsUpdate = true;

       contd...

```

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [June 5, 2021, 9:12pm UTC](https://discourse.threejs.org/t/how-to-use-needs-update-property-with-mtl-loader/26974/2 "2021-06-05T21:12:57Z")

</div>

I’m not sure your shared code snippet make sense. There is no point to set `needsUpdate` to `true` unless certain properties are changed.

> [@IMR](#):
>
> Is there a way to clear the catch images by MTL loader?

Do you mind explaining in more detail what you mean by that? I’m afraid your problem is not yet clear.

---

<div class="post-metadata">

**Author:** ![IMR](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/imr/32/18743_2.png) [@IMR](https://discourse.threejs.org/u/IMR)\
**Post date:** [June 5, 2021, 9:31pm UTC](https://discourse.threejs.org/t/how-to-use-needs-update-property-with-mtl-loader/26974/3 "2021-06-05T21:31:01Z")

</div>

@Mugen87 Thank you for the response.  
Actually I have the MTL file along with the respective Images. When i initially open that file (in the same session) everything is perfect. While the session is still on the file gets modified both mtl and obj. So i remove the mesh from the scene. and re-add those in order to load up the new updated files. But there are existing images which are being catch by the browser. In order to update those I have to reload the entire page. Is there a way it can be done without reloading the entire page?
