Holiday Surprise: Camera Feeds as Textures, Real-Time Effects

Camera feed as texture in Corona
Share on Facebook0Share on Google+5Tweet about this on TwitterShare on LinkedIn0

Earlier in the year, we showed off a feature that teased developers with the ability to create shapes attached to the device’s camera feed.

Today, we’re happy to announce that this feature has been added to daily build 2013.2106 for iOS devices. This functionality will allow developers to use the camera feed as a texture, which means the texture can be placed under objects and overlays, on top of objects, within containers, or attached to box2d objects.

In addition, developers can also apply effects to the real-time camera feed, which results in some neat distortion of the environment.

We can’t wait to see what the community does with this!

To set the shape’s texture fill to the camera feed, it is as simple as defining the shape and setting the fill type to camera:

Setting the effect on the camera feed works the same way as setting an effect on existing fill types. For example, the sobel, and pixelate filter works on the camera feed in real-time to produce the final visual effect with the syntax below:

We’re adding two sample projects to our Github repository. One sample shows several fish overlayed on top of the video feed, with the ability to toggle filters. The second sample shows several box2d objects with the camera feed as the fill and different filter effects applied to each shape object.

The two sample projects are available here.

Since there are countless new ways to exercise this functionality, this feature should be treated as a beta feature. This feature works with most single-pass filters and is only available to Pro and above users.

See the video below for an example.

Happy Holidays!

Share on Facebook0Share on Google+5Tweet about this on TwitterShare on LinkedIn0
Bryan Smith

