A Fuse Powered Company

Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Is it possible to do Flashlight & X-Ray Samples without the use of a mask?
Started by ksan Jul 01 2014 09:22 PM

6 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Pro
  • PipPipPipPipPipPip
  • 2,780 posts
  • Jedi

Hi, 

 

The Flashlight and X-Ray sample projects from Corona Labs go back a while. They were there way before the introduction of G2. They both make use of a mask file to create a visible circle of an underlying image. See below : 

local mask = graphics.newMask( "circlemask.png" )
image:setMask( mask )

I am trying to achieve the same experience but without the use of a mask file. Would anyone have an idea on how this can be achieved using the new G2 capabilities?

 

Thanks much for your kind help. Regards,

Kerem



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 10,739 posts
  • Jedi

I don't know that G2 really addresses anything like that.  Masks still have a purpose and that's one of them.

 

Rob



[TOPIC: post.html]
#3

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Pro
  • PipPipPipPipPipPip
  • 2,780 posts
  • Jedi

Hi Rob, 

 

Thanks for your kind response. I'd like to see if we can figure out a way to get away from using a mask file if at all possible. Catering for various screen size & geometries become so much easier when you don't have to rely on a fixed size / shape mask file. Any guess as to how we could go about this? 

 

Thanks,

Kerem



[TOPIC: post.html]
#4

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Enterprise
  • PipPipPipPipPipPip
  • 761 posts
  • Jedi

@Kerem,

 

Take a look at the wonderful videos (with code) here: http://forums.coronalabs.com/topic/41510-2-demos-for-the-contest/

 

I haven't done it yet, but on my future list is to examine the multi-light demo shown and to modularize it if possible.  I want to use this effect in my games and Iván Juárez was kind enough to release the code for both demos.

 

I've played with the light demo and it is possible to change the light colors, intensity, and number of objects/lights in the scene.  Its not perfect, but it is very promising and a wonderful piece of code.



[TOPIC: post.html]
#5

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Pro
  • PipPipPipPipPipPip
  • 2,780 posts
  • Jedi

Hey Ed, Thanks so much for the link tot the videos. They are indeed amazing. Will review code and see if I can make some sense out of it as soon as possible. Dealing with a crashed Mac sadly but will get on this ASAP. Regards, Kerem

[TOPIC: post.html]
#6

jandjstudiosllc

[GLOBAL: userInfoPane.html]
jandjstudiosllc
  • Basic
  • PipPipPipPipPipPip
  • 55 posts
  • Jedi

Check out the iris filter.  That may do what you want.  I just tried overlaying a black rectangle on a sky background then applied this filter to the rectangle.  Here's the result: 

 

http://docs.coronalabs.com/guide/graphics/effects.html#filter.iris

 

 

 

  

Attached Files



[TOPIC: post.html]
#7

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Pro
  • PipPipPipPipPipPip
  • 2,780 posts
  • Jedi

Great! That just might do the trick. Thanks much for the headsup. 




[topic_controls]
[/topic_controls]