Dynamic Shadows "engine" for C2

  • Hi everyone,

    I did some shadow casting tests. I don't know if there's better ways to do this with some plugins.

    <img src="https://dl.dropboxusercontent.com/u/53898431/Junk/LightCastingTest/LightEngineScreenshot_2.jpg" border="0">

    Drag lights and objects around with your mouse. Add lamps with mouse middle, delete with mouse right and when you are ready to calculate the shadows, hit enter and wait until it's done. To reset everything hit spacebar.

    In this version light sources are casting light. Try to create walls to see how it works.

    LightCasting

    This one is using opposite method and is a bit heavier to calculate.

    ShadowCasting

    This one is casting realtime dynamic shadows. I made it really light and the cool thing is that it also works without WebGL. It should run around 60FPS.

    DynamicShadowCasting

    This one is a bit experimental Ambien occlusion for 2D.

    AmbienOcclusion

    Let me know what you think...

  • Interesting! /just need realtime shadows :)

  • AnD4D

    Thanks for the idea.

    DynamicShadowCasting

    This one is casting realtime dynamic shadows. I made it really light and the cool thing is that it also works without WebGL. It should run around 60FPS.

  • What on Earth!!!? That's brilliant! How did you do that? Is it a lot of events?

  • AnD4D

    It's just 7 events.

  • Well it's a job well done indeed! It should also work on mobile, I bet!

  • The dynamic shadow casting works very nicely on my ipad3. Gets between 20-30 fps, but its really nice to see what can be achieved without webgl. Very nicely done!

  • nemo - that's pretty cool. I really liked the dynamic demo.

  • This looks really nice!

  • This is really cool. I've just posted my experiments in lighting with C2 here: scirra.com/FORUM/topic67369.html. Apologies if that just shows the URL and not a link you can click, I have BBcodes enabled but it doesn't seem to be working for me (no idea what I'm doing wrong as it previews perfectly).

    I'm very impressed that you're doing the effect in just 7 events, I'm obviously doing it the hard way as mine are a lot more than that. Good work <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Thank you for all this nice feedback. I made one more test. This time with fairly simple 2D Ambient occlusion. It could be handy for creating some depth to levels. I tried to follow what I've learned from Ambient occlusion in 3D. As with the other examples it uses snapshot to create picture file that is then loaded to the scene. AmbienOcclusion

    AdamD

    Good job with your experiments. You have lot of details on the shadow behaviours.

  • AdamD

    That's great! How many events is this?

  • How did you do the Dynamic Shadows? Would you be up for sharing the capx?

  • How did you do the Dynamic Shadows? Would you be up for sharing the capx?

    If not for the capx, any hint how you did it with such light CPU usage ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • CrudeMik Guizmus

    It's just a really simple trick. I create 60-100 sprites that are looking like flashlight beams and set their angles to random(360) and random lenght. They are created on one layer that is set to be transparent. Now how to create the illusion of shadows being cast? Every time one of these light beams touch a wall, it will get disabled and your game don't need to draw it. So actually the more obstacles there is the faster your game should run due to less drawing to be made. The more beams you create the more realistic it will look. There's lot of tricky adjustments to be made. This is a good trick because you can have multiple light sources and you can adjust the amount of beams created and make it run also on slower systems.

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