How do I deal with light effect?

1 favourites
From the Asset Store
A total of 214 high quality and unique magic sound effects suitable for RPG, Battle Arena and more!
  • Hello I am making a platform game and I cant figure how to deal with multiple "lights" in more layers with different parallax, I will try to describe it.

    I am talking about thing from beginner examples - "Simple lighting" there is a layer with black color, force own texture and then some object (white circle) with blend mode - "destination out" so it works like light in that black colored layer, fine.

    But I am making platform game where main layer has 100% parallax, level is bigger then one screen. And I have got another back layer for clouds/sun etc where parallax is 0% and I want to have source of lights both at main layer and at back layer, how to make it?

    It seems that all light sources must be in same black colored layer to work but how to deal with light sources with need of different parallax? Let me tell you example...

    I have got player who is light source at main layer (moving in bigger level) and also have got for example sun/moon at back layer which should be at same position (maybe sun is moving at the back but with 0% parallax).

    I hope it is enough understandable and I hope someone come up with idea, thanks in advance.

  • For illustrating what I mean look at attachment from game Kingdom

  • I tried to read something more about light in games and there must be dynamic lights? Is there any way in C3 how to make it, or is dynamic light necessary? I want to achieve similar light effects like at that screen above (from game Kingdom), please someone advice me how things work and how is it possible to make it in C3?

  • Hi !

    i guess you can use this method, no ?

    https://www.construct.net/en/tutorials/making-advanced-lighting-2232/need-2

    hope it helps !

  • Hello thanks for answer but I already read this tutorial and it seems too much complex and difficult, I do not need shadows etc and also it seems that I do not need dynamic lights if you look at that image sprites are not affected by light (haven´t got normal maps etc), graphic is only colored similar like at beginner examples - "Simple lighting", but it is in more layers with different parallax and I still do not know how to make it in C3, please I will be glad for any tips.

  • okay well, i guess you seek sthing similar to this right ?

    It's a shorter tutorial to make sthing similar to your needs i guess

    https://vocal.media/gamers/how-to-create-lighting-effect-in-construct-2-and-3

    Hope it helps :)

    ps: when they say "attach the light object to the player", just attach it to your torch/campfire object if you want sthing similar to your screenshot

  • Okey I read more tutorials and according to advance example: Shadows blending multiple lights and older tutorial about it, is here:

    construct.net/en/tutorials/multiple-colored-shadow-casting-lights-1107

    It works great, I am using only lights (no shadows) so I can add lights to only one layer with additive blend mode and then main graphic layer put above it and set effect Multiply and it works as you can see in my example modified test project :)

    https://drive.google.com/file/d/1NNRQU-v34KcqT1jgwgdcsC_luzbD8sE-/view?usp=sharing

    but there is still problem then I cannot make it works with more layers or I would like to make two independent light layers I mean back layer with sun/moon affect only that back layer with light (because it is far away) and then there will be front layer/layers with own light sources, is there any trick for it?

    I will add pictures from my test project to describe it better

    Here you can see working setup but only 1 light layer affecting 1 main layer (100% parallax)

    When I move Light layer under next main layer (80% parallax) to have two layers affected by one Light layer, it is not working with that Multiply, so what have to be changed to work correctly?

    Then I want another layers under it but not affected by this Light layer (there are far away = low parallax of layer)... and have there another Light layer (light from moon etc) to which affected only these back layers, is it possible?

    I know it may sounds little bit more complicated (in particular from my description because English is not my native lang) but I do not know how to achieve similar situation like at game Kingdom, so please advice will be great or can I ask Ashley who is the author of that tutorial.

  • Well, i dont know if it's what you want, i'm not even sure to understand your issue xD

    To keep your initial capture from kingdom new lands as an example,

    It's not working if you have this layer order ? (from back to front)

    1/ Moon + stars etc

    2/ moon light

    3/ Clouds

    4/ Rocks

    etc

    my guess is, as long as the moon light layer is not in front of the cloud layer, the moon light should appear like it's far from the clouds isnt it ?

    ps: bcs u're using a beta release of construct i cant open your c3p sorry

    ps2: sorry if it's not relevant, i'm not sure to understand your issue :/

  • Try to start it in web browser and at this link:

    https://www.construct.net/en/make-games/releases/beta/r229

    you can start latest beta version and in it open my test project

    Thanks for your answers and effort I know it is complicate and hard to explain but again I will try to specify it better. :))

    As you wrote (from back to front) + my extension:

    1/ Moon, sky (affected by light from layer 2)

    2/ moon LIGHT (this light layer 2 will affect only layer 1)

    3/ Clouds (not affected by any light)

    4/ Rocks (not affected by any light)

    5/ Trees, stones, decor assets etc (near to main layer for example with parallax 90% should be affected by light from layer 7)

    6/ Main layer with player, interactive objects, light objects (lamp, torch etc... should be affected by light from layer 7)

    7/ main LIGHT (another light layer and there is a problem how to do it and make it independent to moon LIGHT layer 2... should affect both 5 and 6 layers)

    8/ front layer (not affected by any light) for example parallax 120% like closer to camera so light from layer 7 should not affect it

    I hope it will be more clear at this model situation, thanks in advance for any tips. :)

  • What u think ? is this what you need ?

    just add a "moon" on the layer 0

    and add light for this moon on layer 50

    and defined layer 0 and 50 with the same paralax values

    Also i deleted a background on "main" layer (defined as transparent) and i removed the multiply effect on some layers

    https://www.dropbox.com/s/1618db2eujmyiaa/testLight.c3p?dl=0

    as you can see if you jump near the "moon", the light of the character is in front of the light of the moon

    also, i've added a "cloud" in layer80 as a proof of concept

    didnt do all of you need but it's a good start to continue like that i guess, no ?

  • It is all nice but there is no more light/shadow "thing" I mean light that "light-up" shadows like here:

    I thing there must be that thing with "baking-into layer, set multiply effect" but it seems it is possible to "bake-in" only into 1 layer :( or I do not know

    You only leave there additive blend mode on lights so it glows above all layers under it but no shadow/light effect.

  • It is all nice but there is no more light/shadow "thing" I mean light that "light-up" shadows like here:

    I thing there must be that thing with "baking-into layer, set multiply effect" but it seems it is possible to "bake-in" only into 1 layer :( or I do not know

    You only leave there additive blend mode on lights so it glows above all layers under it but no shadow/light effect.

    huuuum yeah i didnt noticed that sorry x)

    i hope someone else can help on this but so far i have no more clues :/ i would try tomorrow with a fresh view on this if nobody else give you a solution :)

  • As it mentioned here from Ashley

    construct.net/en/tutorials/multiple-colored-shadow-casting-lights-1107

    "you can only apply this kind of lighting to a single background layer. Other layers on top cannot have this lighting applied, since by the time they are rendered the background already has the light map applied. It's sort of "baked in" to the image by then, and you can only multiply with the final result, which isn't very useful"

    It seems like an answer that it is not possible so I will try different approach with black layer and Destination out light sources maybe add little color to light by additive effect and try to fake somehow that parallax movement in other layers. It will not be perfect and same situation like at that game Kingdom but maybe it will be enough. At image below you can see the light that affect all layers under it I would like to have bottom layer not affected etc.

    I will let you know here when I will make it up something working.

    I am starting from this state with that Destination out ;)

  • So here is my better progress with more layers and objects, you can try to make something with this version. It is more clear from it what I want to achieve.

    I fake parallax 0% of moon layer to set layer 100% and add + ViewportLeft to X coordination of moon so result is the same and I can add light to moon (into light layer with parallax 100%)

    https://drive.google.com/file/d/1LRbEvZuMlX6mc2pKPvkqQGUENdVAg4qa/view?usp=sharing

    I need to make these lights independent any tips anyone? :)) Now all lights are at front and affects all layers under it and of course it is incorrect, for example light from moon should be only at back and not affect main layer etc but how to make it??

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • last idea for me ^^

    maybe you could add a black sprite on the moon light layer to "hide" the light when needed ?

    but you'll need a dedicated moon light layer for that i guess, to avoir the hiding of the others lights

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