Jump to content

Material's in GLTF files


SpiderPig
 Share

Go to solution Solved by Josh,

Recommended Posts

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?

Link to comment
Share on other sites

  • Solution
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.

  • Thanks 1

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

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.

  • Thanks 1

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

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

  • Thanks 1

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...