Hello Lars,

Lars Bilke wrote:
> Hi,
> 
> I want to display a scene with a SkyBackground and some materials in the 
> scene should reflect the Sky.
> I´ve created a cubemap consisting of 6 faces and I create a 
> CubeTextureChunk out of it:
> 
> inegz->read("textures/skybox/skybox_south.png");
> iposz->read("textures/skybox/skybox_north.png");

are these two swapped, i.e. shouldn't north be the negz image ? (I don't 
think that has anything to do with the images being upside down though).

> inegy->read("textures/skybox/skybox_down.png");
> iposy->read("textures/skybox/skybox_up.png");
> inegx->read("textures/skybox/skybox_west.png");
> iposx->read("textures/skybox/skybox_east.png");
> 
> cubeTexture = CubeTextureChunk::create();
> beginEditCP(cubeTexture);
> cubeTexture->setImage( inegz );
> cubeTexture->setPosZImage( iposz );
> cubeTexture->setPosYImage( iposy );
> cubeTexture->setNegYImage( inegy );
> cubeTexture->setPosXImage( iposx );
> cubeTexture->setNegXImage( inegx );
> endEditCP(cubeTexture);
> 
> Then I create a SkyBackground:
> 
> SkyBackgroundPtr skyBackground = SkyBackground::create();
> beginEditCP(skyBackground);
> skyBackground->setFrontTexture(HelperFunctions::CreateTexture(cubeTexture->getImage()));
> skyBackground->setBackTexture(HelperFunctions::CreateTexture(cubeTexture->getPosZImage()));
> skyBackground->setLeftTexture(HelperFunctions::CreateTexture(cubeTexture->getPosXImage()));
> skyBackground->setRightTexture(HelperFunctions::CreateTexture(cubeTexture->getNegXImage()));
> skyBackground->setTopTexture(HelperFunctions::CreateTexture(cubeTexture->getPosYImage()));
> skyBackground->setBottomTexture(HelperFunctions::CreateTexture(cubeTexture->getNegYImage()));
> endEditCP(skyBackground);
> 
> I also use the CubeTextureChunk inside a glsl shader as a samplerCube. 
> The problem is, when I have a correct SkyBackground the "reflected" sky 
> on scene objects which is computed in a pixel shader is not correct: the 
> side faces of the reflected cube (PosX, NegX, PosZ, NegZ) are standing 
> upside down.
> 
> When I edit the cube map images so it is right in the shader the problem 
> is the same on the SkyBackground.

Just to make sure I understand this correctly: are you saying that 
flipping the actual images does not have an effect on what you see with 
the SkyBackground ? Strange.

> My question is: are there any differences in handling the faces of a 
> cube texture in a SkyBackground and in a CubeTextureChunk, GLSL shader??

hm, not sure, I'm currently looking into it. In the meantime, have you 
tried to specify texture coordinates for the SkyBackground ?

        regards,
                Carsten

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to