0

I'm making a 2D sandbox game like "Terraria" and "Starbound". This is my game

game

The light is filling the whole terrain but i don't want it. I want following:

desired lighting.

1
  • Did you fixed the lighting somehow yet? Mar 14, 2018 at 22:38

1 Answer 1

-1

You're probably using Directional Lighting, which illuminates the whole terrain equally in the direction you made it. You could use Spot Lights or Point Lights, which will illuminate only the surface you want to.

Edit: although using this method, this could take way more resources due to the number of single lights placed throughout the map.

4
  • i can place Spot Lights or Point Lights near the top block of the terrain to simulate sun light , suppose the height of terrain is 50 blocks and the Spot Lights or Point Lights is place near to the top of the terrain to simulate sun light , but now the player transform height of terrain to 30 blocks , but the Spot Lights or Point Lights is still on 50 blocks height , how to fix this problem ?
    – Ben
    Jan 5, 2017 at 10:50
  • You could possibly link the Spot Light or the Point Light to the lowest surface in Y possible, meaning that, it'll always be near the floor, even if the player breaks blocks in that direction. Try it and give me another call if it hasn't worked, or vote me up if worked! ;) Cheers, mate. Jan 5, 2017 at 14:18
  • Not a solution! This is way too performance heavy. And lights will increase their intensity. You will probably need some 2d raycasting. Mar 14, 2018 at 21:39
  • @DerkJanSpeelman I fully agree, the way I putted it would be way too performatic to work as transparent as he would want. Aug 8, 2018 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.