Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

[FIXED] Graphics 2.0 Display Object Transparency Issue
Started by andy061 Dec 11 2013 06:00 AM

28 replies to this topic
graphics 2.0 transparency alpha display object
[TOPIC CONTROLS]
Page 1 of 2 1 2
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

andy061

[GLOBAL: userInfoPane.html]
andy061
  • Observer

  • 9 posts
  • Corona SDK

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 :)



[TOPIC: post.html]
#2

max84

[GLOBAL: userInfoPane.html]
max84
  • Enthusiast

  • 37 posts
  • Corona SDK

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.



[TOPIC: post.html]
#3

andy061

[GLOBAL: userInfoPane.html]
andy061
  • Observer

  • 9 posts
  • Corona SDK

@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 :)



[TOPIC: post.html]
#4

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

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.



[TOPIC: post.html]
#5

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Contributor

  • 716 posts
  • Enterprise

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.  :(

 

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



[TOPIC: post.html]
#6

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

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



[TOPIC: post.html]
#7

max84

[GLOBAL: userInfoPane.html]
max84
  • Enthusiast

  • 37 posts
  • Corona SDK

@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.



[TOPIC: post.html]
#8

jonjonsson

[GLOBAL: userInfoPane.html]
jonjonsson
  • Corona Geek

  • 1,051 posts
  • Corona SDK

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."

 

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})



[TOPIC: post.html]
#9

Anderoth

[GLOBAL: userInfoPane.html]
Anderoth
  • Contributor

  • 278 posts
  • Corona SDK

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.



[TOPIC: post.html]
#10

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Contributor

  • 716 posts
  • Enterprise

@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.



[TOPIC: post.html]
#11

max84

[GLOBAL: userInfoPane.html]
max84
  • Enthusiast

  • 37 posts
  • Corona SDK

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.



[TOPIC: post.html]
#12

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

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.



[TOPIC: post.html]
#13

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

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



[TOPIC: post.html]
#14

jonjonsson

[GLOBAL: userInfoPane.html]
jonjonsson
  • Corona Geek

  • 1,051 posts
  • Corona SDK

@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.



[TOPIC: post.html]
#15

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

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.



[TOPIC: post.html]
#16

andy061

[GLOBAL: userInfoPane.html]
andy061
  • Observer

  • 9 posts
  • Corona SDK

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)



[TOPIC: post.html]
#17

cosmic1953

[GLOBAL: userInfoPane.html]
cosmic1953
  • Enthusiast

  • 55 posts
  • Corona SDK

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!



[TOPIC: post.html]
#18

max84

[GLOBAL: userInfoPane.html]
max84
  • Enthusiast

  • 37 posts
  • Corona SDK

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



[TOPIC: post.html]
#19

cosmic1953

[GLOBAL: userInfoPane.html]
cosmic1953
  • Enthusiast

  • 55 posts
  • Corona SDK

@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.



[TOPIC: post.html]
#20

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

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



[TOPIC: post.html]
#21

Stephen Lewis

[GLOBAL: userInfoPane.html]
Stephen Lewis
  • Contributor

  • 716 posts
  • Enterprise

@Brent  -- Was jonjonsson's bug not sufficient?



[TOPIC: post.html]
#22

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

What is the number on that bug report? I can't seem to locate it in our database (or perhaps I'm searching for the wrong query).

 

Brent



[TOPIC: post.html]
#23

jonjonsson

[GLOBAL: userInfoPane.html]
jonjonsson
  • Corona Geek

  • 1,051 posts
  • Corona SDK

What is the number on that bug report? I can't seem to locate it in our database (or perhaps I'm searching for the wrong query).

 

Brent

 

It is 28784.



[TOPIC: post.html]
#24

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

I'm not sure, but can this be a clue to why it's happening?

 

If you run this code, you'll see that the last iteration of a transition is never called ( t never becomes tMax ):

local rect = display.newRect(0, 0, 100, 100)
rect:setFillColor(1, 1, 1, 1)
rect.x = display.contentCenterX - 100
rect.y = 50

local rect1 = display.newRect(0, 0, 100, 100)
rect1:setFillColor(1, 1, 1, 1)
rect1.x = display.contentCenterX + 100
rect1.y = 50

local function transitionF(t, tMax, start, delta)
    print(t, tMax, start, delta)
    local cy = start + delta * t / tMax
    rect1.y = cy
    return cy
end

transition.to(rect, {time = 200, y = 300, transition = transitionF})

 

Console output:

2013-12-14 15:31:38.651 Corona Simulator[19283:507] 0.066000000000003   200 50  250
2013-12-14 15:31:38.667 Corona Simulator[19283:507] 15.884  200 50  250
2013-12-14 15:31:38.686 Corona Simulator[19283:507] 34.942  200 50  250
2013-12-14 15:31:38.713 Corona Simulator[19283:507] 62.658  200 50  250
2013-12-14 15:31:38.727 Corona Simulator[19283:507] 76.281  200 50  250
2013-12-14 15:31:38.743 Corona Simulator[19283:507] 92.605  200 50  250
2013-12-14 15:31:38.759 Corona Simulator[19283:507] 108.819 200 50  250
2013-12-14 15:31:38.776 Corona Simulator[19283:507] 125.142 200 50  250
2013-12-14 15:31:38.792 Corona Simulator[19283:507] 141.021 200 50  250
2013-12-14 15:31:38.808 Corona Simulator[19283:507] 157.038 200 50  250
2013-12-14 15:31:38.824 Corona Simulator[19283:507] 172.871 200 50  250
2013-12-14 15:31:38.839 Corona Simulator[19283:507] 188.705 200 50  250


[TOPIC: post.html]
#25

jacques1

[GLOBAL: userInfoPane.html]
jacques1
  • Contributor

  • 318 posts
  • Corona SDK

Seems to be a bug in the latest build as previous build I didn't have this issue. Mine is a bit different. I set an object alpha to 0 just before creating another different named object then doing a transition movement with that, but the first object alpha remains as 1 visually.




[topic_controls]
Page 1 of 2 1 2
 
[/topic_controls]