How to change materials of heart at runtime?
With the model loaded by this script, I can get the material using the following method, but I can’t change it at present

Is there any good method or case for reference?
How to change materials of heart at runtime?
What you have done is correct, you will just need to change the material on the meshInstance via https://developer.playcanvas.com/api/pc.MeshInstance.html#material
Can you possible a project that shows the issue please?
The issue is that you didn’t parse the loadGlb script for the new color attribute so this.color
is null
After parsing, it works as expected
okay,I know what the problem is. thx
You can rename any Entity via https://developer.playcanvas.com/api/pc.Entity.html#name
Does the loaded glb have a callback?I want to use ‘ready’ during initialization, but it doesn’t seem to work
I want to konw when this glb loaded
That commented code should work. Can you please post a new project with the issue?
A post was merged into an existing topic: Is there any way to get the callback loaded from a glb?
We made two glb files, the “test1.glb” is the original without compress, and “test1-basis.glb” was compressed basis. Used “https://gltf-transform.donmccurdy.com/” this command line tool.
Pic1, is the test1.glb, the original quality.
Pic2, is the “test1-basis.glb”, the quality is pretty low(I have imported the basis lib):
I know the basis compress will reduce the quality, but we have no more choice by the command line tool, it doesn’t have more option choice.
But it’s very stranges, When I use the playcanvas modelviewer to open the test1-basis.glb, the materials are better(When stop rotating the model), looks like the modelviewer can optimize the basis compressed texture quality.
@yaustar I have added you as a team member to edit the following project, Please check it, thanks
https://playcanvas.com/project/1020626/overview/loading-draco-compressed-glbs1
The model viewer has a multi sampler rendering shader that smooths out jagged rendering lines/edges as you can see in your preview.
The Model Viewer is open source: GitHub - playcanvas/model-viewer: 3D model viewer supporting glTF 2.0 and PLY (3d Gaussian Splats) and you can read more about the recent release here: glTF Viewer Arrives on Mobile with AR Support | PlayCanvas Blog
I made an Editor version here (might be slightly outdated now): https://playcanvas.com/project/910157/overview/multiframe-model-viewer
And I’ve quickly added it to a fork or your project here: <
https://playcanvas.com/project/1023639/overview/f-loading-draco-compressed-glbs
However, I would recommend compressing the textures using UASTC compression with Basis instead as that gives a higher quality texture.
Thanks,it works.