Is texface broken?

I can’t figure out how to assign multiple textures to one object with texfaces in multitexture mode. In viewport it shows correctly, but in runtime it uses only one texture for entire object.


=>

The room has material with lightmap on second texture slot with overlay blending and texface flag enabled, and that another thing has no material at all. As you can see, both use only one texture in runtime, though both have two different textures assigned to faces.
Is it broken or I’m doing something wrong? I remember it was OK in earlier versions.
I’m using 2.66a

Without seeing the object/material settings I can only guess. Therefore I suggest to create a demo file with a single cube that has this materials. So you can show this demo file to us.

My only guess now: I have the impression if there are objects without material, this has effects on other objects with material. But I can’t nail it. I just saw this on blends made with an earlier version.

No, material/object settings do not affect it in any way.
What I found is it works in 2.64, but in later versions engine just applies texture from certain (probably first) face in mesh to all other faces.
Here test blend, it works correctly in 2.64 and shows only one texture in 2.66/2.65
test.blend (106 KB)

This is a really crappy bug. I wish it didn’t happen.

You really should make use of materials. However, if you’re going to do texturing without materials, uncheck the “Use Material Caching” option under the System panel of the Render properties. Material caching can really speed up load times, but it assumes you’re using materials.

@Moguri Thank you very much, it helped!

About materials, actually I use them, but only for lightmap\AO texture, so I don’t have to have hundreds of materials with same base texture. Unfortunately, it won’t help if you want to use GLSL with spec
ormalmaps. I had a complex scene with about 10 base materials but ended up with messy bunch of material copies just to have altered AO\lightmaps. So I decided to go with multitexture and texfaces.
One thing that I just hate about BGE is a lack of proper lightmaps support.

The BGE can make use of lightmaps, you just have to bake them as a texture using the Blender Internal renderer and apply it to the object as a UV texture. This is similar to how it’s done in other engines, Blender just doesn’t do all of the steps automatically.

The most recent release of the BGE saw the elimination of the 2 UVmap limit so you are not near as restricted in terms of applying these types of maps.

Also, you can switch to material nodes to alter certain material components through vertex colors, which would allow you to have variety in your maps under one material.

No, I know how to bake lightmaps and all, I’m talking about impossibility of altering textures in materials without making new copies and lack of support in shader, so you are between grayscaled lightmaps (add+emit+rgb to intensity method) or lightmaps that do not reacts to realtime lights (multiply + color).
I figured out how to have colored lightmaps with rt lights (bake lightmaps to verticies and add them as additional lighting in material settings, NOT as color), and I still wanted to use lightmap images for good looking shadows and all, using baked vertex radiosity only to color lights, but heap of duplicated materials made it very difficult to maintain complex scenes and slowed down loading and rendering.

How many lightmaps do you have? I find you can do whole sections of levels with a 1024x1024 lightmap. And then you create materials for each lightmap. Generally I don’t have more than 3 or 4.

Yes, this is exactly what I do in multitexture mode. But in glsl if you want to use materials for advanced texturing and features like bump, specularity, reflections etc., you need to make copies of these materials to have unique lightmap in them. So, if you have scene with, for example, 10 sectors and 3 materials (like brick, floor, etc) and sectors have different lighting setup, after lightmaping you will end up with 30 materials.
It would be nice to have new texture type ‘texface’, which could be used in texture stack just like ordinary image type, but will take image from texface, so you can adjust all blending\mapping options and have varying texture in one material.

P.S. Just found how to got colored dynamic lightmaps in GLSL via stencil maps and texture splatting.

As Moguri pointed out, it’s not a bug. It’s a feature that allows the BGE to load materials faster if properly used, although you can shut it off via the render menu. If you use GLSL, you already are using materials, so it’s no real change for the improvement.

@trq - You still might end up finding that you still use a lot of similar materials. For example, say you want brick or wood for two different maps, but each have different light map textures. In this case, you would have to make another brick and wood material for each of the two maps (for the proper light map to be set up on it).

What you can do instead is use the node editor to make a material that mixes materials based on vertex colors. For example, you can make it so that red is brick, blue is wood, and green is metal. Wherever a color is, the proper material would display. Then, the node editor would mix in the light map over the top of the material. This way, you can have common materials like wood or brick that are shared between objects or maps, and have a single material for each of the lightmaps that you need. Note that you only have access to the red, green, and blue channels, but you might be able to mix in others as well.