Egg textures getting overwritten on mac

The eggs I get with textures contain this line:
saved-result { 1 }
inside their

This line seems to cause the texture to get overwritten by low (in my case -10) priority textures assigned higher up in the scene graph on Mac, but not Windows.

What is this line supposed to do? Why is is there? And how do I make my models stop getting their textures overwritten on mac? I can do setTextureOff on them or delete that line, which seems remove the texture that overwrites theirs so that they works, but I’d like global rather than model solution.

I observed the issue in 1.7.0 initially, and discovered the cause and work around in 1.7.2, though I haven’t verified that it resolves it in 1.7.0.

I have only verified this in my one game with 2 models, so it may not be the case for all models.

I’ve seen Chicken write that line to egg files. I don’t know why it does, or under what circumstances, or whether there’s an easy way to make it not do that.

The line itself is a fairly exotic texture option, which doesn’t have any particular value by itself. It’s used in conjunction with a stack of multiple textures and a complex rendering order between them. When you specify it on a single texture in isolation it has no effect.

Except that it forces the egg loader to create a custom TextureStage for your texture, instead of using the default TextureStage.

This is important, because all of the examples you’ve seen about overriding the texture supplied from the egg file probably assumed that this texture was on the default TextureStage. In that case, you can replace the texture without specifying a TextureStage, with a simple model.setTexture(newTex, 1) call.

But when the model has a texture on some other TextureStage, then model.setTexture(newTex, 1) simply adds a new texture to the stack; the original texture remains there. Precisely how the two textures combine depends on a number of other things, and may be partially random or implementation dependent if you’re not specifying a particular sort order. That’s probably why you’re seeing different behavior on Mac vs. Windows.

Does that help you understand what’s going on?

David

Yes. That explains it completely. Thanks for the excellent explanation.

Seems like I’m back to multi texture with texture stages + default texture stage + custom shaders = confusing/flakey. I’ve been here before and I know how to avoid it: Named shader inputs for each texture.

I’ll just write a wrapper around the loader, and feed the textures into the proper shader inputs. I’ll need a custom loader for the project eventually anyway.

Thanks!