0

I am rendering a flower from textures from a spritesheet on screen, and all looks fine. When I use the same textures but not from a spritesheet the flower is rendered differently.

This image (first, below) of the flower rendered from a spritesheet and looks correctly. It is composed of two texture layers: petals and center.

image of flower rendered correctly

This image (below) of the flower composed from two sprites, one holding petals texture, the other holding the center texture, not from a spritesheet. As you can see, there is transparency around the center, and that is caused by (I presume) blending of center texture onto the petals texture.

image of flower rendered incorrectly

The petals and center textures were composed from original images read from files using CCRenderTexture. The original images are PMA (premultiplied-alpha), while the resulting texture from CCRenderTexture is NPMA (non-premultiplied-alpha).

Changing blending modes to PMA or NPMA does not help.

The sprite node hierarchy is simple:

ROOT-SPRITE (empty image, ie 1x1px size, fully tranparent image)
  PETALS-SPRITE (petals texture), z=1
  CENTER-SPRITE (center texture), z=2

I have the following questions:

What am I doing wrong? How can I resolve this?

Using Cocos2D-X v3.4 in iOS simulator (device has same results).

genpfault
  • 51,148
  • 11
  • 85
  • 139
andrewz
  • 4,729
  • 5
  • 49
  • 67
  • Which sprite scaling issues do you refer to? Maybe, but what is an enigma to me is the transparency "ring" around the center of the flower. I'm sure it's a blending issue, but, what am I doing wrong? Am I blending incorrectly from the original image into the center texture, or am I blending incorrectly the center texture together with the petals texture into the resulting CCRenderTexture? I wrote out the intermediary images to png files, but they all look fine?? So, where have I gone wrong? – andrewz Aug 18 '15 at 22:52
  • No, you're right. I was I guess, not fully awake when I wrote that =P The two images are different scales and once you sort that out, it is basically just the purple ring that's causing problems. I will delete that comment. – Andon M. Coleman Aug 18 '15 at 23:00

0 Answers0