- Home /
Block lightning (Minecraft like)
Hello Community!
I'm working on a 2D minecraft like game. It doesn't really matter if 2D oder 3D because my problem is very general.
Each of my chunks is made out of a 16 by 16 byte array. Each chunk has a single mesh. The textures are placed with uv coordinates from a texture atlas.
Now that I have the basics I wanted to implement some simple lighting. Like in Minecraft. I've read many articles on the internet, but they are really general and don't give the idea of how to implement it.
I understood that I have to make something like a floodfill and that every block needs a lightning value.
My question now is how do I change the color of specific uv coordinates? Is it even possible?
I hope some of you can give me some advice! Thank you!
Answer by Mr.Hal · May 03, 2014 at 06:48 PM
Just keep track of each Vertice iteration on a cube, on the mesh, and then you will be able to change the color.
Its this or a custom made shader with a Color value for each 256 cubes on a chunk.
Thank you very much! That was what I was searching for. For the others, you have to use a vertex shader for it to work.
Your answer
Follow this Question
Related Questions
What to do to make the chunk check other chunks? 1 Answer
Material doesn't have a color property '_Color' 4 Answers
How do I assign different parts of model to different materials during runtime? 1 Answer
How do I control the block placing? 1 Answer
How can I reduce CPU cost of blocks in my Minecraft clone? 1 Answer