I don’t know if this would be the recommended or ideal way but you could probably achieve what you want with snapshots. Put everything you want into a snapshot, refresh it, apply the filter and stick it behind the window. Ive done something similar (albeit in reverse) in my racey game demo where only the foreground is blurred, and it alohas correctly over the background
I just really feel that if layered effects are going to operate properly, one display group with an effect applied should apply to everything below it. Either that or effects should be able to be applied to a group, which they can’t right now. I would prefer the former as it would be significantly more powerful and just as easy.
I am very much against taking screenshots of display groups repeatedly - I can’t think of anything which would cause more performance problems.
I sort of agree, but given the nature of groups (doesn’t have boundaries, is simply the sum of its children so to speak) I can understand the difference.
Do you know off the top of your head if you can apply filters to containers? They have boundaries built in so would be a much better candidate (because the extra overhead of snapshots and the complexity even if it is just :invalidate() means it isn’t what people are going to expect).
If filters work for containers, you could just swap your newGroup() for newContainer( display.contentWidth, display.contentHeight) and, fingers crossed, it should be the same.
I find snapshots are a wonderful addition - the fine control they give you for rendering is awesome (and how they let you apply filters in layers etc) but I can definitely see that they aren’t the ‘logical’ choice for what most people are going to want to do, and part of the selling point of Corona is ease of use, so I’m all for making stuff more grokable.
I think where groups may run into problems though, is that filters work off the origin of the container. Now if you use a group, and the group is large and is scrolled, you are going to get some odd and unexpected effects because you are so far away from the origin, which again is not what people are likely to expect.
I think we need Corona guys to chip in here, as it boils down to how they expect people to use these features.
BTW I should point out that although snapshots do have a ‘cost’ it isn’t as much as you’d think.
In theory the time to update a snapshot with :invalidate() is almost the same as that needed for just drawing the individual objects on the display. Then the screen refresh hit is the same as any other image of the same resolution and size on-screen. In particular if you don’t update the objects in a snapshot frequently, snapshots work out quicker as again, you are just manipulating a single image instead of all the nested objects.
Is it as simple as this? Of course not, so it does have a larger penalty than the ideal case I outlined above. How much is this? No clue to be honest, perhaps Corona can chip in again with a rough idea?
But I can say that I am using a fullscreen snapshot for a demo, updating it each frame, and it more than happily runs at 60 fps.
I’m itching to see how android handles it, but of course we don’t have android build capability yet and as usual I expect more problems from android due to fragmented OS and wildly differing hardware specs.
My main concerns:
Achieving Where’s my Water effects with polygons
Applying effects to layers, not just directly to vector objs
My wish list:
Using vector objects with a filter (or cumulative filters) applied as a definition for applying a filter to a group, a template or filter definition for another object, if you will.
Yes, need the Corona team’s input here…
Imagine if you could define a path polygon, apply filters to it and then use it to say to a group “apply these filters to all your content which intersects the polygon.”
Is there a way to create a mask from a vector shape? I have to be honest, I’ve never used either
I don’t think so.
I’ve got my content in a display group already. What I want is for the content of this group to make the group behind it look watery (wobbly and blu’ish) - could you explain how that might be done with a snapshot, please?
I’m unclear as to how to use snapshots. Do I add content to a group and/or the snapshot? Is the snapshot centred at 0,0 by default or do I need to move it after I create it, like a regular display object? Etc.
Something like this?
http://www.coronalabs.com/blog/2013/09/20/graphics-ios-7-translucent-glass-effect/
I don’t know if this would be the recommended or ideal way but you could probably achieve what you want with snapshots. Put everything you want into a snapshot, refresh it, apply the filter and stick it behind the window. Ive done something similar (albeit in reverse) in my racey game demo where only the foreground is blurred, and it alohas correctly over the background
I just really feel that if layered effects are going to operate properly, one display group with an effect applied should apply to everything below it. Either that or effects should be able to be applied to a group, which they can’t right now. I would prefer the former as it would be significantly more powerful and just as easy.
I am very much against taking screenshots of display groups repeatedly - I can’t think of anything which would cause more performance problems.
I sort of agree, but given the nature of groups (doesn’t have boundaries, is simply the sum of its children so to speak) I can understand the difference.
Do you know off the top of your head if you can apply filters to containers? They have boundaries built in so would be a much better candidate (because the extra overhead of snapshots and the complexity even if it is just :invalidate() means it isn’t what people are going to expect).
If filters work for containers, you could just swap your newGroup() for newContainer( display.contentWidth, display.contentHeight) and, fingers crossed, it should be the same.
I find snapshots are a wonderful addition - the fine control they give you for rendering is awesome (and how they let you apply filters in layers etc) but I can definitely see that they aren’t the ‘logical’ choice for what most people are going to want to do, and part of the selling point of Corona is ease of use, so I’m all for making stuff more grokable.
I think where groups may run into problems though, is that filters work off the origin of the container. Now if you use a group, and the group is large and is scrolled, you are going to get some odd and unexpected effects because you are so far away from the origin, which again is not what people are likely to expect.
I think we need Corona guys to chip in here, as it boils down to how they expect people to use these features.
BTW I should point out that although snapshots do have a ‘cost’ it isn’t as much as you’d think.
In theory the time to update a snapshot with :invalidate() is almost the same as that needed for just drawing the individual objects on the display. Then the screen refresh hit is the same as any other image of the same resolution and size on-screen. In particular if you don’t update the objects in a snapshot frequently, snapshots work out quicker as again, you are just manipulating a single image instead of all the nested objects.
Is it as simple as this? Of course not, so it does have a larger penalty than the ideal case I outlined above. How much is this? No clue to be honest, perhaps Corona can chip in again with a rough idea?
But I can say that I am using a fullscreen snapshot for a demo, updating it each frame, and it more than happily runs at 60 fps.
I’m itching to see how android handles it, but of course we don’t have android build capability yet and as usual I expect more problems from android due to fragmented OS and wildly differing hardware specs.
My main concerns:
Achieving Where’s my Water effects with polygons
Applying effects to layers, not just directly to vector objs
My wish list:
Using vector objects with a filter (or cumulative filters) applied as a definition for applying a filter to a group, a template or filter definition for another object, if you will.
Yes, need the Corona team’s input here…
Imagine if you could define a path polygon, apply filters to it and then use it to say to a group “apply these filters to all your content which intersects the polygon.”
Is there a way to create a mask from a vector shape? I have to be honest, I’ve never used either
I don’t think so.
I’ve got my content in a display group already. What I want is for the content of this group to make the group behind it look watery (wobbly and blu’ish) - could you explain how that might be done with a snapshot, please?
I’m unclear as to how to use snapshots. Do I add content to a group and/or the snapshot? Is the snapshot centred at 0,0 by default or do I need to move it after I create it, like a regular display object? Etc.
Something like this?
http://www.coronalabs.com/blog/2013/09/20/graphics-ios-7-translucent-glass-effect/