[FIXED] Graphics 2.0 Display Object Transparency Issue

Hi guys, I’m having what I believe to be a graphics 2.0 issue at the moment. Certain display objects in my app are sporadically appearing at varying levels of transparency. I originally thought that either I was accidentally modifying their alpha property or cancelling an alpha based transition somewhere, but I found that all alpha values of objects in the relevant display hierarchy were 1.0. This should mean that there should be no hint of transparency on simple display.newRects if I’m understanding the api correctly. 

I have compiled a list of behaviours that may help to trace this issue down:

 - some objects with touch listeners attached will render correctly when triggered

 - touch events can always be triggered, event when the target object looks completely alpha-ed out (strange as I understand that objects with an alpha value of less than 0.004 cannot be touched?)

 - the object’s properties seem completely unaffected by this issue

 - the issue seems to occur more ofter when an screen transition has just occurred

Unfortunately I’m not in a position to submit an example project at this time, so I understand that it may be difficult to validate what my issue, but I am near certain that this is an api bug rather than an error in my implementation as I have encountered this problem on objects that have never had their alpha property modified through my codebase.

I hope that I’ve explained this enough to illustrate the issue I’m facing!

Thanks in advance :slight_smile:

I’m experiencing a nearly identical issue. The issue is also sporadic for me, and seems to occur after a transition has just occurred. I also thought it was strange, but was able to trigger the touch events by touching where the button should be.

@max84

Thanks for chipping in, as you mentioned the behaviour you’re experiencing is thought provokingly similar to mine, with any luck we’ll be able to catch the dev’s attention and get a fix :slight_smile:

I too have seen this.

However I’ve failed to write a sample project for a bug report as it’s very sporadic, but it only occurs after a transition.

I see this issue as well.  Sporadically, display objects that should have an alpha of 1 are shown partially  transparent instead. Across runs it affects the same objects even though there are other objects of the same type on screen.  Not sure if this is just a coincidence but the objects affected in my app seem to be near either the top of the screen or at the top of their local display group (i.e. yPos near 0 in either group or screen coordinates).  

I noticed this with Graphics 1.0 compatibility on, so I bit the bullet and switched everything over to G2 but I’m still seeing the issue.  :frowning:

I see it on Mac simulator and iOS devices I’ve tested on using various and current  G2 dailies.

Hi all,

Can others in this thread confirm that the common issue may be transitioning to a certain alpha level? Or does this occur when just explicitly setting the same alpha on various objects?

Brent

@Brent: For me, it occurs when transitioning a scene. The scene which is being transitioned to has an alpha being set (to 1) on a single object in the enterScene event handler.

I reported a bug last monday that is probably connected to this:

“When groups are going off screen in mid transition, and then come back onscreen, the alpha transition never finished.”

[lua]

local group = display.newGroup()

local box = display.newRect(50,50,100,100)

group.alpha = 0

group:insert(box)

– Transition the group to full alpha in 800 ms

transition.to(group, {alpha = 1, time = 800})

– Transition group offscreen where  above transition will not finish

– On complete, bring it back, it will not be 100% white since 

– alpha transition above did not finish.

transition.to(group, {x = -200, time = 900, onComplete = function() group.x = 0; end})

[/lua]

I noticed this issue as well but never could get any small code to cause it. I am glad someone pinned it down. Another odd detail is when I checked the alpha property it would always return 1, even though the items were clearly transparent. Very odd bug.

@brent, max84’s description sounds like it could be identical to what I’m seeing;  On a scene transition that fades in, certain objects in the  newly transitioned to scene may show up partially transparent.  I hadn’t made the connection that it might be related to the transition, but as far as I can tell objects in the scene that are added after the scene transition never exhibit the problem.  And it seems like when the problem does happen it is only to a single display object in a scene, and always to the same object in that scene.  To reiterate, it doesn’t always happen and scenes usually load and transition without issue.

I’d also like to point out I’ve had this happen to multiple DO’s in one scene, although it’s usually the same objects.

Also, as @Anderoth stated, inspecting the alpha values of these objects reveals they are set to 1 despite being transparent.

