You might be dealing with pre-multiplied alpha. For efficiency, Xcode (and the iOS image loaders) assume that alpha is to be pre-multiplied into the colors within each texture, and actually modifies the textures during app packaging and texture loading. This is a well-known issue with Xcode and iOS.
Try changing the name of the PNG file to give it a ppng
file extension. That will cause Xcode to skip the file manipulation at build time and will cause Cocos3D to use a non-Apple file loader for the image.
See the notes for the CC3Texture
class or the texture
property of CC3Material
or CC3MeshNode
for more on this.
[Edit]:
This turned out to be an issue with the rendering order of two nodes that contain transparency. The bluish color was coming from the scene backdrop, which was behind the skybox. The object of interest was being rendered before the skybox, which also had a texture containing transparency. Normally, Cocos3D will automatically render opaque objects first, then translucent object in reverse order of distance from the camera. In this case, the skybox contained transparency (had an alpha channel), and was being rendered after the object of interest. It's generally good practice to make sure the texture used for skyboxes is opaque and contains no alpha transparency.
It's also possible to force the skybox (even a translucent skybox) to be rendered first by setting its zOrder
property to a positive value (it defaults to zero). The zOrder
property can be used to fix the rendering order of transparent objects. It is not required (and has no effect) on fully opaque objects.