Download

Physical Material Masks?

So I’m trying to add multiple physical materials to a single mesh, using a single material and an (of course) Physical Material Mask asset. Unfortunately, the only documentation I could find about this was from UDK (UDK | PhysicalMaterialMask)- which says to use 1 bit bmp’s. Okay. So, I created one, tried to import it, but apparently it’s an unsupported file type. ([FONT=Courier New]LogImageWrapper: Error: BMP uses an unsupported format (1/1) Error: Texture import failed) The mask asset itself isn’t really specific about what kind of texture it takes for the mask texture, save that it takes… something, and that none are available within my project (or the slot is just disabled altogether, I can’t tell).

Then I come across a post about how there’s now 8 slots for physical materials in each material now (How to add multiple physics materials to static mesh which uses a single material - #3 by MostHost_LA - Content Creation - Unreal Engine Forums), but in engine (as opposed to the docs) they’re just labeled ‘0-7’ with no explanation about how to set them up to work properly. I would guess it requires the use of the Physical Material Mask asset and its embedded mask texture somehow, but I’ll be damned if I can figure out how to get it to work.

SO!- my question is this, am I just chasing this thing down a rabbit hole?- leading nowhere?- like are these assets and slots deprecated and just haven’t been removed yet, or do they exist for some reason, and if so could someone be so kind as to explain those reasons to me, because I’ve been googling, and so far my google-fu hasn’t been good enough lick this one yet.

1 Like
  1. Create a mask texture with no more than eight colors. The colors must be the 8 colors listed in the material editor (and also PhysicalMaterialMask.cpp): red, green, blue, cyan, magenta, yellow, white, and black. I was able to do this by creating an RGB (no alpha) PNG in Blender.

  2. Create a Physical Material Mask asset in the Content Browser. Then, right click on the asset and select Import Mask Texture. Choose the PNG you created in step 1.

  3. Open a Material (normal material, not physical material) in the Material Editor. Assign the Physical Material Mask asset to it, and then select a Physical Material asset for each of the colors used in your mask texture.

  1. Open the static mesh asset you’d like to use and enable Support Physical Material Masks.

Support Physical Material Masks.PNG

  1. Assign the material to the static mesh.

  2. Put the mesh into a level.

  3. In the console, run: ShowFlag.PhysicalMaterialMasks 1. You can also enable this from the viewports Show menu with Show > Advanced > Physical Material Masks. At this point, selected actors will display the physical material mask, if they have one.

  4. Select the asset you added in step (6) in the 3D viewport and confirm the physical material mask appears.

Once you’ve done all this, you can get the physical material from collision hit results, though this currently only works if Chaos physics is enabled.

3 Likes

Hey there!
Is there a way to apply unique mask for material instances? Duplicating master materials for each mesh with unique mask seem a bit off

Not that I know of. It’s a new feature, so my best guess is it simply hasn’t been implemented in material instances yet, but I don’t know that for sure.

1 Like

Hi Doug.

Would you happen to know how the Landscape Physical Material Output works as an alternative to Physical Material Mask?
See my question for context:
https://answers.unrealengine.com/questions/1027003/how-do-you-use-the-landscape-physical-material-out.html

Landscapes don’t appear to have a ‘Support Physical Material Masks’ option so I’m not sure if your solution applies to terrains.

Even if it does, the Physical_Material_Mask imports the mask separately from the landscape material’s use of the same mask. I’m not confident that the two separate uses of a puddle mask will align correctly between the rendering (visual) and the LineTrace hits (audio).

I suspect Physical_Material_Mask is not the way to go for my objective, which is why I’m looking for more info on the esoteric Landscape_Physical_Material_Output node.

I haven’t used Landscape Physical Material Output myself. There is, however, an alternative that works well for keeping the visual rendering and line traces in sync, and that is to set the Physical Material in the Landscape’s Layer Info asset.

When you are painting a Landscape, each paint layer has an associated Layer info object.

I have an example project you can check out here:

Note: When warned about Houdini, just disable the plugin if you don’t have it.

  1. Open the StandardLandscape level
  2. Change the editor Mode to Landscape
  3. Click the Paint tab above the 3D viewport
  4. View the following 3 Layers under Target Layers

  1. Click one the Magnifying glasses next to one of the Layer Infos to jump to it in the Content Browser, and then double click the Layer Info asset to open it.
  2. In the Layer Info asset editor, you will see a Phys Material you can set.

image

When you run line traces, the Physical Material returned will be the one that has the highest blended/painted weight (which will match the visuals you see on the Landscape).

Different situations.

To get things working on the landscape all you have to do is use the new output like you would the Grass node.
Output all layers into it from a layer sample node.

Re the changing on a material instance basis.
I don’t see that option yet in .26 latest.
I assume it would be exposed as the Physmat is. Near the very top of the instance once they get to it.

Thanks Doug!

Indeed, the [LandscapeLayerSample] node was the missing component breaking my first attempt. I was erroneously connecting a TextureSample to [ Landscape Physical Material Output] which didn’t work.