This entry has 39 replies

  1. Juf Jannie says:

    Will you be able to add custom video files instead of the camera feed? Alos will you be able to record the “texture” to a video file?
    It seems it is possible now to add a video file inside your app instead of the separate layer on top of everything it is now.

  2. Hey very nice feature! ! I loved! Thanks Corona Team! πŸ™‚

  3. Kerem says:

    Any idea how they captured this video of the app running on device?

    • alexf says:

      Kerem, i’m pretty sure it’s Reflector, and capturing the Mac stream with your video capture software of choice.


      • Kerem says:

        Thanks for your response. So I gather this API runs on the simulator as well using the built-in camera on the Mac. All the better.

        • Walter says:

          Right now, it’s only on iOS devices. The camera/GL texture binding is extremely platform-specific.

          • Kerem says:

            It is quite an achievement!!! So if the demo ran on an IOS device may I ask how the video of the demo was captured? I am interested in learning how to capture demos off the device but did not think it was possible to do this. Thanks for sharing.

          • Kerem says:

            Please ignore my question. Apparently AlexF had answered it all along. Just Googled Reflector IOS and I have my answer.

    • Ingemar says:

      I use Air Server ( for capturing the device.

  4. develphant says:

    Any chance Android will be supported in the future?

    • David says:

      That is the intention, but things on Android are usually tricker and take longer…

  5. Andrew Schisas says:

    Why always ios first when android is the future.. Never understand that but looking forward to have it available for android.

  6. What a sweet surprise! I’ve had way too much fun experimenting with this today. Thanks.

    Question: Is it possible to load the front (facetime) camera by default? This goes for regular old media.capturePhoto() as well.

  7. Andrew Schisas says:

    Hehe. No we arent gonna do that.. just going off the forums and facts hehe.. but in same regards, it is uite annoying how u guys always tease the android developers with things u can’t do.. why not hold back and release together? Just a question.

    • Juf Jannie says:

      Why should it be delayed for android? I sell Android and iPhone apps. This means I can already start making money and building the app at the iphone side. When android support comes I can just rebuild and upload to Android.
      And it isn’t Android vs Apple developers. if so you should have stayed at java stuff.
      My guess is people use corona cause they want both.
      It just means part of your sales model has to wait a bit.

      • Kerem says:

        Perfect answer! I absolutely agree!!!

  8. Mo says:


    Augmented Reality apps now a reality πŸ™‚


    ps: THANK YOU Corona!

  9. Andrew Schisas says:

    Hehe in no way was i sparking an android vs ios debate.. thank u kerem for posting an article from “apple insider”.. I wonder if there was an “android insider” if would still favour ios.. that would be funny if it didn’t.. wow u make a comment and u guys quick to gang up haha.. but thank u Juf for your comment, you made a very good point.. wished Kerem could have been able to answer but sometimes it takes an outsider to shine some light.. The whole suggestive insult to go back to java was not necessary though as I did state that it was just a question but am glad that you think it was a “perfect” comment insult and all Kerem, real professional buddy.. Apologies if my writing style has suggested to you that I wanna partake in a childish debate as honestly have better things to do with my time such as making apps with the great and fantastic Corona SDK.. Keep up the great work guys and I look forward to continue to watch Corona grow πŸ™‚ Peace guys

  10. Kerem says:

    Andrew, apologies if I caused any upset. Was not the intention at all. I would love to see more Android love as well. I have nothing against the platform and this thread is definitely not a good place to have a go at this anyways. Also note I do not work for or speak for Corona Labs. Not sure if there was a misunderstanding about this.

    Keep well and enjoy the holidays. All is good.

    • Andrew Schisas says:

      All sweet Kerem.. not a drama πŸ™‚ Have a Merry Xmas πŸ™‚

  11. Mark says:

    It will be nice to have video as texture too!

  12. Vasant says:

    Thanks for the great addition and a nice surprise.

    Can you choose which camera get used by this feature? (when devices have 2 cameras it seems to default to the main backside camera) Can you change the default camera to be front camera?

  13. Caleb says:

    I tried to run it in the simulator but it crashes immediately… any fix please? I’ve included the top portion of the error log.

    Process: Corona Simulator [12688]
    Path: /Applications/CoronaSDK/Corona Simulator
    Identifier: com.coronalabs.Corona_Simulator
    Version: 2013.2100 (2013.2100)
    Code Type: X86-64 (Native)
    Parent Process: Sublime Text 2 [8793]
    User ID: 502

    Date/Time: 2013-12-28 10:19:48.953 +1300
    OS Version: Mac OS X 10.8.5 (12F45)
    Report Version: 10

    Interval Since Last Report: 38953 sec
    Crashes Since Last Report: 7
    Per-App Interval Since Last Report: 27138 sec
    Per-App Crashes Since Last Report: 7
    Anonymous UUID: 50F9A7F7-8914-E9FD-18BE-F46B067622D6

    Crashed Thread: 0 Dispatch queue:

    Exception Type: EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

    VM Regions Near 0:
    __TEXT 000000010f57a000-000000010f780000 [ 2072K] r-x/rwx SM=COW /Applications/CoronaSDK/Corona Simulator

    Thread 0 Crashed:: Dispatch queue:
    0 com.coronalabs.Corona_Simulator 0x000000010f5cc8a3 Rtt::GLCommandBuffer::Execute(bool) + 177
    1 com.coronalabs.Corona_Simulator 0x000000010f5d1737 Rtt::Renderer::Render() + 63
    2 com.coronalabs.Corona_Simulator 0x000000010f6391d1 0x10f57a000 + 782801
    3 com.coronalabs.Corona_Simulator 0x000000010f6148e7 0x10f57a000 + 633063

    • David says:

      Caleb, looks like this is because you are using build 2100. This feature was introduced in 2106, so you need that build (or later) to have this work.

  14. Fredrik says:

    okey, so lets say i wanted to make a camera app. would it be possible to make on with this new graphics engine? lets say i show this feed in a texture, and then i want to use a button to capture a photo. exactly how would you do that?

    • Fredrik, same need here I wanted to use this camera texture as a photo preview and allow the user to capture it. I think it’s not possible for now. So our app needs to open the camera native UI to capture the photo which break the user experience. Sad. I’m sad it’s iOS only too. This kind of feature looks more like alpha feature than real feature. Not mentioning that when I tested it, the texture was not refreshing. Definitely an alpha level…

      • I just did a method while the my background display object was the camera feed and it captured it. I know it’s not going to be the full resolution of the camera, but it’s a start.

  15. Josep Alemany Fruitos says:

    Any news about the Android version? we need it portable as soon as possible… Thanks!

  16. I’m interested too about Android version of Camera Feeds as Texture. We need it asap, in order to decided to use Corona SDK or go native.. Thanks!

  17. Any updates on Android support for live camera feeds as textures given it has been five months?

    Just checking and Thanks!

  18. Bryan says:

    We have added front facing camera support in, please see the Camera Source section in the following documentation:

    • Kongkiat Hirankerd says:

      can this code support android? so I try to use the camera example in corona and build for android it ask for open the other camera app. When corona can support the camera for android? Thank you^^

      • Rob Miracle says:

        We will not be adding Android support for this. We are accessing the camera hardware directly and on Android it’s too different on the various OS, Carrier, Hardware vendor, Camera maker combinations to be able to code for them all.

  19. Abhay Amin says:

    Hey is this support for Android released yet ? Thankyou…

  20. Nicholas says:

    Hi, I hope this awesome effect can support Android device. I think there are many developers are waiting for this effect to support android.

  21. KO says:

    Does this feature support Android devices now?

    • Rob Miracle says:

      No. There are too many technical hurdles to overcome with this on Android.