Download

Confusion over how to apply materials by location

This feels like a really stupid question, considering how common a technique this is and how much time I’ve put into trying to figure out the answer. I’m making a model of my apartment in Maya and am confused about how I’m going to go about applying materials to it selectively. I want to have the different rooms be different colors using different materials in UE4.

Here’s the confusion: how do I apply these materials to different locations? Do I have to create a texture of some kind using my UV map of the model first? What do I do with it then?

I looked into a few examples on the marketplace but can’t figure it out. I’m thinking of Koola’s Lightroom example in particular. It has a static mesh called room1_Box002 that has a white material on one side and a wood material on the rest. They’re labeled element 0 and 1 under its material listing, but I can’t figure out how they’re applied in their specific locations. I don’t see any sort of texture map in the layout of the materials for that object. I’m pulling my hair out about this! It seems so simple and I can’t figure it out.

Material ID’s

I don’t know how it’s setup in Maya, but in 3ds Max you can assign a multi-material, where it contains several materials in it that each have an ID number, then you can apply the ID number to specific polygons on the mesh and it will allow a single mesh to use multiple materials. You can also just select the polygons and apply the different material to it and it automatically sets things up.
That stuff exports to UE4, so when you open the mesh in the editor it will have multiple material slots if you applied multiple materials.

In Maya I’m pretty sure you can just apply materials to your polygon selection.

A note though, each material you add to a mesh slows things down (increases draw calls) so only do that if you have to, otherwise try and do it with textures. In some cases you can’t, like if you have different types of walls because they’d need to tile the texture, but in other cases it’s best to try and adjust it in your texture maps.

Technically every wall of yours should be a different mesh with it’s own UVs. Go modular, use instanced materials for each rooms and try to break down the geometry to understand what is repeatable or not :slight_smile:

I had this thought as I was falling asleep. I wasn’t really seeing static meshes of the size that I was trying to create in the example files. The issue is that I was going for really high precision with this model of my apartment. I don’t know how modular I’ll be able to make it. I understand that that’s the way to do things though. Thanks!

I’m going to try the modular approach, but I appreciate the suggestion. I found a tutorial on Material IDs in Max but not Maya. I’ll check into it further if I need it.

You don’t need every wall to be a different mesh, usually a wall will be pretty low-poly so reusing a mesh for walls will slow things down more because of the inrease in draw calls and you wouldn’t be saving much memory that way. For walls, the only reason to split them up (if they’re low detail) is because of lightmaps. Since lightmaps have to cover the entire mesh if the mesh is large then you might not get enough detail in the lightmap even at a high resolution so you’d need to split up the mesh which would mean it would use multiple lightmaps.

Alright. I’m really not sure how to go about even creating this static mesh(es) anymore. I’m just going to post what I’m trying to do and solicit your advice:

I took renders of my original attempt (the geometry is trash; I’m getting used to Maya) and set them up as image planes to redo what I did. How should I approach building a level that is the entire floorplan in the attached image? I assume I shouldn’t just try to import the whole thing as a static mesh. Should I go wall by wall, room by room or something else? Also, if I split things up, how should I handle intersecting geometry? Is there some best practice for that? Here’s what my image plane setup looks like:

1b7647f084eaf13ce984987bfeb22325867c2bbf.jpeg

Once I’ve split the whole mesh into nice sized parts, do I need to create texture maps for each one? How can I set them up like in the Lightroom example by Koola (with Element 0 and Element 1)? Would I need to do the Material ID thing, as was suggested, or can that be done using texture maps without futzing with Material IDs in Maya?

For a building I’d do something like the interior walls of a room as a single mesh, if it’s still too big then split it up but start off with each room separate. In the case of really open areas you’d have to split that up. Make sure that you have walls with thickness instead of single polygons, so you’d need the inside of the wall and the outside of it. Avoid intersecting geometry, you want your corners to line up together, that goes for the ceiling and floor as well. It can mess up the lightmaps if you have walls going beyond corners where they shouldn’t be.

As for texturing, you can have a general wall material, and then use it on all the walls that have that color. For your wall textures you use a tiled texture and then you create your UV’s (texture mapping coordinates) on each wall. If it has a specifically different material, like say the wall vs. the ceiling then you’d have a different material for the ceiling.

As an example, I did a model of our office and it’s got a gray color for the walls and then there’s a few walls that are a plum color so those are two separate materials. And then there’s the window frames which I have as separate meshes with a kind of metal material. And then I’ve got the floor which is just a carpet material. The ceiling then has a ceiling tile material.
For those types of generic materials it doesn’t matter what size the objects are, like what size the wall is, as long as it’s using tiled textures you can adjust your UV mapping so that it looks good on all the walls and they can all use the same material.