How to make a light's glow fall upon objects that are near?

This forum is currently in read-only mode.
From the Asset Store
5 glow creatures with size, shape and color variations.
  • Good day,

    I would like to ask how I could go about in making a particular light's glow fall upon objects that are near it, as visualized in the image below:

    <img src="http://www.accidentalrebel.com/arblog/wp-content/uploads/2010/12/question1.jpg">

    Flesh: Box (The object that the light will fall upon) - Green: Light source.

    As you can see, as the box goes near the light source, the box is slowly illuminated with a glow coming from the neon green light. Take note that the glow should only fall on objects near it, and nowhere else. The background should have no glow as well.

    I'm not really sure how I should proceed with this so I am hoping if you guys could give me a basic idea on how to do it.

    ====================================================================

    Here's the idea I've come up with but I'm not sure how to do it:

    <img src="http://www.accidentalrebel.com/arblog/wp-content/uploads/2010/12/solutiongradient.jpg">

    I'm gonna make use of a green gradient that will serve as the glowing light from the light source.

    The part of the gradient where it overlaps with the box object will be the only one that will be shown. The rest are not displayed on screen.

    Any ideas on how to implement this? Or if you have a better method, please share it!

    ====================================================================

    Looking forward to your replies. Thanks!

  • I would try the gradient object. In your example you would place a gradient on top of all other objects (most likely its own seperate layer). Make it cover the wished light's area. Set the color close to the light source to some opacity and the second color to 0% opacity.

  • HI there, thanks for the quick reply.

    I think I forgot to mention that the background should not have a glow. If I understand your suggestion correctly, I believe that it isn't the solution I'm looking for. Still I'll give it a try I might find or learn something new.

    I've edited the diagram on my first post.

    CHeers!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You're right, if you don't want the background to glow (although it would be unrealistic )

    Do you know about my effect "Gradients"? http://www.scirra.com/forum/viewtopic.php?f=29&t=7674

    Maybe it is more of help.

  • Haha. Well, the reason why I don't want the background to glow because it is far from both the light source and the box.

    Thank you for your link. Will need to check it out. We shall see if this answers my problem.

    Thank you for taking the time to help! Much appreciated.

  • HI tulamide. You're Gradient effects add on was really cool. However, seeing that the gradient only stays on the object at all times, I'm not sure if it was the solution I was looking for (Unless that is I missed something).

    I have updated my first post with an idea on how I could implement it. Maybe you have a suggestion on how to do it?

    Again, thank you.

  • So here's a solution that kind of does what you want, I would consider it less than elegant though:

    http://dl.dropbox.com/u/2306601/abomination.cap

    You can drag around the small light boxes with the mouse.

    If you were to have just one single light source, I'd say to use the heightmap plus effect. But that's most likely not the case, is it?!

  • Hi PixelRebirth.

    Yep, your method works! I struggled to understand the concept per line, but I get the basic idea. I have edited the code a bit so that the blockshine would follow the blocks if you move them around.

    I might use this on the game I'm working on. But I am still open to other methods if there are any.

    Thanks a lot! Cheers!

  • There's some plugin lying around that shviller made, which if i recall properly draws an image only over opaque areas in a base texture when applied to the object you would use as a "light" and used in conjunction with "force own texture" on the layer the light and object are on. It's called "draw over real"

    http://dl.dropbox.com/u/1010927/Draw%20Over%20Real.fx

    place it in your construct fx folder

  • Quazi, the Gradients.fx also behaves this way, as can be seen here:

    But I really like PixelRebirth's solution. Elegant and not too processor expensive.

    EDIT: Namre, I think you didn't use it to your advantage. Don't add the effect to one of the objects, but to the layer that contains the objects. Of course, there is still missing a "center"- option, to define the position of the light source, but that's no big deal to implement. However, I repeat that Pixel's solution is probably the best.

  • Hi Tulamide. Yeah, I wasn't that sure on how to use it properly. Haha.

    Again, thanks to PixelRebith and to all who helped. ;D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)