Blending Textures

I’ve been looking over the documentation for Texture blending, and I haven’t been able to figure out an apparently simple thing:

How can I take a model which has a texture A and smoothly transition to a texture B?

I thought that this code would do it:

self.ts = TextureStage(‘ts’)
self.ts.setColor(Vec4(1, 1, 1, FACTOR))
self.desk.setTexture(self.ts, self.texture_A)

Where I make “FACTOR” go from 0 to 1 slowly.

But it doesn’t do what I expected. Am I getting something wrong?

thanks in advance!!

Forget about it. I found the way using PNMImages :slight_smile:

This code generates a texture wich is a blend between A and B, where “f” is a number between 0 and 1 which controls the blending :slight_smile:

texA_I = PNMImage(Filename(“A.jpg”))
texB_I = PNMImage(Filename(“B.jpg”))
texBlend_I = PNMImage(texA.getXSize(),texB.getYSize())
blendedTexture = Texture()
texBlend_I.blendSubImage(texB_I, 0,0)