ITADN

Three.js r184 How does Three.js share node materials?

#33687Closedjellychen 创建于 2026-05-30
Help (please use the forum)
J
jellychencommented
### Description I have a scene with many meshes. Most of these meshes use the same TSL graph, but their uniform values are different. As I understand it, meshes with different uniform values should theoretically be able to share the same material. Is there a similar way to write this in Three.js? The geometries of my meshes are all different, so I cannot use the InstancedMesh approach. Based on my testing, if the uniform values are different, the current Three.js logic seems to rebuild the whole thing, which causes severe stuttering. ================== I tried adding customProgramCacheKey to the material and returning the same value for all of them. However, this caused the differences in the uniform values to be masked. I really don’t understand why this happens. I feel like this is a very common requirement, but I’m not sure whether there is currently any way to optimize this performance issue. ### Solution empty ### Alternatives empty ### Additional context empty
关闭于 2026-05-30 4 条评论