Lighting and shadows demo

http://www.flowlab.io/game/play/899160

Made up a simple single-source lighting demo that can easily tweak gradient strength or light radius to achieve different kinds of lighting. RIght now it’s displaying the kind of lighting seen on the 2nd pic below. It uses interface objects that stay in place so you don’t have to cover your entire map with darkness objects, only everything within the initial starting screen space. Proximity detection wasn’t available for interface objects but you can extract x/y of the tracker object and filter the result to get the same effect.

The radius could also be changed to simulate your lantern running out of fuel, and the darkness itself could run on a timer to fade in/out during daytime if you had day/night cycles.

Here’s some screens showing different gradients.

Shadows demo

http://www.flowlab.io/game/play/902683

Here’s a demo using raycast to produce shadows. These shadow objects are always aimed to the player’s location, a hit means there is vision from its point to the player, so they are set to 0 alpha, and a miss means there is an obstruction from its point to the player, so they are set to 100 alpha. Right now they don’t follow or track the player’s location, for example if you left the location in the demo you would leave the shadows behind as well. The goal is to make them follow the player eventually and perhaps try combining with the gradient light above.

WASD for movement. You can press 1,2,3 to change the texture from lighter to darker shadows. The UP arrow key increases sight radius, DOWN decreases.

Very cool! This is a really interesting idea :slight_smile:

If @grazer ever created a hue/brightness/contrast slider behavior like RPGmaker2000 had, you could make very impressive dynamic lighting effects, for example, levels could be completely black and white, without having to make all new animations, or you could have night and day, or in a dark cave, walk up to a blue light, and the character hue changes more blue on proximity. This color slider could simply use number inputs for hex. For day, default, for sunset, red, for night, dark blue, for morning, bright blue. It would be the biggest update flowlab could get, besides background animations.

WHATTTTT

Wow

congratulations. for real

how you came up with this?
I have to study.

Sad thing is that stopped having math in school :frowning:

dude ;-;
damn. teach me senpai.

Even a few days ago I was thinking how to implement this. I had no idea how.
Now that you made it let me ask you something: Can you make it go black when it touches a wall
and make it cant pass trough?
that would be amazing.

and making this an example user friendly. Like easy to understand what makes what and what should I change to make it darker or lighitier or other shapes.

@PizelPizza

Now that you made it let me ask you something: Can you make it go black when it touches a wall and make it cant pass trough?
It's possible to have the darkness raycast to stop giving vision behind walls, basically if the dark's raycast successfully hits the player it means they can give vision, but not with interface objects in my demo. They don't actually follow the player's position around, instead are kind of pinned to the screen, so objects near the player actually wouldn't be anywhere near the darkness.

You would have to make nonsolid game objects that follow the player around filling the screen and use those to raycast to the player, it would be different but it shouldn’t be too hard.

and making this an example user friendly. Like easy to understand what makes what and what should I change to make it darker or lighitier or other shapes.
Here's some quick explanations of the behaviors: https://i.imgur.com/1oLfD9P.jpg You would just place the "Dark" objects in your initial camera starting screen like I did in the game example posted above

Thank you sooooooooooooooo much.

About the “that follow the player around filling the screen” that would lag, almost sure.

@Wizardry This really makes for an interesting effect. Nice idea.

Added to the first post above another demo for producing shadows with raycast, take a look!

Really nice work @Wizardry! Next up: Metal Gear :slight_smile:

That would pair very nicely to the whole line of site thing