1

I found out that I can't use more than 8 LightNodes, I can add them as a child but they are not shown on the view.

Chris
  • 25
  • 7
  • Sorry, it's not immediately clear to me what and where the problem is from this image. Can you add some hieroglyphics to point out where and what the problem is? – Confused Mar 04 '18 at 07:40
  • To whoever came up with the idea of not letting new users add images... you thought wrong. – Confused Mar 04 '18 at 07:41
  • I changed the image. – Chris Mar 04 '18 at 09:35
  • So you have two shadows overlapping in the middle of this image? – Confused Mar 04 '18 at 10:40
  • Thats ok. I mean the light grey area, the LightNode doesn't outshine the shadow of the other LightNode. – Chris Mar 04 '18 at 11:52
  • Sorry, I still don't get what you're talking about. Can you point exactly at what the problem is? – Confused Mar 04 '18 at 17:19
  • Yeah sry I don't speak english very well :/. – Chris Mar 04 '18 at 19:12
  • But I try my best, both LightNodes cast a light and my problem is that the LightNodes don't cast their light in the shadow of the another LightNode. I marked these areas I hope you know now what I mean. – Chris Mar 04 '18 at 19:57
  • I think you're seeing the right thing. Two shadows, overlapping, multiply their "darkness". The light is equally influencing the left and right. – Confused Mar 05 '18 at 03:02
  • The overlapping zone is right. But the area where only one shadow is, isn't effected by light of the other LightNode, and that includes the region where both LightNodes are, which I marked and that makes no sense in my opinion. – Chris Mar 05 '18 at 07:52
  • What is making the shadows? – Confused Mar 05 '18 at 11:01
  • The mountain in the middle of the image. – Chris Mar 05 '18 at 16:17
  • I think it was @knight0fdragon who famously said SpriteKit isn't really a game engine, and clarified how it's only a very basic framework for making games. That's probably the most sage thing anyone has ever said about Sprite Kit. – Confused Mar 08 '18 at 11:29

1 Answers1

1

What is wrong? I add two light with Lighting Mask equals to 1 and a node (the rectangle) with Shadow Cast Mask equals to 1.

In both cases (lights can see each other, or rectangle is in between) you have areas with no shadow, a medium shadow from one of the light and a strong shadow from both light. In these both cases, the falloff is 0.

If you add some falloff the you can clearly see the effect of each light.

Both in shadow cone of each otherin shadow

Both in light cone of each otherin light

Both in shadow cone of each other with some fall offwith fall off

Jean-Baptiste Yunès
  • 34,548
  • 4
  • 48
  • 69
  • Yeah I have the same effect. But I don't understand why there are medium shadows, because when there is a light there can't be shadow. For instance, if you put 20 lights around the rectangle, we should have a very dark shadow around the object, despite the fact that we have 20 lights around it. Maybe I'm completely wrong, but in my opinion it does not make any sense. – Chris Mar 05 '18 at 16:16
  • 1
    At this point, I think you're asking why does SpriteKit work the way it works. The fact that "in real life" there might not be a shadow is not related to what SpriteKit does with lighting. If you play with the ambient light color and light color values, you will probably find the solution you are looking for. – Daniel K Mar 05 '18 at 18:38
  • Ok thank you very much. Maybe I will, but I don't think so. I want to make a strategy game and I thought LightNodes are a good and easy way to implement the fog of war, but sadly they aren't. – Chris Mar 05 '18 at 19:09
  • @Chris light decay in spritekit is not really realistic as cumulative lighting effects. Realistic effects are very computing intensive (realistic energy model is complex). – Jean-Baptiste Yunès Mar 06 '18 at 07:54
  • 1
    argh, fog of war... this is, oddly enough, best done with "clouds" that are part transparent bitmaps (.png files are perfect) and can be added where you need, layered as you need, and animated as you need. Large cloud sprites, basically... http://i.imgur.com/jpQMMt1.jpg @Chris – Confused Mar 08 '18 at 11:28