attach light to char\obj, darken everything else

Get help using Construct 2

Post » Fri Mar 01, 2013 8:18 pm

I would like to attach dynamic light source to character (sort of flashlight, but circle-shaped) and several lights, that casts dynamic shadows of all visible sprites on same layer (or few of selected if needed) and interacts with bump maps of all layers (makes them bumpy and glossy according to direction of light, just like in DOOM 3), and i want to make everything else (thats far away of lighting source) darkned.

The point is - i want to make stealth game with character in complete darkness, and with destructible light sources and some portable light that can be toggled on\off and with smooth fading between lighting and darkness and relatively correct light and shadow distribution.

If that possible to do? How? Any ready to use shaders out there? Any step by step tutorials where and what should i set in C2 to at least attach light to character\object and darken everything around?
Please, help me out, im totally new in C2, just learned basic platformed techniques for c2, but i need to move on to more advanced part asap and make this lighting for game, because its a key point of gameplay.
B
4
S
1
Posts: 5
Reputation: 616

Post » Fri Mar 01, 2013 8:24 pm

http://www.scirra.com/forum/effect-2d-dynamic-lighting_topic59130.html for the normal mapping of 2d sprites.

Also, check out the lighting capx that comes with construct2d. It's in the examples subfolder.
B
6
S
1
G
1
Posts: 70
Reputation: 702

Post » Fri Mar 01, 2013 8:29 pm

This would be possible , but not for you for the moment ( I'm sure you don't want to enter a math conundrum just for lighting ) Better wait for a plugin ...
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Fri Mar 01, 2013 9:29 pm

Wow, thanks interesting thread, but its only about bump mapping, as i understood that guy never published shader with shadows :-(

What i need to acomplish is something almos like you can see on this GIF


but with dynamic shadows as well and not in top-down view perspective.
Imagine Another World or Heart of Darkness with lighting like this and you will get idea of how it should look like and what i need.v00d00m4n2013-03-01 21:32:03
B
4
S
1
Posts: 5
Reputation: 616

Post » Fri Mar 01, 2013 9:48 pm

I told you that without some steel C2 knowledge , you'll never be able to get that one perfect and I can imagine that you are new to C2 ... Briefly , you won't get that with C2 easy-to-use interface , you'll need some mathematical algorithm and that's not for you ... ( Not even for me :( )Whiteclaws2013-03-01 21:49:53
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Fri Mar 01, 2013 11:39 pm

So that gif you posted looks like it shows a normal map attached to a sprite with an additional height map for occlusion. Imagine, if you are the artist, creating a normal and occlusion map for every single frame. That will be a huge timesink, even after/if you find a technical solution.

For the shadows, you will be forced to raytrace to create some dynamic shadows. Good luck!


B
6
S
1
G
1
Posts: 70
Reputation: 702

Post » Sat Mar 02, 2013 9:29 am

well, thanks to your help, at least part of what i want is already done:

Bump mapping and simple flashlight in darkness, now i only need some real dynamic light with shadows, im pretty sure someone already have the solution and i hope that someone can share it.

Also while i was messing with Bump mapping, i discovered really frustrating bug with Node-webkit exporter:

Notticed that bump mapping effect that looks and works fine in Chrome and Maxthon does not work at all in exported Node-webkit wrapper and instead texture looks just as flat as without bumpmapping.

Tried to update Constuct 2 bundled version to latest version from site - aint worked.

Tried to put DX9 43 dlls into folder - aint worked.

Tried to put arguments --enable-webgl --ignore-gpu-blacklist to package.json - aint worked.
(full arg line, if this might help is this:
--disable-extensions --disable-plugins --disable-internal-flash --disable-popup-blocking --disable-software-rasterizer --enable-gamepad --enable-html5-camera --allow-file-access-from-files --enable-webgl --ignore-gpu-blacklist
)
Tried http://get.webgl.org/ in clearn node-webkit, however it shows cube and same results as Chrome and Maxthon browsers, so that means WebGL enabled but doesnt work right or not fully featured in Node-webkit.

Also tried to get WebGL libs from Maxthon and Chrome and replace node-webkit shipped libs with them - aint worked as well.

Googled a little and found more reports like this, which state that "WebGL looks ugly in node-webkit comparing to Chrome and other browsers".

Is there a way to use older Awesomium wrapper instead of node-webkit, which have broken WebGL support?

Ah, i think i should create new thread about this issue.
B
4
S
1
Posts: 5
Reputation: 616

Post » Sat Mar 02, 2013 11:21 am

Check these threads for something that might fit your purposes (or not): Check me
And me

Search is your friend. :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 25 guests