As @HardBoiledIndustries has said I’ve also noticed this on display objects at the top of the screen.

The object I have is at the top left of the screen. Alpha = 1 even though it appears at random alpha’s on screen.

I have my own scene transitioning in place (this code was written before storyboard was available).

I have two objects that fade to alpha=0 on the way out. One on the top-left, and one on the middle-right. The transition is a slide left movement, so the top-left is the object that goes off-screen first.

On the way back in (slide right) the object at the top-left will occasionally be transparent but have an alpha=1. The other object (middle-right) always transitions correctly.

One thing I noticed is that if I *increase* the alpha=0 transition time from 100ms to 200ms on the top-left object, it always transitions back properly.

Hi all,

Has somebody in this thread already filed a bug report for this, or can you? We’d like to see the most simple, stripped-down example possible, showing what is clearly occurring.

@jonjonsson, I see you filed a bug… is this clearly showing the issue? If so, we can use that as a test case.

Thanks,

Brent

@Brent Yes its 100% what Ingemar and some others are describing. Not sure if it covers the all the problems in the thread.

In addition if you transition the object directly the alpha will transition normally, bug only applies to transitioning groups.

I can confirm that the problem for me applies to transitioning alpha values while also transitioning the object off screen.

If I hardcode alpha=0 when transitioning offscreen and alpha=1 when coming back the objects are displayed properly.

We have been trying to find some workarounds at our office over the past couple of days but nothing yet, will post if we find anything. In the meantime we have been able to replicate our specific issue a bit more.

In one of our screens we have a scrollview which contains a number of display objects, and this is where the issue is most damaging. New objects used to fade in using transition.to but we removed that in case it was causing the issue. We then tried toggling the alpha of these objects from 0.0 to 1.0 in case it was an issue with some internal dirty flag, but the issue still occurred. During testing, I tried switching scene using a “cross-fade” storyboard transition whilst the scrollview was scrolling to the top of its contents, and upon returning to the scene with the scrollview in it I found that some of the display objects contained within it were at varying levels of alpha, not just 1.0 or 0.0.

To summarise, no objects in the scene have any transition applied to them and all objects have either no alpha or full alpha, so there should be no circumstance where by some objects are translucent. I believe that the only place that the alpha can be changed is during the internal scene transition and that maybe there’s a bug when multiple transitions are applied to an object? e.g. (the storyboard transition and the scrollview transition)

I am having a similar issue with transition.to() under the new graphics engine.  In my scenario, I have a group containing a number of object types, including a snapshot object.  On relatively rare occasions, the group would NOT appear when I transition the alpha for the group from 0 to 1.  I have a number (30) of these groups on screen at the same time, and most often all of them appear correctly.  However, if one is invisible, more than likely all of them will be invisible, but sometimes a few will appear, while others will be invisible.

I have confirmed via print statements that the group has property ‘.isVisible’ set to true, even although the group is sometimes not appearing. 

At first I thought it was a problem with overlapping transitions, as this could sometimes cause weird behavior.  But after trying to track down that possibility, I found that SOMETIMES, some of the parts of the snapshot would appear, while others would not.  (The objects that formed the snapshot are gone at this point)  This should never happen, and is not something I could do in code, at least anyway that I know of.  This ‘partial snapshot’ is much more rare than the entire group being invisible. 

If I force the groups to group.segment = .3, instead of 0, just before the transition, the problem becomes much more rare, happening 1 time in 100 instead of 1 time in 10.

I am using the ‘tag’ transition cancel feature just before this problem appears, and I am a little suspicious of it being related somehow.

Unfortunately, it would be pretty difficult to cut the offending code out to create a simpler fail case.

So, I am wondering who else has snapshots in their group, or maybe a transition tag cancel in the vicinity of this problem(?)

Hope this helps!

Has anyone noticed this happen with more regularity when using ‘fade’ or ‘crossFade’ transition effects?

@max84:

I am only using a ‘fade up’ transition… that is, a transition from a low alpha to an alpha of 1, over 300 milliseconds.

Has anybody filed a test case and bug report with a simple provable case? We’re going to need that before we can accurately investigate it.

Thanks,

Brent