Make pixel lighting like terraria and starbound
Asked Answered
T

1

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.

Thirlage answered 3/1, 2017 at 12:3 Comment(1)
Did you fixed the lighting somehow yet?Carmelocarmen
W
-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.

Wunder answered 3/1, 2017 at 13:33 Comment(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 ?Thirlage
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.Wunder
Not a solution! This is way too performance heavy. And lights will increase their intensity. You will probably need some 2d raycasting.Carmelocarmen
@DerkJanSpeelman I fully agree, the way I putted it would be way too performatic to work as transparent as he would want.Wunder

© 2022 - 2024 — McMap. All rights reserved.