SpiderPig Posted July 19, 2023 Share Posted July 19, 2023 So, I've been thinking. I have about 10 different pine tree models in GLTF format. Different sizes and styles etc. They all use the same base textures, DIFFUSE and NORMAL maps. My question is if I load all 10 pine trees are 10 unique materials being created? One for each tree? Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted July 19, 2023 Solution Share Posted July 19, 2023 14 hours ago, SpiderPig said: So, I've been thinking. I have about 10 different pine tree models in GLTF format. Different sizes and styles etc. They all use the same base textures, DIFFUSE and NORMAL maps. My question is if I load all 10 pine trees are 10 unique materials being created? One for each tree? Yes, each material will be unique, but it doesn't really matter. Rendering is grouped by shader family. The material is just a small structure stored in memory. Each mesh stores an index to the material, and its looked up in the shader itself, so it really has no effect on the performance of the rendering code. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted July 19, 2023 Author Share Posted July 19, 2023 I was more curious about reaching the max material limit. But if we can change that to somthing big it may not matter. Quote Link to comment Share on other sites More sharing options...
Josh Posted July 19, 2023 Share Posted July 19, 2023 I think that buffer gets dynamically resized, so it doesn't even matter if you hit the initial limit. The texture arrays on the other hand are fixed size, because they are declared in the shaders. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted July 19, 2023 Author Share Posted July 19, 2023 Ah nice That's good to know, I've just been wondering how to structure files so they don't duplicate textures. Quote Link to comment Share on other sites More sharing options...
Josh Posted July 20, 2023 Share Posted July 20, 2023 If you have multiple materials referencing the same texture, it’s still just one texture Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted July 20, 2023 Author Share Posted July 20, 2023 I did have all of the tree objects separated into different folders based on size, so when I saved them through the asset editor it copied all the textures over to each folder. So in that case it would have double ups. I can solve it by moving everything that shares textures into the same folder but it just means I have 100+ files in one folder. I just like to organizes things so I can find files easily. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted July 20, 2023 Author Share Posted July 20, 2023 So in the asset editor when browsing for an existing material it will copy the material into the GLTF file and copy textures into the same directory as the GLTF. I wonder if browsing for an existing material should just store the file path to the material instead. I would like that better because if I want to change a material parameter for the pine tree, currently I'd have to do it for each model. I'd rather just change the material file itself once and have it work for everything that uses it. Would it be possible to make the GLTF file do this? Quote Link to comment Share on other sites More sharing options...
Josh Posted July 20, 2023 Share Posted July 20, 2023 glTF files do not store external materials. I could add the material path in the "extras" info but it would create a discontinuity where Ultra would be loading external materials, but every modeling application would be loading something different. I think this would cause more problems than it solves. glTF files CAN store textures in different paths, but in practice this is never done, and it would always be relative to the glTF file itself, not to the project. So you would end up with a lot of paths like "../../Nature/rock.dds" which I think would be prone to breakage. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted July 20, 2023 Author Share Posted July 20, 2023 Yeah I agree. Best to leave it as it is as it's fine in most cases. I'll work something out. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.