Max Material ID's on a Mesh?

I can’t find any documentation on this, but does anybody know the maximum amount of material ID’s on a mesh? I’m trying to get a ridiculously high resolution on a quad-sphere by dividing it into 96 ID’s.

Failing that, I want to actually cut the entire sphere into separate mesh pieces (Either 24 Pieces with 4 Mat ID’s Each, or 6 Pieces with 16 Mat ID’s Each) to enable chunks of the sphere to be occluded when they’re not on the screen, thus saving VRAM (In theory anyway).

The problem is when my surface uses a metallic material, the reflections break and show seams, I’m guessing because the reflection map uses the first UV channel?

I don’t think there is a limit on how many material IDs you can import with your mesh as I’ve just did so with a mesh with 40ish with no issue. Is this a recommended workflow? probably not because you’ll not have an asset that has a draw call of 96 material shaders. Not to mention anything within those shaders that adds to it.

By having the one mesh you’re now no able to occlude any part of it. If there are materials that are not on screen they will be rendered regardless. By using your second method and breaking up the mesh you’ll end up with a more stream lined way of handling culling and making sure you’re not getting extra draw calls that will add to your performance hit even though they are not on screen.

Thank you James for asking this, and Tim for answering! :slight_smile:

I was planning to ask a similar question once I have an upcoming model closer to completion, I don’t need quite as many MatID’s as you do (mine will most likely be in the 15-20 range), but I was unsure about whether there was a limit to how many can be used, so this has alleviated those concerns! I know it will not be good for performance, but I have plans on how to keep this from being an issue.

It is hard to get used to an engine where things are not limited like they have always been in the past (polycount as well for example), of course I am not complaining, not having hard limits in place is something I can & will to get used to eventually! Thanks again. :smiley:

Cheers Tim, I figured that would be the best approach. Does the occlusion automatically remove draw calls for things that aren’t in view and also free up that texture memory as well? Essentially what I’m doing is making a planet Earth that you’ll orbit in close proximity, and the material is insanely complex as it is as you can see here.

In order to attach all the pieces and have it spin as I need to, I’ll break the mesh up and attach the chunks together in a blueprint, but all of their Origins will be in the centre of the sphere. Will that affect the Occlusion in anyway? I’m worried that if the Pivot point of each object is within the frame, they’ll all be sent to the GPU anyway. Moving those pivot points might case small seams or gaps to appear. I’m not sure if the pivot point adds to an objects bounds even if it’s outside the bounding box of a mesh itself, could you clarify that or will I just have to test and see how I get on?

My next issue is the vertex normals at the seams of the mesh, but I think I can get around that by using Normal Thief in 3DS Max.

Also, do you know if reflections are automatically applied to a surface via the first UV channel? If I assign a metallic material to part of chunks, the seam suddenly behaves as if there is no smoothing at the edges, I suspect due to the reflection.

Lol wow that’s a lot of id’s

Out of curiosity whats the plan as to why you need so many?

Have you considered using layered materials instead?

Only need one material ID, a single draw call, and the result will still be equal to or better than what you can achieve by using multiple id’s

As said above, it’s because I’m going for such a high resolution on the Earth sphere (picture the film Gravity but in real-time), and I’m also using too many texture samplers in one chunk to use a masked material.

We have some new documentation that is going live and in it is the limit for the FBX material IDs. The limit is 64.