Multitexturing blending properties

Hi, is there any documentation anywhere about all those setCombine… functions and all that on the Texture class?



I have some problems with grayscale lightmaps getting some disturbing green and red areas when in the scene.



I'd like to know if and how it's possible to control how the textures are combined in multitexturing.



Btw, congratulations to the release of 1.0!!! :slight_smile:

i was told that the opengl red book has them  :smiley:

Well if you have a specific problem with the combine modes, me and other forum members might be able to help…

You should also take a look at the jME wiki page for texture if you haven’t done so already.

Great, I just assumed it would be under "Multitexturing" ://

Thanks.

I don't quite get it.



In "Example 2" on the wiki two textures are setup for being combined:


//assuming Image was created elsewhere
Texture texture1 = new Texture();
texture1.setCorrection(Texture.CM_PERSPECTIVE);
texture1.setFilter(FM_LINEAR);
texture1.setMipmapState(MM_LINEAR_LINEAR);
texture1.setImage(image1);
texture1.setApply(Texture.AM_COMBINE);
texture1.setCombineFuncRGB(Texture.ACF_MODULATE);
texture1.setCombineSrc0RGB(Texture.ACS_TEXTURE);
texture1.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
texture1.setCombineSrc1RGB(Texture.ACS_PRIMARY_COLOR);
texture1.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
texture1.setCombineScaleRGB(1.0f);
 
Texture texture2 = new Texture();
texture2.setCorrection(Texture.CM_PERSPECTIVE);
texture2.setFilter(FM_LINEAR);
texture2.setMipmapState(MM_LINEAR_LINEAR);
texture2.setImage(image2);
texture2.setApply(Texture.AM_COMBINE);
texture2.setCombineFuncRGB(Texture.ACF_ADD_SIGNED);
texture2.setCombineSrc0RGB(Texture.ACS_TEXTURE);
texture2.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
texture2.setCombineSrc1RGB(Texture.ACS_PREVIOUS);
texture2.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
texture2.setCombineScaleRGB(1.0f);



What confuses me is that both textures are given parameters of how they should be combined. Shouldn't it be enough to supply one set of parameters?

If texture2 recieve parameters for how it should be combined with texture1, what are the texture1 combine parameters for and what is it combined with? Vertex color?

In the example, texture1's color is modulated (multiplied) by the primary color which is vertex color, (or lighting color if its enabled).

The final color would be:


unit0_color = primary_color * texture1_color
unit1_color = unit0_color + texture2_color - 0.5

Thanks.