A few days ago I posted a few questions about creating a lightmap in Cinema4D using multiple textures or multiple instances of a single texture. The conclusion I and some other people came to is that a workaround is needed, since a C4D export doesn’t seem to support a single lightmap with multiple UV-mapped textures. Since then the only workaround I could come up with was to build a complex model–like a building interior–as a grouping of separate objects, each having its own single texture (mostly sharing “tiles” of a single texture) and each having its own lightmap. This worked fairly well, but I have some questions about it:
For performance optimization, is it enough for me to group the separate parts of a complex object in Unity? Or do I have to join them together in C4D as a single object (which would probably screw up the lightmap again)? I know this is mentioned in the Unity manual, but I want to be sure I’m getting it right.
Is it also good for optimization to have those grouped objects share instances of a single texture?
This next question is about another possible lightmap workaround:
When I bake a map in C4D using the “surface color” channel, it bakes the colors, shadows and illumination together as they appear on the object. However, when I place this map texture on the object, the colors are low-res and very blurry. I tried setting the resolution at 512 x 512, 1024 x 1024 and even 2048 x 2048, but it always turns out exactly the same: blurry. I also took the map texture into Photoshop, set the resolution much higher, then experimented with larger sizes, etc., and still nothing happened. Is there a way to fix this problem? I’ve asked this question in other forums, but got no answer.
The Unity and Blender forums seem to be the most helpful ones!
Hi terransage, I’ve been watching your threads eagerly for answers to some of these questions. I may be able to help with some of them, though.
To get the lightmap that you’ll use in Unity, bake the Illumination channel only, with the shadows box checked in its options section. This should remove that blotchy effect (you don’t want to be using any of your color data in the lightmap)—you can add ambient occlusion if you want. So to be specific: in Unity you’ll be using the lightmap shader with your original texture (the one assigned to you C4D material) plus the baked illumination. Then you can tile your color texture all you like in Unity.
I’ve been doing the same thing as you in lieu of multiple UV sets: a separate object for each material in Unity. However, it isn’t enough to group objects in Unity to get better performance. It all has to be one mesh, not all one group, so the workaround you and I are using is definitely not ideal. In fact, I’ve elected to ditch the lightmap on repeating objects like furniture because it’s frame-rate suicide to have a separate object+material for each chair, bed, and table in a large house. I’m just going to deal with it until Maxon updates C4D, although looking at their release history that could be a long time from now.
For what it’s worth, you will probably save some resources by reusing some of the same textures in your materials, but I still don’t think it’s worth it just to use lightmaps if you’ve got a lot of objects.
Boy would I love it if someone found a better way…
Hi, Marble,
Thanks for your reply. I’ll try the illumination channel. I’ve tried the color channel with illumination and shadows checked, but I still ran into the multiple UV problem. The surface color channel seems promising, because it captures the colors and shadows exactly as they sit on the object. I brought the surface color map into Unity and just used the Self-Illumination shader to bring it to life. The only problem was that darned blurriness. :x Otherwise it would have been so easy…
Yes, I realized that even with shared textures, all of the extra lightmaps on separate objects would tax the engine. I’ve considered breaking the world up into more separate loadLevels, but that breaks up the flow of the game too much.
I bought C4D to overcome the .fbx skeletal animation export problem and thought I was scot-free…
Well, in the meantime, good luck with your workarounds!
Definitely try illumination + shadows. If you want to merge this into the texture (because you’re using SelfIllum) you could put the baked illumination map on top of the color map in Photoshop as a Multiply layer.
If you use the mesh combiner script, This gives you the same effect performance. It essentially builds a single mesh out of several meshes. You need to make sure that they share the same material of course.
Hm, I’m also curious about this. It still doesn’t seem possible using C4D, from what I’ve experienced so far. But it’d be great if it is! 8)
One question I have right away is about when the texturing is done–before or after the mesh combiner script is applied. Can you import the separate/grouped objects fully textured (sharing the same texture, that is), apply the separate lightmaps, and then safely apply the mesh combiner script? But they’re not sharing the same lightmap, so that would be a problem… Oh no, wait. I forgot that you can bake a single lightmap even if they’re separate objects. Would you have to then “divide” up the lightmap into the same selection tags as the texture? But I tried that before with a single, multi-textured object, and that didn’t work. I’m also confused… :?
Essentially if you have models you can make them share the same texture, even though they are using completely seperate parts of the texture. For example one object uses the left half of the texture, the other uses the right part of the texture. in Cinema 4D you just have to uv map your object to seperate it out into 2 objects. When you are using a single texture for both objects, you can also share the same material, thus you can combine the meshes.
I have no trouble doing that–using several UV-mapped instances of the same texture on different parts of an object–and it imports well into Unity. The problem is that a lightmap baked from that object gets skewed by those same UV maps in Unity (in the lightmap shader, that is). On the other hand, if I import the object into Unity with the lightmap already on it, it wipes out the other texture UV maps and replaces it with a single UV map version of that texture. Whew, it’s hard to describe all this stuff…