CubeMap screws up TexCoords

I am rendering various Geometries that use CubeMaps to Textures using TextureRenderer. This happens in its own GameState.



In another GameState i use the rendered Textures on Quads. I fade from static Textures to those rendered Textures by using the following Code:



    texState.setTexture(fadeToTex);
    texState.setTexture(fadeFromTex, 1);
    q.setRenderState(texState);

    fadeToTex.setApply(Texture.ApplyMode.Combine);
    fadeToTex.setCombineFuncRGB(Texture.CombinerFunctionRGB.Interpolate);
    fadeToTex.setCombineSrc0RGB(Texture.CombinerSource.TextureUnit1);
    fadeToTex.setCombineOp0RGB(Texture.CombinerOperandRGB.SourceColor);
    fadeToTex.setCombineSrc1RGB(Texture.CombinerSource.CurrentTexture);
    fadeToTex.setCombineOp1RGB(Texture.CombinerOperandRGB.SourceColor);
    fadeToTex.setCombineSrc2RGB(Texture.CombinerSource.Constant);
    fadeToTex.setCombineOp2RGB(Texture.CombinerOperandRGB.SourceAlpha);
    fadeToTex.setCombineFuncAlpha(Texture.CombinerFunctionAlpha.Interpolate);
    fadeToTex.setCombineSrc0Alpha(Texture.CombinerSource.TextureUnit1);
    fadeToTex.setCombineOp0Alpha(Texture.CombinerOperandAlpha.SourceAlpha);
    fadeToTex.setCombineSrc1Alpha(Texture.CombinerSource.CurrentTexture);
    fadeToTex.setCombineOp1Alpha(Texture.CombinerOperandAlpha.SourceAlpha);
    fadeToTex.setCombineSrc2Alpha(Texture.CombinerSource.Constant);
    fadeToTex.setCombineOp2Alpha(Texture.CombinerOperandAlpha.SourceAlpha);
   
    fadeToTex.setBlendColor(fadeColor);
    fadeFromTex.setApply(Texture.ApplyMode.Combine);
    fadeFromTex.setCombineFuncRGB(Texture.CombinerFunctionRGB.Modulate);
    fadeFromTex.setCombineSrc0RGB(Texture.CombinerSource.Previous);
    fadeFromTex.setCombineOp0RGB(Texture.CombinerOperandRGB.SourceColor);
    fadeFromTex.setCombineSrc1RGB(Texture.CombinerSource.PrimaryColor);
    fadeFromTex.setCombineOp1RGB(Texture.CombinerOperandRGB.SourceColor);
    fadeFromTex.setCombineFuncAlpha(Texture.CombinerFunctionAlpha.Modulate);
    fadeFromTex.setCombineSrc0Alpha(Texture.CombinerSource.Previous);
    fadeFromTex.setCombineOp0Alpha(Texture.CombinerOperandAlpha.SourceAlpha);
    fadeFromTex.setCombineSrc1Alpha(Texture.CombinerSource.PrimaryColor);
    fadeFromTex.setCombineOp1Alpha(Texture.CombinerOperandAlpha.SourceAlpha);

    q.updateRenderState();



Now when i fade to the rendered Texture the result is something like this:


Since the streams are not exactly horizontal, it cannot be wrong scaled TextureCordinates. Can it be that using the CubeMap messes with TextureCorrdinates somewhere else completely? When I don't use CubeMaps the problem does not occur. I have checked and I have an updateRenderState() after EVERY setRenderState() now. (buttugly  ;))

plz help

EDIT: The problem also occurs when I fade ANY two textures, not just when i use the rendered one. Also I call copyTextureCoordinates(0, 1, 1); on the Quad I fade the textures on.

noone?

Sorry, dhdd no ideas here…

hey there guys,



I still have to find a solution to this. Now i checked, whenever the CubeMap bleeding occurs (as shown above) the texturecoordinates of the geometry that i fade textures on are all normal:



...
rightQuad9 | [0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0]
rightQuad9 | [0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0]
...



So the CubeMap does not seem to mess with the TexCoords of the Quad i fade textues on. What else can it be?

thanks,
Andy

maybe you can provide a simple test to verify this?

i can try to provide a test, but it won't be simple  ;) i'm on it



EDIT: I knew it, god damn it, i made the testcase and the darn bi*** works in the test. now i have to diff. i'll report back when i find the bug.

For cubemaps you should enable environmental mapping to generate texture coordinates (Texture.setEnvironmentalMapMode) instead of using 2D texture coordinates.

EDIT: I knew it, god damn it, i made the testcase and the darn bi*** works in the test. now i have to diff. i'll report back when i find the bug.



.. :D .. i know this as well.
If you have a prob in your complex system, and try to seperate it into a simple test, the problems won't occur ;)
But maybe you are able to figure it out, or the suggestion of momoko is allready the solution you need.
Momoko_Fan said:

For cubemaps you should enable environmental mapping to generate texture coordinates (Texture.setEnvironmentalMapMode) instead of using 2D texture coordinates.


i do that:


        ts.setTexture(generateCubeMapTexture());
        ts.getTexture().setEnvironmentalMapMode(EnvironmentalMapMode.ReflectionMap);
        ts.getTexture().setApply(ApplyMode.Combine);
        ts.getTexture().setCombineFuncRGB(CombinerFunctionRGB.AddSigned);



the log output with the TexCoords from above is from the Quad i fade any two Textures on. I just previously rendered a geometry that has a CubeMap onto another Texture. As you can see this is bleeding to a whole different part of the scenegraph, although the TexCoords of the Quad showing the problem are ok as you can see above.

sorry guys,



the previous post with the testcase was bullshit, disregard it for now please, i am still trying to reproduce the bug  :expressionless:

ok, hey guys, i cannot reproduce it. but trying around i found out the following: the behavior is the same with

  • EnvironmentalMapMode.ReflectionMap (as used in TestCubeMap and TestCubeMapGLSL)
  • EnvironmentalMapMode.SphereMap (as used in TestBloom)



    any ideas? :wink: