Numerous textures on top of each other?

Recently I have found the following game design idea: iandallas.com/games/swan/ (you can have a look at the Vimeo movie on that page). Th idea is definitely creative, innovative and very smart (although I don’t see much of the game there yet). It lead me to some other ideas I would like to try.
And here is the difficult point: similarly to what you see in the mentioned prototype, the game would require many (dozens or maybe even hundreds) of textures to be dynamically applied on the model, often on top of each other. Can you, please, give some hints on how to achieve it?

Cute.

I wouldn’t attempt to apply multiple textures to your environment. Just apply one texture, maybe a different one to each object, but modify the texture data itself on-the-fly as needed, for instance via tex.load().

David

Let me check if I get it right.
Let’s imagine something similar to the mentioned prototype. There is some texture on the cube, initially entirely white. Then I apply the ink texture on it, let’s say by using automatic projected texture coordinates. So, I have two two textures on top of each other. Now I need to combine these two textures into one, right? How can I do it? Can you, please, elaborate a little bit?
EDIT: After more reading the manual, it looks like the additional uv set is not required, and I can simply project new texture on a model. Still, the question is how to combine the initial (or previously modified) texture image with the new projected one?

Well, you could do it that way. If you want, you can stack up multiple textures, then call nodePath.flattenMultitex(), which will attempt to combine them down into one texture. You can do this repeatedly, though the quality may degrade after a few cycles.

But that’s a little bit iffy. A more reliable way would be to keep only one texture. Never apply a second texture. Don’t mess with projected texture coordinates or anything. Just directly modify the texture data. Figure out the part of the texture that was splatted onto, and directly paint black into those pixels.

The only hard part about this approach is figuring out the part of the texture that was splatted onto, but with a little ingenuity I bet you can do it. :slight_smile:

David

nodepath.flattenMultitex()? I don’t see this method neither in documentation nor anywhere else (even Google doesn’t know this words except in this very thread). Is it possible to see some description/documentation of this method?
EDIT: Probably, you meant MultitexReducer

def flattenMultitex(self, stateFrom = None, target = None,
                        useGeom = 0, allowTexMat = 0, win = None):
        from pandac.PandaModules import MultitexReducer
        mr = MultitexReducer.MultitexReducer()
        if target != None:
            mr.setTarget(target)
        mr.setUseGeom(useGeom)
        mr.setAllowTexMat(allowTexMat)

        if win == None:
            win = base.win

        if stateFrom == None:
            mr.scan(self)
        else:
            mr.scan(self, stateFrom)
        mr.flatten(win)

in pandac/libpandaModules.py
All extensions in that file are not documented.