[Tutorial] A real dynamic light system

  • spy84 - I agree - I find c2's event system more intuitive to use. I just want c2 to be the best tool to use, both logically in its event system and also visually in how it appears to the dev.

  • To be honest, I don’t really get how those nested layers could work with lighting, I’m not familiar with the term (I guess they are something like layers within a group like in Photoshop?)

    You are correct, nested means "layer within layer" basically.

    But for lighting it's a cumbersome solution compared to just screening all the lights in just one black opaque layer which is multiplied on the background.

    When I do graphics-related compositing I use nested systems all the time, but I can't really think of many uses for nested layers really. The only situation I can think of is when you have several separated objects you need to blend as one, such as screening together two objects and them blend the result with something else. I still feel it's a completely redundant solution to the lighting system. It's not very intuitive.

    I hope I don't sound too negative here, I enjoy C2 a lot. But you want your tool to work intuitively, and for the lighting blending I see no more intuitive way than how you visualize it in your mockup.

    The only thing I feel is missing from your video is a clarification how the Shadow Light object is blended with underlying objects.

    Currently it looks like it's using alpha channel to achieve the shadowing effect. I think Ashley mentioned this can limit the user freedom how the Shadow Light object effects your scene, and I agree. Like if you change the blending mode on the Shadow Light, the alpha of the object will screw up the blending effect.

    If the Shadow Light object is opaque as default, the user have the freedom to choose which blending is the most suitable.

    • Have only one light source? Multiply the Shadow Light. Can be done on the same layer as your other objects as long as the Z order is correct.

    • Have multiple light sources? Screen them together in a layer that is multiplied on your other layers.

    Or just go crazy with any of the other blending modes.

    That's the most intuitive and flexible lighting solution I can think of concerning the blending.

  • PieceMaker ,

    Thank you for explaining me nested layers! I can think of some uses, especially for masking purposes, or for applying effects targeting multiple layers. Still, the problem with "Layers" in general is that they stack on top of each other, no matter what, so they are bound to have "ordering" limitations.

    Let's say, for example, you have 3 layers stacked/nested together. You can manipulate them just fine, however, what will happen if you have one separate layer on top, outside the nested group (a 4rth layer), and another layer on top of that (a 5fth layer) that also needs to behave as nested with the first 3 layers for some reason..?

    I stumble with this problem all the time with After effects, where I want to precompose some layers that are spread within the hierarchy (have other layers in between) and it simply doesn't work. I have to resolve to several copies and procompositions. The same happen when masking with "track mattes", I have to duplicate the matte layer for each other layer I want to mask in/out.

    This is where I think that the vertical workflow of the layer basted system is very restricting, while a non-linear, node based one has very advantages, especially when reusing the same nodes.

    But enough with the After Effects analogy-rant! Unless it's time to re-introduce the request for a timeline within Construct, in that case, I will continue referencing AE, perhaps even Flash

    As for the lighting method I propose, well, I left this vague on purpose, because I don't really know how it should work ! It will depend on the technology that will be used for the Lighting system, I am sure it has to be something more complicated than drawing and overlaying some shaded polygons, since it will have to respect multiple light sources that in return should interact with other light's shadows. And it should be fast! I'm thinking that you should be able to lit an entire level just with lights!

    I have no idea what libraries can do that, so I don't know how they will work, blend together or whatever they might have to do. What I wanted to depict is the workflow and how lights should affect other light's shadows and bump-mapping, with just a few clicks.

  • As for the lighting method I propose, well, I left this vague on purpose, because I don't really know how it should work ! It will depend on the technology that will be used for the Lighting system, I am sure it has to be something more complicated than drawing and overlaying some shaded polygons, since it will have to respect multiple light sources that in return should interact with other light's shadows. And it should be fast! I'm thinking that you should be able to lit an entire level just with lights!

    I have no idea what libraries can do that, so I don't know how they will work, blend together or whatever they might have to do. What I wanted to depict is the workflow and how lights should affect other light's shadows and bump-mapping, with just a few clicks.

    Well, in my mind blending modes gives the user freedom whether the individual Shadow Lights should be screened or added (dodged), hence why the user should be able to turn the Shadow Light effect opaque.

    With the tests I have made I reached the conclusion that screening individual lights looks best, since (I think) we're dealing with 8-bit rendering here. In the real world, light is additive, but that would require a floating point rendering rather than 8 or 16-bit colour depth. Floating colour for this kind of engine is way overkill, so I don't feel it is necessary. And Add-blending tends to create ugly blobs when two light sources are mixed together. Yet the user should have the freedom to choose what to make of the effect.

    This is a gif of the simple test I did with the lighting.

    imgur.com/Mojlpsn

    It is created with the same methods described by Ashley in the lighting tutorial. Although I am stuck with a limited number of lights, this is four dynamic lights with the demo running smoothly. I think this principle can hold at least ten lights at once on my regular laptop, I haven't tested it though, but using blending modes feels quite fast. And since I have a background in compositing, using blending modes for lighting feels very logical.

    I am no programmer though, so I really don't know if it's more efficient to blend these lights using alpha channel.

    But I do agree that AE's layer system provides both goods and bads. It's fast, but the flow of things are restricted by the layer order.

  • > As for the lighting method I propose, well, I left this vague on purpose, because I don't really know how it should work <img src="{SMILIES_PATH}/icon_e_surprised.gif" alt=":o" title="Surprised"> ! It will depend on the technology that will be used for the Lighting system, I am sure it has to be something more complicated than drawing and overlaying some shaded polygons, since it will have to respect multiple light sources that in return should interact with other light's shadows. And it should be fast! I'm thinking that you should be able to lit an entire level just with lights!

    >

    > I have no idea what libraries can do that, so I don't know how they will work, blend together or whatever they might have to do. What I wanted to depict is the workflow and how lights should affect other light's shadows and bump-mapping, with just a few clicks.

    >

    Well, in my mind blending modes gives the user freedom whether the individual Shadow Lights should be screened or added (dodged), hence why the user should be able to turn the Shadow Light effect opaque.

    With the tests I have made I reached the conclusion that screening individual lights looks best, since (I think) we're dealing with 8-bit rendering here. In the real world, light is additive, but that would require a floating point rendering rather than 8 or 16-bit colour depth. Floating colour for this kind of engine is way overkill, so I don't feel it is necessary. And Add-blending tends to create ugly blobs when two light sources are mixed together. Yet the user should have the freedom to choose what to make of the effect.

    This is a gif of the simple test I did with the lighting.

    https://imgur.com/Mojlpsn

    It is created with the same methods described by Ashley in the lighting tutorial. Although I am stuck with a limited number of lights, this is four dynamic lights with the demo running smoothly. I think this principle can hold at least ten lights at once on my regular laptop, I haven't tested it though, but using blending modes feels quite fast. And since I have a background in compositing, using blending modes for lighting feels very logical.

    I am no programmer though, so I really don't know if it's more efficient to blend these lights using alpha channel.

    But I do agree that AE's layer system provides both goods and bads. It's fast, but the flow of things are restricted by the layer order.

    Any chance of getting a demo of this?

  • Oh hey, I'm still alive !

    Sorry for this absence of several months, I've been through a lot of stuff and a lot of places including a new home, new place to study, a bad break up and other stupid things. I don't really care, you don't care too, let's get back to work. I see that this topic remained active for a while before its final journey in the forum's abyss, and thus there's certainly some stuff interesting enough to be add in my tutorial. Gonna check that. For now I must re-read the tutorial to correct as many spelling mistakes as possible.

    English is not my mother tongue (and I'm sure you noticed that) so if anynone here would like to assist me and take a look at 28 pages of tutorial to make sure that I don't speak (well, write) like a retarded chicken, that'd be nice. Anyway, I'll upload the first version of the tutorial this afternoon. It's composed of several parts (yeah thanks captain obvious I know) including :

    • An explanation regarding Normal maps
    • A list of several tools more or less efficient to generate our Normal maps (with pros and cons of each one)
    • How to use these normal maps in Construct 2 and the basic concept of dynamic lighting
    • A list of several ways/plugins available to deal with dynamic lighting in Construct 2 (with explanations, pros and cons)
    • practical example with a provided capx if needed

    The tutorial will be Regularly updated, of course.

  • LeuNoeleeste It´s sounds quite cool.

  • Rasputin thanks mate, I hope it will be as cool as it seems.

    I still have to work on it, it's not ready to be uploaded in the tutorial section yet. However, here's a PDF of its current state :

    https://www.mediafire.com/?hfcyh60x07qct32

    Should be over tomorrow. Don't hesitate to take a look at it.

  • WOW! That pdf is amazing. Long time ago I was struggeling with normal maps with not too much succes. After reading your tutorial I will do.

    Great job! and thanks for share with the community.

    ))

  • LeuNoeleeste , have a look at this post this topic.

    Great stuff there!

  • Impressive work on that tutorial. Thank you LeuNoeleeste .

  • Rasputin Perfect, I written it to help the community, if it does, I am satisfied. As I said, it's not completely over yet, I still have some work to do. The demo CapX of Bob's world is missing and I didn't say everything in the practical example part. Gonna fix that today and then upload the whole stuff in the regular tutorial section.

    @eli0s Gonna check it, thanks !

    @glerikud You welcome, the community helped me a lof of time in the past, if I can help too it's all to my advantage.

    Don't forget to signal me any mistake or any nonsense, once again, english is not my mother tongue so there's probably some weird sentences somewhere in this mess.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • LeuNoeleeste The sprite lamp is yours creation right?

    I bought it on Kickstart and told you about Construct 2 in one of the first messages there, you may notice it watching back.

    I never used my sprite lamp because of a vacation time from C2, but now I'm back and willing to use it.

    There is any change to give us a topic called "Sprite Lamp Addon" where you can you put everything together for us start using your sprite lamp?

    I know if I read the entire topic with its 9 pages fully with details I'll be able to use it, but this is a kind of stuff everybody wants avoid, specially when time is short.

    By the way, thank you for taking time to come here and help us.

  • TELLES0808 Hello ! I didn't really understand your question, but I'm gonna try to answer it anyway. So, I assume you were talking about the Sprite Lamp tool. Obviously no I'm not the creator or one of the creators of this tool, but I'm sure this was not your question's sense. Regardind the topic itself, I just bought the tool and then used a zombie sprite to generate a normal map, which offers the result featured in the first page of this thread. So it's not really my creation, more like the tool's one hehe.

    Yeah no need to read 9 pages, don't worry. Actually, this topic was nothing but a suggestion for a real dynamic light system in Construct 2 or Construct 3, but finally made me write an entire tutorial about the various solutions already available to use this kind of lighting in our games using Construct 2. You should take a look at it, I talk about Sprite Lamp and Construct 2 in it (and globally anything anyone should knows about Normal Map, lighting configuration and Construct 2). The concept is always the same, the tool you're using does not really matter. You can find the PDF of the current version on the first page (I edited it) or directly here :

    https://www.mediafire.com/?hfcyh60x07qct32

    Once again, I'm still working on it, and english is not my mother tongue so if you find any mistakes or nonsenses, please let me know.

  • TELLES0808 Hello ! I didn't really understand your question, but I'm gonna try to answer it anyway. So, I assume you were talking about the Sprite Lamp tool. Obviously no I'm not the creator or one of the creators of this tool, but I'm sure this was not your question's sense. Regardind the topic itself, I just bought the tool and then used a zombie sprite to generate a normal map, which offers the result featured in the first page of this thread. So it's not really my creation, more like the tool's one hehe.

    Yeah no need to read 9 pages, don't worry. Actually, this topic was nothing but a suggestion for a real dynamic light system in Construct 2 or Construct 3, but finally made me write an entire tutorial about the various solutions already available to use this kind of lighting in our games using Construct 2. You should take a look at it, I talk about Sprite Lamp and Construct 2 in it (and globally anything anyone should knows about Normal Map, lighting configuration and Construct 2). The concept is always the same, the tool you're using does not really matter. You can find the PDF of the current version on the first page (I edited it) or directly here :

    https://www.mediafire.com/?hfcyh60x07qct32

    Once again, I'm still working on it, and english is not my mother tongue so if you find any mistakes or nonsenses, please let me know.

    Oh, that's nice, thank you! I thought you was the creator because you talked with property about this issue.

    I'll take a look at this tutorial. Thanks again.

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