can i use dynamicMaterial on 3dtiles ,i do it,but it can not render properly
Can you tell us more about what you’re doing? You can certainly specify a custom material on a Cesium3DTileset at Editor time. Setting the Material property at runtime should work, too, though it will force a full reload of the Cesium3DTileset.
It is normal to use custom material,but I want to change it’s opacity at runtime,so if i use dynamicMaterial, it can’t render properly,It looks gray like picture 1
I suspect the problem isn’t that it’s a dynamic material, but that there’s something wrong with the material itself. You should copy MI_CesiumThreeOverlaysAndClipping
and then modify it, rather than creating a new material from scratch. There is a lot going on in that material, and much if it is necessary in order for textures, for example, to work correctly.
If that advice doesn’t help, we’ll probably need to see how you’ve set up your material in order to help further.
Actually, I did it as you said. I copied the material MI_CesiumThreeOverlaysAndClipping,it rendered normally, but when I created a dynamic material based on it ,setting it to dynamic material at runtime resulted in rendering errors,The material called ‘MI_Custom’ in picture 2 was copied from material MI_CesiumThreeOverlaysAndClipping
Can you please walk us step-by-step through the process you followed, so that we can reproduce it ourselves?
The first step is to add a 3dtiles in the level. The second step is to create a dynamic material based on material MI_CesiumThreeOverlaysAndClipping at runtime. The third step is to call the SetMaterial interface of 3dtiles and assign the dynamicmaterial created in the second step to 3dtiles. Then 3dtiles turn gray and the rendering is incorrect。 I just want to change 3dtiles opacity at runtime.
Thanks @peijw, I can reproduce this, and I wrote an issue for it:
The issue describes a possible modification to the Cesium for Unreal code that will make it work, if you’re up for it, but I haven’t tried it myself.
Alternatively, you might consider using a Material Parameter Collection rather than a dynamic material to enable you to set the opacity at runtime.
Thank you for your answer. I will try it out