Hello. I’m trying to replicate Minecraft. A lot of things are obvious to me, but now I needed help.
At the moment I’m trying to implement lighting into the game. We are talking about lighting from light sources. For example: torch, bonfire, lamp, lava, etc.
If there are a lot of light sources, for example, to build up the entire 16x16 floor with torches, then you will expect fps drawdowns of up to 15 frames or lower.
If you turn off the shadows from the light, then the fps will get to 40 fps, which is also not very cool.
I’ve been looking for light lighting options for a long time, but I haven’t found any information about it, and it upsets me.
The only thing I came up with was to spread light by applying a glow to the material. This way I can simulate the propagation of light from block to block, and where necessary, shade the blocks.
There is a similar system in Minecraft itself
However, they still manage to smooth out this light somehow, I haven’t figured out how to solve this problem to the end. But I think different shapes of masks will help me.
It was my way. It’s not bad, you can load a whole chunk(1616250) of glowing blocks, and it won’t give a load, giving out 120 fps
But there is one problem. This method illuminates the blocks well, but it does not illuminate the player at all, or any mobs that I want to create. (Entity)
The same rule applies to the lighting of objects in the first person (sword in hand and ourselves)
We’ll be in the dark.
I had an idea to add logic that constantly looks at which blocks are illuminated around us, and constantly force spot lighting to follow us. I think 4 pieces around would be enough. But all the same, even specifying that it will illuminate only us, it will give a load, with a large number of animals, although we will indicate the logic, not to produce duplicate light sources. In addition, if this is not done smoothly, then the light on the screen will be shown in jerks.
I am ready to hear your suggestions and ideas, any about this. Maybe you have a radically different idea of how to draw light with shadows and not load the computer? Or maybe you can tell me how to implement character lighting in my way? I have heard that there is such a technology as virtual textures, and they can be used to simulate light on a character. It also surprises me that there are shaders on a simple minecraft that create beautiful shadows and lighting, and such a powerful “Unreal Engine” is not able to repeat, causing terrible fps. I do not know, and I am very tired. I need your brain help.
At the moment I am working in the fourth version