How to convert static mesh to BSP object ?

Hello

I would like to texture my object with only selected polygons but in static mesh I can only to give one material.
Is it possible to convert such object for BSP to use differents materials for selected polygons ?

What you would need to do is either exporting yopur model with different material (slots),
or create a mask texture and creeate a layered material.

After importing I have only one slot for material :frowning: Maybe problem is with Cinema 4D.
I think that only way to solve this problem is split each polygons from object and then to give them separate material.
Of course then UE4 create the correct number of slots. But when I have too much complicated object then I have a lot of extra work :frowning:
And even I have one texture for one object there are also problems.
Example I have two textures assigned to 16 objects so I need 16 slots. And when I import project from c4d to ue4 I have only two slots for materials and then I need manually to add slots to assign the the rest polygons. When I will put only two materials then I only textured two objects not 16. So in this case I should create copies of materials for each objects in C4D. So I see that C4D is not so good for create objects for UE4 :frowning:

You can’t convert static meshes to BSP, if you want to set a material on a certain part of a mesh then you have to assign a separate material to those parts in your mesh before exporting to UE4. Also note that each material you add to an object will decrease performance so it’s best to find a way to create the look you want within a single material.

Thanks for your information. Of course I know that better for increase performance to make one single texture with bake it and creating full UV map.
But in this case is strange that I must manually to add new slots for the remaining parts of static mesh to texture them.
I thought that these slots should be created automatically but in this case it takes into account only two slots because in project are two texture but each object have one of these textures so if I have 16 texture objects should be 16 slots I think so.
Of course if I assign new materials from UE4 to these slots there are mess. So I add next slots ( 2 created are automatically + 14 add manually ) and put materials to the slots then is everything ok.
I am sorry for my english.

You can do polygon selections in C4D just fine.

Here’s an example i once made, c4d (R17) and fbx included:
http://www.mediafire.com/file/iisrd7qj47lp9fl/housebuilder.zip

Export was done with fbx v6.1 since it works best.

Maybe you can show us a few pictures of your issue or provide an example file, since i have to admit that i don’t fully understand what you try to achive.

If you have 16 objects in C4D, you can either combine them on import in UE4 or have 16 meshes in UE4.
If some of your meshes share the same material (name), they will also use the same material in UE4.
If you want certain polygons of an object to use a different material, you have to work with polygon selections.

So if you want 16 Materials in UE4, you need to set up 16 Materials with unique names in C4D, too.
They can even be just copies of the same material as long as they are renamed properly.
Materials with the same name will be seen as one material on export.

In case you have a mesh that consists of several objects and the 16 materials are just for texturing purpose, like having some parts of a model appear with plastic, some with metal, some with gold and some with wood,
it might be better to bake down a color ID mask and have one Material with several textures to define the material properties.

Every material (also every smoothing group and UV island) is causing a drawcall and it’s a big difference if your model causes one draw call (best case) or at least 16 drawcalls, possibly more (worst case).

