Multiple materials on a single mesh with cinema4d?

Does anyone know how to model trees using Cinema 4d? The problem I’m having is when I import a tree into unity it only has one material. So the trunk is made out of leaves instead of bark.

The trunk is a point-to-point modeled mesh and the leaves are made with intersecting planes. I then connect them into a single mesh and slap on the materials using polygon selections. Then I move the .c4d file to my unity project assets folder, but when I open it the tree only has a single material. I see the palm in standard assets has two materials on a single mesh. How is that done? I’ve only ever managed to use a single material on a single mesh.

You should look up Texture mapping.
you need to unwrap the surface of your model onto a 2d plane using an Unwrap UVW tool then export that as a jpeg to the likes of photoshop or gimp then place the textues where you need to on the image like this


once that is done you can assign texture as a material that to the model and the Texture mapping will place the textures where required on the model. then you export the model with the Texture mapping assigned and it should come up with the texture in the game editor if not it will when you assign the texture in unity.

by far i have found 3dsmax has the best texture mapping tool for the job. you should see if Cinema 4d has mapping tools available.

I know what texture mapping is, that’s not the problem. I don’t need it here because I need two different materials on the same mesh, one for the leaves and one for the trunk. Texture mapping just lets me use different areas of the same texture on different parts of a single mesh, but I need to use two different materials on different parts of the same mesh. The trunk should have the bark material and the leaf planes should have the leaves material. This is done in cinema 4d with polygon selections, but they don’t seem to import into unity.

Ive personally never used that approach as to be honest i’ve never heard of it used in game development which would indicate that either few or no engines support the feature or it is just ineficient computationally or practically. though probably computationally is most likely if that is the case.
why not just make 2 objects and parent one to the other and make it into a prefab that way you can assign the different textures to the different parts and still keep them consolidated as a single object. :stuck_out_tongue:

First of all I must say - worst thread title ever. Sorry, just had to get that out of the way. Your title is in no way related to your question. You’ll get a lot more help if your title is descriptive of your actual post content.

Also, why can’t you just split the trunk and the leaves and import them as two meshes? Submeshes or whatever it’s called.

To get two materials on the same mesh you’ll have to use 2 UV sets and put your second material in the second UV set I think. But that’s mostly used for light mapping if I’m not totally mistaken.

Anyway, it’s so much simpler to just have two objects, one for the trunk and one for the leaves, that you shouldn’t even spend another second thinking about this. :slight_smile:

This is why I need to have a single mesh with two materials:

If the leaves are in separate meshes only the trunk is visible.

unity combines the mesh of parented objects for example if you create an empty game object and place several meshes into the empty game object unity will combine their meshes then you create a new prefab which is empty and drag the now not so empty game object into it then you can remove your game object from the scene and just drag the new prefab into it and you should get a single object.

now i’m no expert by any means on trees in unity as i’ve never used the tree tools for unity but i did notice that they were fbx format and fbx has LOADS of export settings for 3ds it may be worth examining those for texture settings or polygon selection settings during the export process.also look for baked texture settings this may help you.

also:

this process may be responsible for consolidating the meshes. you could also look up tutorials on the subject of making trees specificly for unity if you havent allready. even if they are for mudbox, blender, maya or 3ds the techniques will most likely be the same for your program. sorry for missunderstanding but i was un aware that it wass essetial for the tree utility in unity. hope this helps a bit more

I’m sorry. I didn’t know that’s how it had to be for trees to work, but I tested it now with 3ds max and if I:

  1. Create an object in 3ds max consisting of 2 elements (i.e 1 object, 2 submeshes)
  2. Make sure each element has a different material ID (this happens by default)
  3. Apply a different texture to each element
  4. Export that object as an fbx with the default settings

Then open Unity and look at my object it says: “2 submeshes” and “Materials Generation: Per texture”

So when I put that object into my scene, add 2 materials to the mesh renderer and put two materials on the object each element (sub mesh) gets a separate material according to its material id in 3ds max.

This doesn’t work for you in Cinema 4D?

Not sure what you mean by “connect everything into a single mesh”, but that could be your problem if it means the entire tree has the same material id.

Alright, got it working, thanks for your help. I had to check ‘export as FBX 5.0 compatible file’ from Cinema4d’s fbx export preferences and then export directly as fbx instead of using c4d. I still have to manually create the materials, but the mesh now comes with two slots for them and they are placed correctly.

I see.

I tried to save the .max file directly into Unity and let Unity import it and there was no difference for me. I still only get the object and have to create the materials myself in Unity, but I’m thinking that’s because I only tested with 2 diffuse colors and no actual texture maps. Not sure. :slight_smile:

with 3ds when i import to unity i find that sometimes i get no textures on them despite being exported and mapped with them usually there is a material folder beside the model with the texture that i exported it with but ultimately if all else fails i can just import the texture i used from photoshop into unity and just drag and drop it to the model and the texture always fits so long as i have UMV mapped the the model in the first place.
with more than one texture i use the mapping layers to make sure ther’s no overlap.

What version of c4d are you using? In R11.5 they should just import into unity with two slots for your materials.

I use blender and to get 2 objects on the same mesh is simple im not sure how to do all this in c4d but im sure you probably do.
Just map texture to your separate objects, in your 3d modeling app you should see the tree just as you want it to look in unity. Unity has always recognized that I placed 2 separate images on my object. I dont even assing direct material links in blender I just get the uvs for my mesh setup. then in unity I drag and drop the corresponding textures. I dont see why c4d would be any different.

I’m still using R11. I guess I should upgrade.