No announcement yet.

Hide Material Element / Slot / Subset

  • Filter
  • Time
  • Show
Clear All
new posts

    Hide Material Element / Slot / Subset

    I've been searching all over for an answer to this question, and have found several attempts at the question, but with no solution other than using transparency.

    I have a mesh (static/skeletal) that has multiple material elements. I simply want to stop rendering one or more of those material elements at run-time, via a blueprint. I know there are methods to make material elements transparent, but this would not be ideal for a case where many characters are wearing several parts of clothing and hiding 3-10 subsets of each outfit on each character. If the engine still needs to execute a draw call, this would get expensive very quickly.

    This seems like a really simple action - to turn off a material element. Surely there is a way to do this? As far as I am aware, the engine must execute a specific draw call for every single material element (unless it optimizes when they share materials), so it would be as simple as not executing that draw call when the state is toggled.

    If this is not possible, how do robust games hide parts of characters when those parts are covered by clothing or get cut off?

    I am very new to Unreal, but have experience with raw C++ game developed. I created a custom game engine that used this effect for hiding parts under clothing. So I'm wondering how other devs are accomplishing this in games if this action is not available?

    Thanks for any advice!

    Instead of including all of the parts in one mesh, you would need them to be separate objects that are attached together, then you just remove that object entirely.
    For example, the head of a character is a completely separate object than the body.


      Okay, I see. Unfortunately, the characters I intended to use have a great deal of material elements. The skin mesh is split at the ankle, knees, thighs, waist, chest, shoulders, elbows, forearms, wrist, neck, and head. I may want to rethink this if I have to connect all of these parts as separate objects for every character. In my previous engine, the parts were all combined and rendered together as a single draw call whenever possible. But I doubt this will ever be possible if they are disconnected entirely into separate objects.

      Does anyone know how difficult it would be to intercept the actual rendering calls for skin meshes and skip rendering certain material elements? Like I said, I'm very new to Unreal, so I don't know much at all about mixing C++ with blueprints. Would something like this be possible? And if so, how difficult would it be? I am not yet looking for the solution - just knowing it can be done reasonably is enough for now. If not, I need to rethink my character setup. Probably condense it down into modern sections (shoes, pants, shirt, gloves, head).



        You can't do that in a single draw call, each separate material adds another draw call


          In my custom engine, I rendered everything that existed in the vertex buffer together. And I tried to group vertices based on their connected polys. So the hands would be next to the forearms in the vertex buffer, for example. Then if clothing covered the forearms, the hands would be rendered in a separate draw call. If the forearms were not covered, the vertex buffer region would be expanded to include both the hands and forearms so they can both be rendered in a single call.

          If something like this is not possible inside of Unreal (C++ or blueprints), how big of a performance hit will it be to have around 22 separate skin mesh parts/renders per characters? Obviously, they will be small sections, like a hand or a forearm. But one of the issues I ran into inside of my engine was having to upload ALL of the bones for every render. I eventually managed to set it up so that the bones were all uploaded to the shader on the first render and were kept intact until the character skin and clothing were all fully rendered. Any idea how Unreal will handle this?

          The reason I'm asking is because I'm at the point where I'm setting up my character components, and I want to figure out how many areas to use. Fewer will obviously be better for performance and worse for flexibility. And I know how much flexibility I will lose as I remove section splits. I'm just wondering how much performance I will lose as I add them.

          Thanks again for your help!


            You can use "Show Material Section" function on Skeletal Meshes:


            However as far as i am aware there is no such functionality for Static Meshes, sadly.