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

For questions about using Classic.

Post » Tue Dec 28, 2010 5:46 pm

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:


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:


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!
B
3
S
1
G
2
Posts: 86
Reputation: 997

Post » Tue Dec 28, 2010 6:34 pm

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.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Tue Dec 28, 2010 6:44 pm

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. :D Still I'll give it a try I might find or learn something new.

I've edited the diagram on my first post.

CHeers!
B
3
S
1
G
2
Posts: 86
Reputation: 997

Post » Tue Dec 28, 2010 7:11 pm

You're right, if you don't want the background to glow (although it would be unrealistic ;) )

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

Maybe it is more of help.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Tue Dec 28, 2010 7:39 pm

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

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

Thank you for taking the time to help! Much appreciated.
B
3
S
1
G
2
Posts: 86
Reputation: 997

Post » Tue Dec 28, 2010 8:20 pm

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. :D
B
3
S
1
G
2
Posts: 86
Reputation: 997

Post » Tue Dec 28, 2010 10:40 pm

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

[url:fl47m0me]http://dl.dropbox.com/u/2306601/abomination.cap[/url:fl47m0me]

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?!
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Wed Dec 29, 2010 1:51 am

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!
B
3
S
1
G
2
Posts: 86
Reputation: 997

Post » Wed Dec 29, 2010 5:05 am

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
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Wed Dec 29, 2010 7:34 am

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.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests