How to Modify Arbitrary Number of 3D Tiles Components with Custom Selection Criteria?

While working with 3D Tiles data, through studying the “Visualize Mesh Features and Metadata” section, I’ve learned to combine metadata with Unreal Engine’s LineTrace to modify specific properties. However, I’m currently facing some challenges. I want to perform bulk selection of specific components based on the value of a custom ID in the properties, and modify the materials of these selected parts. The main issue is that Material Parameter Collections (MPC) have a 1024 instance limit, and my large-scale selections might exceed this constraint. Could you suggest any solutions to address this problem?

Has your problem been solved? I also want to dynamically send the ID of the model component (Revit model element ID) to Cesium for Unreal through the API interface. After receiving the ID, I will select the corresponding component in the scene or change its material based on this ID value. I have also encountered challenges at this step. The official example provides a range of component attribute values, but this is not what I want. The ID I provide is pushed through the API interface, and I don’t know in advance which IDs there are. In addition, as you mentioned, there is also a limitation problem: “Material Parameter Collections (MPC) have a 1024 instance limit.” Indeed, the number of components I need to select may far exceed this number.

Hi @hjq320 and @cqliao,
The usual way to pass larger sets of data to a material is via textures.

Yes, textures can be passed through. However, I noticed that when using Unreal Engine"s dynamic materials, it triggers the issue described here: cesium for unreal 3dtiles dynamicmaterial . May I ask if there"s a way to pass textures without modifying UE5"s source code?

The bug described in that thread should only be an issue when creating a dynamic material instance at runtime. You should be able to create a material instance in the Editor for this purpose, and then, if necessary, set the texture parameter at runtime.

How can I modify a Material Instance’s texture at runtime without creating a Material Instance Dynamic in Blueprints? I can’t find any relevant methods to edit textures without generating a Material Instance Dynamic.

Hmm I wouldn’t expect it to be any different, really. Which functions would you use on the Material Instance Dynamic?

I want to pass texture information to the material at runtime, but the ‘Set Texture Parameter Value’ node I found in Blueprints is based on a Material Instance Dynamic (MID).

Ok, I understand now. I can think of two options:

Constant Texture, Dynamic Contents

Set a constant texture (or perhaps render target) at Editor time on a Material Instance (non-Dynamic). Because you only need to update the content of the texture at runtime, not actually change which texture is referenced, right?

Truly Dynamic Texture

Internally, Cesium for Unreal creates a UMaterialInstanceDynamic for each primitive of each tile. So if you really need to be able to set the texture parameter at runtime, you’ll just need to set it on all of the UMaterialInstanceDynamic instances that Cesium creates.

  1. Querying the Cesium3DTileset for its UStaticMeshComponent instances.
  2. Get each of their StaticMesh property (GetStaticMesh() in C++).
  3. Get the materials of the static mesh by calling GetMaterial.
  4. Cast each returned UMaterialInstance to a UMaterialInstanceDynamic.
  5. Call SetTextureParameterValue.

The tricky part of this is that UStaticMeshComponents get created and destroyed dynamically as tiles are loaded and unloaded. So you will need to repeat the above every frame.

Thanks for your help!I will have a try