I checked your project and there is the same problem as in my case. When I assigned in your project one of these yours material to next of object then I have still 7 slots not 8.
So as I mentioned only way to solve this problem is create as many materials as you have objects to texturing. One object - one texture … you can`t use one the same texture for two or more objects.
Otherwise you need manually to add slots in UE4 editor to have access to objects which you want to texture.

As you see in my project I have only 3 textures which are assign to many objects. Link to my project: https://www.dropbox.com/s/6mk449o58kecf46/kotlownia.c4d?dl=0

Your project uses 3 Materials, so it will only create 3 Material slots in UE4.
If you assign the same Material to more then one Object then these Objects will use the same Material even if you import them as seperate objects into UE4.

It doesn’t even matter if you combine your meshes or keep them as seperate objects.

A little example that might help you understand:


Cinema 4D file:
http://www.mediafire.com/file/z5j8pm7lxb9kc77/materials_and_objects_0001.zip

Left to Right:

Row 1 is one Object that uses 6 different materials with polygon selections.
Row 2 has 6 objects that use the same material.
Row 3 looks like Row 1 but consists of 6 objects each with it’s own material.
Row 4 is the same setup as Row 1 but instead of selecting 6 faces of the same cube only one face of each cube was selected and turned into a polygon selection.
Row 5 is also only one object but this time only 2 materials were assigned.

If imported into UE4, all these Materials should remain that way.

So if you assign a brick wall texture to the red material, all faces that have the red material on them should change to the brick wall.
Which means:
Row 1 only the left cube
Row 2 all cubes
Row 3 only the left cube
Row 4 only the red face of each cube
Row 5 cube 1-3

BTW: your house model isn’t exactly optimal for a realtime engine.
There’s a lot of unoptimized geometry and lots of overlapping objects that will cause issues on lightmap building.
Also you should try to build things more accurate with good messurement values.
Instead of having objects e.g. length 217.829 width 43.441 height 126.546, try to work with rounded values or even steps of 5, 10 or 20 like you’d do in UE4 with the grid snap.
So that object would be e.g. 220x50x120.
Also get used to work with the Snapping tool in C4D and also with the quantisize option (Attributes Manager>Modelling>Quantisize) and make sure to check your models with the Mesh check to find topology issues.

Since i had some free time today i did a quick example:
http://www.mediafire.com/file/fbu9nvdf92u596o/TP_TEST.zip

Source c4d+fbx:
http://www.mediafire.com/file/nzsptawipl6gdxd/kotownia_edited.zip

Hello kraid

I would like to thank you very much for your comprehensive answer :slight_smile:

Of course my mesh is not opimized I made it very quickly to check texturing in UE4.
And in my case wrong static mesh could be problem with texturing because not all materials were assigned to polygons correctly ( mess in mesh )
I noticed also that polygons which arent textured causes problems with texturing in UE4 example if you dont have texture for one polygons ( no base material ) then first material will be assigned to missing texture in polygon automatically.

I think that for mesh which describe completly buidings will be better and faster to bake texture creating UV map with single texture.
And for modular building is better idea to texturing directly in UE4 using their materials.

Thank you very much for your tips and projects which you sent. I appreciate it very much and I am sorry for my english.

Correct: untextured polygons will cause an Error that basically overwrite every material selection with only one default material.

For my testproject, I have to add one thing:
you can have several instances of the same material on your model.
As you can see in the project file there are several “concrete” materials with a number in () while the source Project only has one concrete material.
This Material has been assigned several times to the same object always using a different polygon selection and also different tiling values for each material.

Wrong. If you need tileable Textures on a big structure like a building that isn’t modular, you should use this method and no texture baking at all.
The key is to use a material projection method that allows you to have a texture evenly distributed across all surfaces of the mesh.
For most Buildings this will be cubic projection.

After the Material is looking good, you can turn that cubic projection into an UVW map by right click on the Material and select “create UVW”. (delete previously existing UVW tags)
Next you just select the biggest chunk (e.g. a long wall) drag it somewhere and then continue with the smaller chunks and layer them on top of the big chunk (enable snapping)
in a way that makes sense.
Last but not least you make clusters of the small faces like the insides of window and door gaps and rotate them accordingly to the texture orientation and place them inside the big chunk area too.

Now select everything and fit it to the UV canvas (there’s a button for that).
Stretching doesn’t matter at this point, as long as everything is stretched equaly.

Now you can use the tiling of the material to “unstretch” the textures.
Use a checkerboard e.g. added to the luminance channel for that purpose and scale the U and V values till the checkers appear in a good size and quadratic shape.

Thank you for your next tips :slight_smile:
It works pretty well … one texture after change their parameters in C4D for selected polygons and after import it generates a new slots in UE4 adding texture coordinate with previous settings from C4D for each material.

About baking textures for complete building mesh you have right but as you know for these materials needs to add some painting, blend fragment of textures, insert any images and etc on UV map in Photoshop or directly in UE4 without baking texutre adding vertex painting or some alpha textures, shaders etc to get the effect irregular texture, aging or other effects for to get more realism.

If I bake the object I am baking texture, normals and ambient occlusion but I don`t know if this is a good idea to bake ambient occlusion maybe it is good for more performance ?
UE4 has own ambient occlusion but in materials can assign ambient occlusion map.
Thanks :slight_smile:

Ambient Occlusion can be baked with the lightmaps in UE4.
So as long as you have a second UV for Lightmaps set up, it will be fine.

As for adding some irregularity you might want to apply a dirtmap to the material.
Note that you can choose the UV channel you want to use for a texture.

In that Example i baked a Shader in C4D to the Lightmap UV channel (2k texture):


Then applied it as a second TextureSample to the materials using a Multiply node
and used the TexCoord node to set it’s UV to use channel 1 (lightmap channel) instead of channel 0 (diffusemap channel)
Also didn’t use any U and V tiling, because unlike the channel 0 the Lightmap UV channel isn’t layed out for beeing tileable.

In a more advanced state you could do things like using this grayscale image as a mask for a second Texture:
a3d9477adcc4bfab97fb26ef755676cd1cfbd5a7.jpeg

Of course in the second case it needs to be careful when we are painting texture which is for assign to more than one object :slight_smile:
How did you bake lightmap in C4D ? Did you use bake texture tag with ilumination ? and nothing more ?

I didn’t bake the lightmap in C4D, this should be done in UE4 because you place lights etc. there, too.

What i did was creating a Mask texture using C4D noise shader that were baked using the same UVs as the lightmap is using.
This was done because the other UVs used for diffuse Texture has many UV islands layered above each other,
while the Lightmap UVs have a clean layout with each UV island on it’s own space on the UV canvas.

You could also create a own UV layout for this purpose and end up having 3 UV channels, but for this example the Lightmap UV fullfilled it’s purpose just fine.