attach light to char\obj, darken everything else

0 favourites
  • 8 posts
From the Asset Store
Ninja char for your game! Make your own Shinobi game with this art.
  • 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.

  • 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.

  • 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 ...

  • 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

    <img src="http://fexlabs.com/drops/pixel_shading.gif" border="0" />

    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.

  • 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 :( )

  • 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!

  • 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 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Check these threads for something that might fit your purposes (or not): Check me

    And me

    Search is your friend. :)

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